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