Recovered Crew | Medical+Cargo Respawns (#87072)

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
This commit is contained in:
Time-Green
2024-10-26 09:36:57 +02:00
committed by GitHub
parent 95cc258845
commit d170a410d4
45 changed files with 950 additions and 72 deletions
+4 -48
View File
@@ -874,11 +874,8 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_atoms_ontop)
var/admin_spawned
///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
)
/// Corpse type we spawn thats always human
var/datum/corpse_damage_class/morgue_body_class = /datum/corpse_damage_class/station/morgue
/obj/effect/mapping_helpers/dead_body_placer/Initialize(mapload)
. = ..()
@@ -906,57 +903,16 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_atoms_ontop)
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)
var/override_species = CONFIG_GET(string/morgue_cadaver_override_species)
var/list/usable_races
if(use_species)
var/list/temp_list = get_selectable_species()
usable_races = temp_list.Copy()
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)
LAZYADD(usable_races, override_species)
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(morgue_tray.loc)
var/species_to_pick
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.fully_replace_character_name(new_human.real_name, new_human.generate_random_mob_name())
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
var/mob/living/carbon/human/new_human = GLOB.lost_crew_manager.create_lost_crew(revivable = FALSE, forced_class = morgue_body_class)
body_bag.insert(new_human, TRUE)
body_bag.close()
body_bag.handle_tag("[new_human.real_name][species_to_pick ? " - [capitalize(species_to_pick)]" : " - Human"]")
body_bag.handle_tag("[new_human.real_name][new_human.dna?.species ? " - [new_human.dna.species.name]" : " - Human"]")
body_bag.forceMove(morgue_tray)
new_human.death() //here lies the mans, rip in pepperoni.
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
part.organ_flags |= ORGAN_FROZEN
morgue_tray.update_appearance()
qdel(src)