You've already forked ComfyFactorio
mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-11-23 22:22:34 +02:00
Mtn v3: fix desync
This commit is contained in:
@@ -89,11 +89,11 @@ notify_full_inventory_2=Your inventory is full. Join the warrior club today! Pum
|
|||||||
new_items_at_market=New items have been unlocked at the locomotive market!
|
new_items_at_market=New items have been unlocked at the locomotive market!
|
||||||
discharge_unlocked=Discharge defense has now been unlocked at the market!
|
discharge_unlocked=Discharge defense has now been unlocked at the market!
|
||||||
artillery_unlocked=Artillery has now been unlocked at the market!
|
artillery_unlocked=Artillery has now been unlocked at the market!
|
||||||
crafting_bonus=__1__ unlocked the last missing piece for the mystical chest!\n[color=yellow]Crafting speed bonus has been applied for 15 minutes![/color]
|
crafting_bonus=__1__ unlocked the last missing piece for the mystical chest!\n[color=yellow]Crafting speed bonus has been applied for 30 minutes![/color]
|
||||||
mining_bonus=__1__ unlocked the last missing piece for the mystical chest!\n[color=yellow]Mining speed bonus has been applied for 15 minutes![/color]
|
mining_bonus=__1__ unlocked the last missing piece for the mystical chest!\n[color=yellow]Mining speed bonus has been applied for 30 minutes![/color]
|
||||||
mining_bonus_end=Mining speed bonus has ended!
|
mining_bonus_end=Mining speed bonus has ended!
|
||||||
crafting_bonus_end=Crafting speed bonus has ended!
|
crafting_bonus_end=Crafting speed bonus has ended!
|
||||||
movement_bonus=__1__ unlocked the last missing piece for the mystical chest!\n[color=yellow]Movement speed bonus has been applied for 15 minutes![/color]
|
movement_bonus=__1__ unlocked the last missing piece for the mystical chest!\n[color=yellow]Movement speed bonus has been applied for 30 minutes![/color]
|
||||||
movement_bonus_end=Movement speed bonus has ended!
|
movement_bonus_end=Movement speed bonus has ended!
|
||||||
coin_bonus=__1__ unlocked the last missing piece for the mystical chest!\n[color=yellow]Coins has been distributed![/color]
|
coin_bonus=__1__ unlocked the last missing piece for the mystical chest!\n[color=yellow]Coins has been distributed![/color]
|
||||||
xp_bonus=__1__ unlocked the last missing piece for the mystical chest!\n[color=yellow]XP has been granted to Global pool![/color]
|
xp_bonus=__1__ unlocked the last missing piece for the mystical chest!\n[color=yellow]XP has been granted to Global pool![/color]
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ function Public.move_players(current_task)
|
|||||||
end
|
end
|
||||||
local starting_planet = Public.get_planet()
|
local starting_planet = Public.get_planet()
|
||||||
current_task.message = 'Moved players to initial surface!'
|
current_task.message = 'Moved players to initial surface!'
|
||||||
current_task.delay = game.tick + 100
|
current_task.delay = game.tick + 1
|
||||||
current_task.state_id = 1
|
current_task.state_id = 1
|
||||||
current_task.starting_planet = starting_planet
|
current_task.starting_planet = starting_planet
|
||||||
current_task.state = 'pre_init_task'
|
current_task.state = 'pre_init_task'
|
||||||
@@ -425,6 +425,12 @@ function Public.pre_init_task(current_task)
|
|||||||
local this = Public.get()
|
local this = Public.get()
|
||||||
game.speed = 1
|
game.speed = 1
|
||||||
|
|
||||||
|
local active_surface_index = Public.get('active_surface_index')
|
||||||
|
local surface = game.surfaces[active_surface_index]
|
||||||
|
if surface and surface.valid then
|
||||||
|
game.delete_surface(surface.name)
|
||||||
|
end
|
||||||
|
|
||||||
current_task.done = nil
|
current_task.done = nil
|
||||||
current_task.step = 1
|
current_task.step = 1
|
||||||
|
|
||||||
@@ -541,9 +547,10 @@ end
|
|||||||
function Public.clear_fortress(current_task)
|
function Public.clear_fortress(current_task)
|
||||||
local surface = game.surfaces[current_task.starting_planet]
|
local surface = game.surfaces[current_task.starting_planet]
|
||||||
if surface then
|
if surface then
|
||||||
surface.clear()
|
game.delete_surface(surface.name)
|
||||||
surface.request_to_generate_chunks({ x = -20, y = -22 }, 1)
|
-- surface.request_to_generate_chunks({ x = -20, y = -22 }, 1)
|
||||||
surface.force_generate_chunk_requests()
|
-- surface.force_generate_chunk_requests()
|
||||||
|
Public.set('active_surface_index', nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
current_task.state = 'create_custom_fortress_surface'
|
current_task.state = 'create_custom_fortress_surface'
|
||||||
@@ -553,11 +560,7 @@ function Public.clear_fortress(current_task)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Public.create_custom_fortress_surface(current_task)
|
function Public.create_custom_fortress_surface(current_task)
|
||||||
local fortress = game.surfaces[current_task.starting_planet]
|
Public.set('active_surface_index', Public.create_surface(true))
|
||||||
if fortress then
|
|
||||||
fortress.clear()
|
|
||||||
end
|
|
||||||
Public.set('active_surface_index', Public.create_surface())
|
|
||||||
local active_surface_index = Public.get('active_surface_index')
|
local active_surface_index = Public.get('active_surface_index')
|
||||||
|
|
||||||
WD.set('surface_index', active_surface_index)
|
WD.set('surface_index', active_surface_index)
|
||||||
@@ -788,8 +791,7 @@ function Public.to_fortress(current_task)
|
|||||||
local adjusted_zones = Public.get('adjusted_zones')
|
local adjusted_zones = Public.get('adjusted_zones')
|
||||||
local position
|
local position
|
||||||
|
|
||||||
local wd = WD.get()
|
WD.set('game_lost', false)
|
||||||
wd.game_lost = false
|
|
||||||
|
|
||||||
if adjusted_zones.reversed then
|
if adjusted_zones.reversed then
|
||||||
game.forces.player.set_spawn_position({ -27, -25 }, surface)
|
game.forces.player.set_spawn_position({ -27, -25 }, surface)
|
||||||
|
|||||||
@@ -144,18 +144,20 @@ function Public.soft_reset_map(old_surface)
|
|||||||
this.soft_reset_counter = this.soft_reset_counter + 1
|
this.soft_reset_counter = this.soft_reset_counter + 1
|
||||||
|
|
||||||
local surface = old_surface or game.surfaces.fortress
|
local surface = old_surface or game.surfaces.fortress
|
||||||
surface.clear(true)
|
if surface and surface.valid then
|
||||||
-- surface.request_to_generate_chunks({ 0, 0 }, 1)
|
surface.clear(true)
|
||||||
-- surface.force_generate_chunk_requests()
|
-- surface.request_to_generate_chunks({ 0, 0 }, 1)
|
||||||
|
-- surface.force_generate_chunk_requests()
|
||||||
|
|
||||||
local radius = 512
|
local radius = 512
|
||||||
local area = { { x = -radius, y = -radius }, { x = radius, y = radius } }
|
local area = { { x = -radius, y = -radius }, { x = radius, y = radius } }
|
||||||
for _, entity in pairs(surface.find_entities_filtered { area = area, type = 'logistic-robot' }) do
|
for _, entity in pairs(surface.find_entities_filtered { area = area, type = 'logistic-robot' }) do
|
||||||
entity.destroy()
|
entity.destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, entity in pairs(surface.find_entities_filtered { area = area, type = 'construction-robot' }) do
|
for _, entity in pairs(surface.find_entities_filtered { area = area, type = 'construction-robot' }) do
|
||||||
entity.destroy()
|
entity.destroy()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local message = table.concat({ mapkeeper .. ' Welcome to Mtn Fortress!' })
|
local message = table.concat({ mapkeeper .. ' Welcome to Mtn Fortress!' })
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ local function exclude_surface(surface, state)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function Public.create_surface()
|
function Public.create_surface(recreate)
|
||||||
exclude_surface(game.surfaces.nauvis)
|
exclude_surface(game.surfaces.nauvis)
|
||||||
|
|
||||||
local map_gen_settings =
|
local map_gen_settings =
|
||||||
@@ -72,7 +72,7 @@ function Public.create_surface()
|
|||||||
local planets = Public.get_planets()
|
local planets = Public.get_planets()
|
||||||
|
|
||||||
if Public.is_modded then
|
if Public.is_modded then
|
||||||
if not this.active_surface_index then
|
if not this.active_surface_index or recreate then
|
||||||
this.active_surface_index = game.planets[starting_planet].create_surface().index
|
this.active_surface_index = game.planets[starting_planet].create_surface().index
|
||||||
else
|
else
|
||||||
this.active_surface_index = Public.soft_reset_map(game.surfaces[starting_planet], map_gen_settings).index
|
this.active_surface_index = Public.soft_reset_map(game.surfaces[starting_planet], map_gen_settings).index
|
||||||
|
|||||||
@@ -745,6 +745,7 @@ function Public.reset_main_table()
|
|||||||
table.insert(corpses_raffle, e.name)
|
table.insert(corpses_raffle, e.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
this.corpses_raffle = corpses_raffle
|
||||||
|
|
||||||
for _, planet in pairs(game.planets) do
|
for _, planet in pairs(game.planets) do
|
||||||
local platforms = planet.get_space_platforms('player')
|
local platforms = planet.get_space_platforms('player')
|
||||||
@@ -759,7 +760,6 @@ function Public.reset_main_table()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
this.corpses_raffle = corpses_raffle
|
|
||||||
|
|
||||||
this.enforce_wave_200_before_collapse = true
|
this.enforce_wave_200_before_collapse = true
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,7 @@ local function call_handlers(handlers, event)
|
|||||||
for i = 1, #handlers do
|
for i = 1, #handlers do
|
||||||
if _DEBUG then
|
if _DEBUG then
|
||||||
local handler = handlers[i]
|
local handler = handlers[i]
|
||||||
if handler then
|
handler(event)
|
||||||
handler(event)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
xpcall(handlers[i], handler_error, event)
|
xpcall(handlers[i], handler_error, event)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user