1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-30 23:17:53 +02:00

fix bug with crew not disbanding after loss

This commit is contained in:
danielmartin0 2024-09-07 22:16:13 +01:00
parent cf21c7bc4f
commit 8f1bd0e002
5 changed files with 14 additions and 10 deletions

View File

@ -105,7 +105,7 @@ ship_set_off_to_next_island=[font=heading-1]Ship set sail[/font] for the next de
crew_continue_on_freeplay=The run now continues on 'Freeplay'.
victory_continue_reminder=If you wish to continue the game, click up top.
crew_disband_tick_message=The crew will disband in 20 seconds.
crew_disband_tick_message=The crew will disband in 30 seconds.
protected_run_lock_expired=Protection of __1__ crew has expired. Captain role will not be locked anymore when the captain leaves.
private_run_lock_expired=Private lock of __1__ crew has expired. Anyone can join this crew now.

View File

@ -24,10 +24,10 @@ Public.private_run_cap = 2
Public.protected_run_cap = 2 -- more precisely protected, but not private run cap
Public.minimumCapacitySliderValue = 1
Public.minimum_run_capacity_to_enforce_space_for = 22
-- auto-disbanding when there are no players left in the crew:
Public.autodisband_ticks = nil
-- Public.autodisband_ticks = 30*60*60
-- Public.autodisband_ticks = 30 --the reason this is low is because the comfy server runs very slowly when no-one is on it
-- Public.autodisband_ticks = nil
Public.autodisband_ticks = 60 * 60 * 60 * 24 * 3 -- should not be zero (as this messes with saving and loading a game, which boots the player for a moment.) Also note that the server may run very slowly when no-one is on it.
Public.boat_steps_at_a_time = 1

View File

@ -135,6 +135,7 @@ function Public.try_lose(loss_reason)
memory.game_lost = true
memory.crew_disband_tick_message = game.tick + 60*10
memory.crew_disband_tick = game.tick + 60*40
memory.crew_disband_tick_cannot_be_prevented = true
local playtimetext = Utils.time_longform((memory.age or 0)/60)
@ -427,8 +428,8 @@ function Public.join_crew(player, rejoin)
Roles.confirm_captain_exists(player)
end
if #Common.crew_get_crew_members() == 1 and memory.crew_disband_tick then
memory.crew_disband_tick = nil --to prevent disbanding the crew after saving the game (booting everyone) and loading it again (joining the crew as the only member)
if #Common.crew_get_crew_members() == 1 and memory.crew_disband_tick and not memory.crew_disband_tick_cannot_be_prevented then
memory.crew_disband_tick = nil
end
if memory.overworldx > 0 then
@ -511,11 +512,13 @@ function Public.leave_crew(player, to_lobby, quiet)
Roles.player_left_so_redestribute_roles(player)
if #Common.crew_get_crew_members() == 0 then
if Common.autodisband_ticks then
local exists_disband_tick = memory.crew_disband_tick and memory.crew_disband_trick > game.tick
if Common.autodisband_ticks and not exists_disband_tick then
memory.crew_disband_tick = game.tick + Common.autodisband_ticks
end
-- memory.crew_disband_tick = game.tick + 60*60*2 --give players time to log back in after a crash or save
if _DEBUG then memory.crew_disband_tick = game.tick + 30*60*60 end
-- if _DEBUG then memory.crew_disband_tick = game.tick + 30*60*60 end
end
end

View File

@ -271,7 +271,7 @@ local function crew_tick()
if memory.crew_disband_tick_message < tick then
memory.crew_disband_tick_message = nil
local message1 = { 'pirates.crew_disband_tick_message', 30 }
local message1 = { 'pirates.crew_disband_tick_message' }
Common.notify_force(memory.force, message1)

View File

@ -102,6 +102,7 @@ function Public.initialise_crew_memory(id) --mostly serves as a dev reference of
memory.game_lost = false
memory.game_won = false
memory.crew_disband_tick = nil
memory.crew_disband_tick_cannot_be_prevented = nil
memory.destinationsvisited_indices = nil
memory.overworldx = nil
memory.overworldy = nil