From ae7bd5e023b6c684509716756e574d6208dbd1a8 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Thu, 13 Jul 2023 23:01:28 -0700 Subject: [PATCH 1/4] Banishment is now checked for larva queue --- code/__HELPERS/game.dm | 19 +++++++++++++++++-- code/game/gamemodes/cm_initialize.dm | 7 +++++++ .../structures/special/pylon_core.dm | 2 +- .../mob/living/carbon/xenomorph/Embryo.dm | 2 +- .../mob/living/carbon/xenomorph/death.dm | 2 +- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 0132a31d0b50..cca3edda464e 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -241,8 +241,14 @@ else return get_step(start, EAST) -/// Get a list of observers that can be alien candidates, optionally sorted by larva_queue_time -/proc/get_alien_candidates(sorted = TRUE) +/** + * Get a list of observers that can be alien candidates. + * + * Arguments: + * * hive - The hive we're filling a slot for to check if the player is banished + * * sorted - Whether to sort by larva_queue_time (default TRUE) or leave unsorted + */ +/proc/get_alien_candidates(datum/hive_status/hive = null, sorted = TRUE) var/list/candidates = list() for(var/mob/dead/observer/cur_obs as anything in GLOB.observer_list) @@ -273,6 +279,15 @@ if((cur_obs.client.admin_holder && (cur_obs.client.admin_holder.rights & R_MOD)) && !cur_obs.adminlarva) continue + if(hive) + var/banished = FALSE + for(var/mob_name in hive.banished_ckeys) + if(hive.banished_ckeys[mob_name] == cur_obs.ckey) + banished = TRUE + break + if(banished) + continue + candidates += cur_obs // Optionally sort by larva_queue_time diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm index 18b11dde030e..34888b0513ed 100644 --- a/code/game/gamemodes/cm_initialize.dm +++ b/code/game/gamemodes/cm_initialize.dm @@ -379,6 +379,13 @@ Additional game mode variables. // No cache, lets check now then message_alien_candidates(get_alien_candidates(), dequeued = 0, cache_only = TRUE) if(candidate_observer.larva_queue_cached_message) + var/datum/hive_status/cur_hive + for(var/hive_num in GLOB.hive_datum) + cur_hive = GLOB.hive_datum[hive_num] + for(var/mob_name in cur_hive.banished_ckeys) + if(cur_hive.banished_ckeys[mob_name] == xeno_candidate.ckey) + candidate_observer.larva_queue_cached_message += "\n" + SPAN_WARNING("NOTE: You are banished from the [cur_hive] and you may not rejoin unless the Queen re-admits you or dies.") + break to_chat(xeno_candidate, candidate_observer.larva_queue_cached_message) return FALSE diff --git a/code/modules/cm_aliens/structures/special/pylon_core.dm b/code/modules/cm_aliens/structures/special/pylon_core.dm index c38e540efb30..a29b49b7745a 100644 --- a/code/modules/cm_aliens/structures/special/pylon_core.dm +++ b/code/modules/cm_aliens/structures/special/pylon_core.dm @@ -150,7 +150,7 @@ 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() + var/list/players_with_xeno_pref = get_alien_candidates(linked_hive) if(players_with_xeno_pref && players_with_xeno_pref.len) if(spawning_larva && spawn_burrowed_larva(players_with_xeno_pref[1])) // We were in spawning_larva mode and successfully spawned someone diff --git a/code/modules/mob/living/carbon/xenomorph/Embryo.dm b/code/modules/mob/living/carbon/xenomorph/Embryo.dm index 01f6c1a3c238..3ba42650e49c 100644 --- a/code/modules/mob/living/carbon/xenomorph/Embryo.dm +++ b/code/modules/mob/living/carbon/xenomorph/Embryo.dm @@ -163,7 +163,7 @@ if(!picked) // Get a candidate from observers - var/list/candidates = get_alien_candidates() + var/list/candidates = get_alien_candidates(hive) if(candidates && candidates.len) // If they were facehugged by a player thats still in queue, they get second dibs on the new larva. if(hugger_ckey) diff --git a/code/modules/mob/living/carbon/xenomorph/death.dm b/code/modules/mob/living/carbon/xenomorph/death.dm index e3a69da23262..12c9b3e37c9b 100644 --- a/code/modules/mob/living/carbon/xenomorph/death.dm +++ b/code/modules/mob/living/carbon/xenomorph/death.dm @@ -38,7 +38,7 @@ if(GLOB.hive_datum[hivenumber].stored_larva) GLOB.hive_datum[hivenumber].stored_larva = round(GLOB.hive_datum[hivenumber].stored_larva * 0.5) //Lose half on dead queen - var/list/players_with_xeno_pref = get_alien_candidates() + var/list/players_with_xeno_pref = get_alien_candidates(GLOB.hive_datum[hivenumber]) if(players_with_xeno_pref && istype(GLOB.hive_datum[hivenumber].hive_location, /obj/effect/alien/resin/special/pylon/core)) var/turf/larva_spawn = get_turf(GLOB.hive_datum[hivenumber].hive_location) var/count = 0 From 4e9d0fe246aac560686a59a658e297eb8abdb3a8 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Thu, 13 Jul 2023 23:03:03 -0700 Subject: [PATCH 2/4] Standardize intoTheSunset to use max of larva_queue_time like the others --- code/modules/shuttle/shuttle.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 6d3465ee8747..983fffeb2634 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -635,7 +635,7 @@ var/mob/dead/observer/obs = mob.ghostize(FALSE) if(obs) obs.timeofdeath = world.time - obs.client?.player_details.larva_queue_time = world.time + obs.client?.player_details.larva_queue_time = max(obs.client.player_details.larva_queue_time, world.time) mob.moveToNullspace() // Now that mobs are stowed, delete the shuttle From 93e76641fdd3189c535d1db8dbe9b0b4a8e99e5b Mon Sep 17 00:00:00 2001 From: Drulikar Date: Thu, 13 Jul 2023 23:03:36 -0700 Subject: [PATCH 3/4] Cryoing now sets larva queue time --- code/game/machinery/cryopod.dm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index ed06c0117f33..9c0a227008c3 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -503,23 +503,25 @@ GLOBAL_LIST_INIT(frozen_items, list(SQUAD_MARINE_1 = list(), SQUAD_MARINE_2 = li add_fingerprint(usr) -/obj/structure/machinery/cryopod/proc/go_in_cryopod(mob/M, silent = FALSE) +/obj/structure/machinery/cryopod/proc/go_in_cryopod(mob/mob, silent = FALSE) if(occupant) return - M.forceMove(src) - occupant = M + mob.forceMove(src) + occupant = mob icon_state = "body_scanner_closed" SetLuminosity(2) time_entered = world.time start_processing() if(!silent) - if(M.client) - to_chat(M, SPAN_NOTICE("You feel cool air surround you. You go numb as your senses turn inward.")) - to_chat(M, SPAN_BOLDNOTICE("If you log out or close your client now, your character will permanently removed from the round in 10 minutes. If you ghost, timer will be decreased to 2 minutes.")) + if(mob.client) + to_chat(mob, SPAN_NOTICE("You feel cool air surround you. You go numb as your senses turn inward.")) + to_chat(mob, SPAN_BOLDNOTICE("If you log out or close your client now, your character will permanently removed from the round in 10 minutes. If you ghost, timer will be decreased to 2 minutes.")) + if(!is_admin_level(src.z)) // Set their queue time now because the client has to actually leave to despawn and at that point the client is lost + mob.client.player_details.larva_queue_time = max(mob.client.player_details.larva_queue_time, world.time) var/area/location = get_area(src) - if(M.job != GET_MAPPED_ROLE(JOB_SQUAD_MARINE)) - message_admins("[key_name_admin(M)], [M.job], has entered \a [src] at [location] after playing for [duration2text(world.time - M.life_time_start)].") + if(mob.job != GET_MAPPED_ROLE(JOB_SQUAD_MARINE)) + message_admins("[key_name_admin(mob)], [mob.job], has entered \a [src] at [location] after playing for [duration2text(world.time - mob.life_time_start)].") playsound(src, 'sound/machines/hydraulics_3.ogg', 30) silent_exit = silent From 9165979123d1512b450146797e4b986d458e2488 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Fri, 14 Jul 2023 00:30:29 -0700 Subject: [PATCH 4/4] Tweak banished queue message note. --- code/game/gamemodes/cm_initialize.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm index 34888b0513ed..6ab53aacd043 100644 --- a/code/game/gamemodes/cm_initialize.dm +++ b/code/game/gamemodes/cm_initialize.dm @@ -384,7 +384,7 @@ Additional game mode variables. cur_hive = GLOB.hive_datum[hive_num] for(var/mob_name in cur_hive.banished_ckeys) if(cur_hive.banished_ckeys[mob_name] == xeno_candidate.ckey) - candidate_observer.larva_queue_cached_message += "\n" + SPAN_WARNING("NOTE: You are banished from the [cur_hive] and you may not rejoin unless the Queen re-admits you or dies.") + candidate_observer.larva_queue_cached_message += "\n" + SPAN_WARNING("NOTE: You are banished from the [cur_hive] and you may not rejoin unless the Queen re-admits you or dies. Your queue number won't update until there is a hive you aren't banished from.") break to_chat(xeno_candidate, candidate_observer.larva_queue_cached_message) return FALSE