From 84d4dc1129513caae20a77605f675fa55901837e Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sun, 24 Sep 2023 22:40:27 -0700 Subject: [PATCH 1/2] Delegate buried larva joins to only hive cores/pops when there is a queue --- code/__HELPERS/game.dm | 2 ++ code/_globalvars/misc.dm | 3 +++ code/game/gamemodes/cm_initialize.dm | 26 +++++++++++++++----------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 66ecf9ea034f..8d6fb4266776 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -294,6 +294,8 @@ if(sorted && length(candidates)) candidates = sort_list(candidates, GLOBAL_PROC_REF(cmp_obs_larvaqueuetime_asc)) + GLOB.xeno_queue_candidate_count = length(candidates) + return candidates /** diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index 6c689e995504..646b8ec2c854 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -27,3 +27,6 @@ GLOBAL_VAR_INIT(time_offset, setup_offset()) /// Sets the offset 2 lines above. /proc/setup_offset() return rand(10 MINUTES, 24 HOURS) + +/// The last count of possible candidates in the xeno larva queue (updated via get_alien_candidates) +GLOBAL_VAR(xeno_queue_candidate_count) diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm index 36271054bb21..0c01e3d780e4 100644 --- a/code/game/gamemodes/cm_initialize.dm +++ b/code/game/gamemodes/cm_initialize.dm @@ -356,17 +356,21 @@ Additional game mode variables. else available_xenos_non_ssd += cur_xeno - 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) + // 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) 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 1dc175ca2168e3b400d6c7088870bba8bdd076bd Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 25 Sep 2023 07:56:06 -0700 Subject: [PATCH 2/2] Also disable ghost notification on hijack surge if theres a queue (they couldn't actually join, but no point notifying the disappointment) --- .../cm_aliens/structures/special/pylon_core.dm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/code/modules/cm_aliens/structures/special/pylon_core.dm b/code/modules/cm_aliens/structures/special/pylon_core.dm index c24c34de099c..2fc5af9bb14c 100644 --- a/code/modules/cm_aliens/structures/special/pylon_core.dm +++ b/code/modules/cm_aliens/structures/special/pylon_core.dm @@ -263,25 +263,26 @@ linked_hive.hive_ui.update_burrowed_larva() qdel(worm) + var/count_spawned = 0 var/spawning_larva = can_spawn_larva() && (last_larva_time + spawn_cooldown) < world.time if(spawning_larva) last_larva_time = world.time if(spawning_larva || (last_larva_queue_time + spawn_cooldown * 4) < world.time) last_larva_queue_time = world.time var/list/players_with_xeno_pref = get_alien_candidates(linked_hive) - if(players_with_xeno_pref && players_with_xeno_pref.len) + if(length(players_with_xeno_pref)) if(spawning_larva && spawn_burrowed_larva(players_with_xeno_pref[1])) // We were in spawning_larva mode and successfully spawned someone - message_alien_candidates(players_with_xeno_pref, dequeued = 1) - else - // Just time to update everyone their queue status (or the spawn failed) - message_alien_candidates(players_with_xeno_pref, dequeued = 0) + count_spawned = 1 + // Update everyone's queue status + message_alien_candidates(players_with_xeno_pref, dequeued = count_spawned) if(linked_hive.hijack_burrowed_surge && (last_surge_time + surge_cooldown) < world.time) last_surge_time = world.time linked_hive.stored_larva++ linked_hive.hijack_burrowed_left-- - notify_ghosts(header = "Claim Xeno", message = "The Hive has gained another burrowed larva! Click to take it.", source = src, action = NOTIFY_JOIN_XENO, enter_link = "join_xeno") + if(GLOB.xeno_queue_candidate_count < 1 + count_spawned) + notify_ghosts(header = "Claim Xeno", message = "The Hive has gained another burrowed larva! Click to take it.", source = src, action = NOTIFY_JOIN_XENO, enter_link = "join_xeno") if(surge_cooldown > 30 SECONDS) //mostly for sanity purposes surge_cooldown = surge_cooldown - surge_incremental_reduction //ramps up over time if(linked_hive.hijack_burrowed_left < 1)