From 2247dfb54b4cf63c08289695e55bc312d507b06e Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 20 Nov 2023 23:57:23 -0800 Subject: [PATCH 1/2] Fix possible edgecase where theres a larva queue but no core in the first 30 minutes of the round Cleanup logic to use early returns instead --- code/game/gamemodes/cm_initialize.dm | 36 ++++++++++++++++------------ 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm index 17a255009089..45cc7c07fa34 100644 --- a/code/game/gamemodes/cm_initialize.dm +++ b/code/game/gamemodes/cm_initialize.dm @@ -356,21 +356,27 @@ Additional game mode variables. else available_xenos_non_ssd += cur_xeno - // Only offer buried larva if there is no queue: - // This basically means this block of code will almost never execute, because we are instead relying on the hive cores/larva pops to handle their larva - // Technically this should be after a get_alien_candidates() call to be accurate, but we are intentionally trying to not call that proc as much as possible - if(GLOB.xeno_queue_candidate_count < 1) - var/datum/hive_status/hive - for(var/hivenumber in GLOB.hive_datum) - hive = GLOB.hive_datum[hivenumber] - if(!hive.hardcore && hive.stored_larva && (hive.hive_location || (world.time < XENO_BURIED_LARVA_TIME_LIMIT + SSticker.round_start_time))) - if(SSticker.mode && (SSticker.mode.flags_round_type & MODE_RANDOM_HIVE)) - available_xenos |= "any buried larva" - LAZYADD(available_xenos["any buried larva"], hive) - else - var/larva_option = "buried larva ([hive])" - available_xenos += larva_option - available_xenos[larva_option] = list(hive) + var/datum/hive_status/hive + for(var/hivenumber in GLOB.hive_datum) + hive = GLOB.hive_datum[hivenumber] + if(hive.hardcore) + continue + if(!hive.stored_larva) + continue + // Only offer buried larva if there is no queue because we are instead relying on the hive cores/larva pops to handle their larva: + // Technically this should be after a get_alien_candidates() call to be accurate, but we are intentionally trying to not call that proc as much as possible + if(hive.hive_location && GLOB.xeno_queue_candidate_count > 0) + continue + if(!hive.hive_location && (world.time > XENO_BURIED_LARVA_TIME_LIMIT + SSticker.round_start_time)) + continue + + if(SSticker.mode && (SSticker.mode.flags_round_type & MODE_RANDOM_HIVE)) + available_xenos |= "any buried larva" + LAZYADD(available_xenos["any buried larva"], hive) + else + var/larva_option = "buried larva ([hive])" + available_xenos += larva_option + available_xenos[larva_option] = list(hive) if(!available_xenos.len || (instant_join && !available_xenos_non_ssd.len)) if(!xeno_candidate.client || !xeno_candidate.client.prefs || !(xeno_candidate.client.prefs.be_special & BE_ALIEN_AFTER_DEATH)) From f7bb901384c2e92bf695fc541148d48a9a5217d4 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Tue, 21 Nov 2023 00:15:34 -0800 Subject: [PATCH 2/2] Fix indentation --- code/game/gamemodes/cm_initialize.dm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm index 45cc7c07fa34..519ce4ed4f6f 100644 --- a/code/game/gamemodes/cm_initialize.dm +++ b/code/game/gamemodes/cm_initialize.dm @@ -370,13 +370,13 @@ Additional game mode variables. if(!hive.hive_location && (world.time > XENO_BURIED_LARVA_TIME_LIMIT + SSticker.round_start_time)) continue - if(SSticker.mode && (SSticker.mode.flags_round_type & MODE_RANDOM_HIVE)) - available_xenos |= "any buried larva" - LAZYADD(available_xenos["any buried larva"], hive) - else - var/larva_option = "buried larva ([hive])" - available_xenos += larva_option - available_xenos[larva_option] = list(hive) + if(SSticker.mode && (SSticker.mode.flags_round_type & MODE_RANDOM_HIVE)) + available_xenos |= "any buried larva" + LAZYADD(available_xenos["any buried larva"], hive) + else + var/larva_option = "buried larva ([hive])" + available_xenos += larva_option + available_xenos[larva_option] = list(hive) if(!available_xenos.len || (instant_join && !available_xenos_non_ssd.len)) if(!xeno_candidate.client || !xeno_candidate.client.prefs || !(xeno_candidate.client.prefs.be_special & BE_ALIEN_AFTER_DEATH))