From cf8cbc69ae2bfbc702c6c4a9c0d71de52098708b Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Thu, 31 Aug 2023 03:44:25 +0200 Subject: [PATCH] [MIRROR] Morgue dead body placer guarantees 1 human to dissect if non-human cadaver config is enabled. Morgues spawn with 1 additional body (except on Birdboat). [MDB IGNORE] (#23397) * Morgue dead body placer guarantees 1 human to dissect if non-human cadaver config is enabled. Morgues spawn with 1 additional body (except on Birdboat). (#77816) ## About The Pull Request - Morgue guarantees 1 human body to dissect even if `morgue_cadaver_disable_nonhumans` config flag is set. - All maps bar birdboat will now spawn with one additional morgue cadaver. - Did some minor code cleanup around the dead body placer, removes an `in world` loop, etc. ## Why It's Good For The Game - Morgue guarantees 1 human body to dissect even if `morgue_cadaver_disable_nonhumans` config flag is set. - This is mostly a downstream server issue but if your server enables this config and has additional species enabled, the odds of you getting a human to dissect tends to be very low. - Why is this a problem? Well, a human is necessary to dissect to get medical's tech. - Why not get genetics to get you a hu-monkey? This is an option, but if A. there's no geneticists or B. they are refusing to cooperate then you tend to be SOL unless you want to wait for a greytide to come in after drinking themselves to death. Given we have a role now dedicated to performing dissections, having no job to do for the first twenty or so minutes due to a lack of a human body is kind of sad. - If this is an intended facet, I will revert this change and leave it to the code improvements / bodycount uptick. - All maps bar birdboat will now spawn with one additional morgue cadaver. - This was actually intended on some maps but has been stealthily removed in some cases? Icebox and Delta used to have two dead body spawners to place 4 cadavers. So I decided to bring this back. - For the most part, this just gives higher population maps more bodies to mess around with. Higher pop means more people means more people need bodies, either for antagging, cooking, body replacements, or coron-ing. - Also like, sometimes messing around with dead bodies are fun, and it's nice to not have to worry that you're running out of them for actual medical use. - I can also make this scale on roundstart pop if we really care. But that seems overkill. Especially as these maps had their body counts higher for a while and were fine. ## Changelog :cl: Melbert balance: If your server has non-human morgue cadavers enabled, you will be guaranteed one human cadaver no matter what. balance: All maps (with the exception of Birdboat) now have an additional morgue cadaver roundstart. /:cl: * Morgue dead body placer guarantees 1 human to dissect if non-human cadaver config is enabled. Morgues spawn with 1 additional body (except on Birdboat). --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> --- _maps/map_files/Birdshot/birdshot.dmm | 4 +- code/modules/mapping/mapping_helpers.dm | 81 ++++++++++--------- .../mob/living/carbon/carbon_defines.dm | 4 +- 3 files changed, 50 insertions(+), 39 deletions(-) diff --git a/_maps/map_files/Birdshot/birdshot.dmm b/_maps/map_files/Birdshot/birdshot.dmm index 748aa80de1d..d0f594f9757 100644 --- a/_maps/map_files/Birdshot/birdshot.dmm +++ b/_maps/map_files/Birdshot/birdshot.dmm @@ -37339,7 +37339,9 @@ }, /obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4, /obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2, -/obj/effect/mapping_helpers/dead_body_placer, +/obj/effect/mapping_helpers/dead_body_placer{ + bodycount = 2 + }, /turf/open/floor/iron/dark/small, /area/station/medical/morgue) "nxJ" = ( diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index d32bc6e5938..d1fc4a79cf7 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -840,8 +840,15 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava) name = "Dead Body placer" late = TRUE icon_state = "deadbodyplacer" + ///if TRUE, was spawned out of mapload. var/admin_spawned - var/bodycount = 2 //number of bodies to spawn + ///number of bodies to spawn + var/bodycount = 3 + /// These species IDs will be barred from spawning if morgue_cadaver_disable_nonhumans is disabled (In the future, we can also dehardcode this) + var/list/blacklisted_from_rng_placement = list( + SPECIES_ETHEREAL, // they revive on death which is bad juju + SPECIES_HUMAN, // already have a 50% chance of being selected + ) /obj/effect/mapping_helpers/dead_body_placer/Initialize(mapload) . = ..() @@ -850,23 +857,23 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava) admin_spawned = TRUE /obj/effect/mapping_helpers/dead_body_placer/LateInitialize() - var/area/a = get_area(src) - var/list/trays = list() - for (var/i in a.contents) - if (istype(i, /obj/structure/bodycontainer/morgue)) - if(admin_spawned) - var/obj/structure/bodycontainer/morgue/early_morgue_tray = i - if(early_morgue_tray.connected.loc != early_morgue_tray) - continue - trays += i - if(!trays.len) + var/area/morgue_area = get_area(src) + var/list/obj/structure/bodycontainer/morgue/trays = list() + for(var/turf/area_turf as anything in morgue_area.get_contained_turfs()) + var/obj/structure/bodycontainer/morgue/morgue_tray = locate() in area_turf + if(isnull(morgue_tray) || !morgue_tray.beeper || morgue_tray.connected.loc != morgue_tray) + continue + trays += morgue_tray + + var/numtrays = length(trays) + if(numtrays == 0) if(admin_spawned) message_admins("[src] spawned at [ADMIN_VERBOSEJMP(src)] failed to find a closed morgue to spawn a body!") else log_mapping("[src] at [x],[y] could not find any morgues.") return - var/reuse_trays = (trays.len < bodycount) //are we going to spawn more trays than bodies? + var/reuse_trays = (numtrays < bodycount) //are we going to spawn more trays than bodies? var/use_species = !(CONFIG_GET(flag/morgue_cadaver_disable_nonhumans)) var/species_probability = CONFIG_GET(number/morgue_cadaver_other_species_probability) @@ -875,35 +882,39 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava) if(use_species) var/list/temp_list = get_selectable_species() usable_races = temp_list.Copy() - usable_races -= SPECIES_ETHEREAL //they revive on death which is bad juju - LAZYREMOVE(usable_races, SPECIES_HUMAN) - if(!usable_races) + LAZYREMOVE(usable_races, blacklisted_from_rng_placement) + if(!LAZYLEN(usable_races)) notice("morgue_cadaver_disable_nonhumans. There are no valid roundstart nonhuman races enabled. Defaulting to humans only!") if(override_species) warning("morgue_cadaver_override_species BEING OVERRIDEN since morgue_cadaver_disable_nonhumans is disabled.") else if(override_species) - usable_races += override_species + LAZYADD(usable_races, override_species) - for (var/i = 1 to bodycount) + var/guaranteed_human_spawned = FALSE + for (var/i in 1 to bodycount) var/obj/structure/bodycontainer/morgue/morgue_tray = reuse_trays ? pick(trays) : pick_n_take(trays) var/obj/structure/closet/body_bag/body_bag = new(morgue_tray.loc) - var/mob/living/carbon/human/new_human = new /mob/living/carbon/human(morgue_tray.loc, 1) + var/mob/living/carbon/human/new_human = new(morgue_tray.loc) var/species_to_pick - if(LAZYLEN(usable_races)) - if(!species_probability) - species_probability = 50 - stack_trace("WARNING: morgue_cadaver_other_species_probability CONFIG SET TO 0% WHEN SPAWNING. DEFAULTING TO [species_probability]%.") - if(prob(species_probability)) - species_to_pick = pick(usable_races) - var/datum/species/new_human_species = GLOB.species_list[species_to_pick] - if(new_human_species) - new_human.set_species(new_human_species) - new_human_species = new_human.dna.species - new_human_species.randomize_features(new_human) - new_human.fully_replace_character_name(new_human.real_name, new_human_species.random_name(new_human.gender, TRUE, TRUE)) - else - stack_trace("failed to spawn cadaver with species ID [species_to_pick]") //if it's invalid they'll just be a human, so no need to worry too much aside from yelling at the server owner lol. + + if(guaranteed_human_spawned && use_species) + if(LAZYLEN(usable_races)) + if(!isnum(species_probability)) + species_probability = 50 + stack_trace("WARNING: morgue_cadaver_other_species_probability CONFIG SET TO 0% WHEN SPAWNING. DEFAULTING TO [species_probability]%.") + if(prob(species_probability)) + species_to_pick = pick(usable_races) + var/datum/species/new_human_species = GLOB.species_list[species_to_pick] + if(new_human_species) + new_human.set_species(new_human_species) + new_human_species = new_human.dna.species + new_human_species.randomize_features(new_human) + new_human.fully_replace_character_name(new_human.real_name, new_human_species.random_name(new_human.gender, TRUE, TRUE)) + else + stack_trace("failed to spawn cadaver with species ID [species_to_pick]") //if it's invalid they'll just be a human, so no need to worry too much aside from yelling at the server owner lol. + else + guaranteed_human_spawned = TRUE body_bag.insert(new_human, TRUE) body_bag.close() @@ -911,18 +922,16 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava) body_bag.forceMove(morgue_tray) new_human.death() //here lies the mans, rip in pepperoni. - for (var/part in new_human.organs) //randomly remove organs from each body, set those we keep to be in stasis + for (var/obj/item/organ/internal/part in new_human.organs) //randomly remove organs from each body, set those we keep to be in stasis if (prob(40)) qdel(part) else - var/obj/item/organ/O = part - O.organ_flags |= ORGAN_FROZEN + part.organ_flags |= ORGAN_FROZEN morgue_tray.update_appearance() qdel(src) - //On Ian's birthday, the hop's office is decorated. /obj/effect/mapping_helpers/ianbirthday name = "Ian's Bday Helper" diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm index 722f4282543..16b5b478af0 100644 --- a/code/modules/mob/living/carbon/carbon_defines.dm +++ b/code/modules/mob/living/carbon/carbon_defines.dm @@ -11,8 +11,8 @@ usable_hands = 0 //Populated on init through list/bodyparts mobility_flags = MOBILITY_FLAGS_CARBON_DEFAULT blocks_emissive = EMISSIVE_BLOCK_NONE - ///List of [/obj/item/organ/internal] in the mob. They don't go in the contents for some reason I don't want to know. - var/list/obj/item/organ/internal/organs = list() + ///List of [/obj/item/organ]s in the mob. They don't go in the contents for some reason I don't want to know. + var/list/obj/item/organ/organs = list() ///Same as [above][/mob/living/carbon/var/organs], but stores "slot ID" - "organ" pairs for easy access. var/list/organs_slot = list() ///How many dream images we have left to send