[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

🆑 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.
/🆑

* 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>
This commit is contained in:
SkyratBot
2023-08-31 03:44:25 +02:00
committed by GitHub
parent b9f4e606ff
commit cf8cbc69ae
3 changed files with 50 additions and 39 deletions
+45 -36
View File
@@ -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"