From f92ab11b0086335808044b24f7c655f777eafd07 Mon Sep 17 00:00:00 2001 From: Kapu1178 <75460809+Kapu1178@users.noreply.github.com> Date: Tue, 27 Aug 2024 19:53:24 -0400 Subject: [PATCH] Dying now shows a cause of death (#1082) * initial build * death data * fix hard del * another harddel fix (lolo try catch) * verb for cod * fix compile error * remove old death message --- code/datums/components/genetic_damage.dm | 2 +- code/datums/diseases/beesease.dm | 2 +- code/datums/diseases/dna_spread.dm | 2 +- code/datums/diseases/flu.dm | 4 +- code/datums/status_effects/debuffs/debuffs.dm | 2 +- code/datums/status_effects/debuffs/drunk.dm | 6 +- code/modules/admin/admin_verbs.dm | 1 + code/modules/admin/verbs/admingame.dm | 12 + code/modules/antagonists/blob/blob_mobs.dm | 6 +- .../blob/blobstrains/cryogenic_poison.dm | 2 +- .../blob/blobstrains/regenerative_materia.dm | 2 +- .../heretic/mobs/maid_in_mirror.dm | 2 +- code/modules/antagonists/morph/morph.dm | 2 +- code/modules/antagonists/revenant/revenant.dm | 2 +- .../revenant/revenant_abilities.dm | 2 +- .../antagonists/revenant/revenant_blight.dm | 2 +- .../awaymissions/mission_code/snowdin.dm | 2 +- code/modules/cargo/gondolapod.dm | 2 +- code/modules/events/spacevine.dm | 4 +- code/modules/mob/living/basic/basic.dm | 2 +- .../modules/mob/living/basic/basic_defense.dm | 4 +- .../mob/living/basic/health_adjustment.dm | 2 +- .../mob/living/basic/vermin/cockroach.dm | 2 +- code/modules/mob/living/brain/brain_item.dm | 22 +- code/modules/mob/living/brain/death.dm | 2 +- code/modules/mob/living/brain/life.dm | 4 +- .../mob/living/carbon/alien/damage_procs.dm | 2 +- .../mob/living/carbon/alien/humanoid/death.dm | 4 +- .../mob/living/carbon/alien/larva/death.dm | 2 +- .../mob/living/carbon/alien/larva/life.dm | 4 +- .../carbon/alien/special/alien_embryo.dm | 4 +- code/modules/mob/living/carbon/carbon.dm | 6 +- .../modules/mob/living/carbon/damage_procs.dm | 7 +- code/modules/mob/living/carbon/death.dm | 2 +- code/modules/mob/living/carbon/human/death.dm | 350 +++++++++++++++++- code/modules/mob/living/carbon/human/human.dm | 9 +- .../mob/living/carbon/human/human_defines.dm | 2 + .../mob/living/carbon/human/monkey/monkey.dm | 2 +- code/modules/mob/living/carbon/life.dm | 4 +- code/modules/mob/living/damage_procs.dm | 4 +- code/modules/mob/living/death.dm | 21 +- code/modules/mob/living/living.dm | 4 +- code/modules/mob/living/silicon/ai/death.dm | 2 +- code/modules/mob/living/silicon/ai/life.dm | 8 +- .../mob/living/silicon/damage_procs.dm | 2 +- code/modules/mob/living/silicon/death.dm | 2 +- code/modules/mob/living/silicon/pai/death.dm | 2 +- code/modules/mob/living/silicon/pai/pai.dm | 4 +- .../modules/mob/living/silicon/robot/death.dm | 2 +- .../modules/mob/living/silicon/robot/robot.dm | 6 +- .../mob/living/simple_animal/bot/bot.dm | 4 +- .../mob/living/simple_animal/damage_procs.dm | 2 +- .../mob/living/simple_animal/friendly/cat.dm | 2 +- .../mob/living/simple_animal/friendly/dog.dm | 4 +- .../simple_animal/friendly/drone/_drone.dm | 2 +- .../living/simple_animal/friendly/mouse.dm | 2 +- .../mob/living/simple_animal/friendly/pet.dm | 2 +- .../living/simple_animal/guardian/guardian.dm | 2 +- .../simple_animal/guardian/types/dextrous.dm | 2 +- .../guardian/types/gravitokinetic.dm | 2 +- .../mob/living/simple_animal/hostile/bees.dm | 2 +- .../mob/living/simple_animal/hostile/carp.dm | 4 +- .../living/simple_animal/hostile/hivebot.dm | 2 +- .../living/simple_animal/hostile/hostile.dm | 2 +- .../simple_animal/hostile/jungle/leaper.dm | 2 +- .../simple_animal/hostile/jungle/mook.dm | 2 +- .../simple_animal/hostile/mecha_pilot.dm | 2 +- .../mob/living/simple_animal/hostile/mimic.dm | 6 +- .../hostile/mining_mobs/brimdemon.dm | 2 +- .../hostile/mining_mobs/goldgrub.dm | 2 +- .../hostile/mining_mobs/hivelord.dm | 2 +- .../hostile/mining_mobs/ice_demon.dm | 2 +- .../hostile/mining_mobs/mining_mobs.dm | 2 +- .../hostile/mining_mobs/polarbear.dm | 2 +- .../living/simple_animal/hostile/mushroom.dm | 2 +- .../living/simple_animal/hostile/regalrat.dm | 2 +- .../simple_animal/hostile/space_dragon.dm | 2 +- .../simple_animal/hostile/wumborian_fugu.dm | 2 +- .../mob/living/simple_animal/parrot.dm | 4 +- .../modules/mob/living/simple_animal/shade.dm | 2 +- .../mob/living/simple_animal/simple_animal.dm | 6 +- .../mob/living/simple_animal/slime/death.dm | 2 +- .../mob/living/simple_animal/slime/life.dm | 2 +- .../mob/living/simple_animal/slime/slime.dm | 2 +- code/modules/mob/mob.dm | 2 +- .../projectiles/projectile/special/floral.dm | 2 +- .../chemistry/goon_reagents/other_reagents.dm | 10 +- code/modules/reagents/chemistry/reagents.dm | 2 +- .../chemistry/reagents/alcohol_reagents.dm | 16 +- .../chemistry/reagents/dispenser_reagents.dm | 8 +- .../chemistry/reagents/drink_reagents.dm | 2 +- .../chemistry/reagents/drug_reagents.dm | 18 +- .../chemistry/reagents/medicine_reagents.dm | 6 +- .../chemistry/reagents/other_reagents.dm | 14 +- .../chemistry/reagents/toxin_reagents.dm | 32 +- code/modules/surgery/bodyparts/_bodyparts.dm | 12 +- .../surgery/bodyparts/germs_bodypart.dm | 2 +- code/modules/surgery/machines/bodyscanner.dm | 34 +- .../surgery/machines/bodyscanner_helpers.dm | 4 +- .../surgery/new_surgery/internal_organs.dm | 2 +- code/modules/surgery/organs/_organ.dm | 22 +- code/modules/surgery/organs/appendix.dm | 7 +- code/modules/surgery/organs/heart.dm | 2 - code/modules/surgery/organs/kidneys.dm | 11 +- code/modules/surgery/organs/liver.dm | 9 +- .../surgery/organs/stomach/_stomach.dm | 2 +- .../unit_tests/bodypart_organ_sanity.dm | 8 +- code/modules/wiremod/shell/drone.dm | 2 +- code/modules/zombie/organs.dm | 2 +- 109 files changed, 625 insertions(+), 242 deletions(-) diff --git a/code/datums/components/genetic_damage.dm b/code/datums/components/genetic_damage.dm index c3979ce9279f..cc97fe1873a6 100644 --- a/code/datums/components/genetic_damage.dm +++ b/code/datums/components/genetic_damage.dm @@ -51,7 +51,7 @@ if (total_damage >= minimum_before_damage) var/mob/living/living_mob = parent - living_mob.adjustToxLoss(toxin_damage_per_second * delta_time) + living_mob.adjustToxLoss(toxin_damage_per_second * delta_time, cause_of_death = "Genetic breakdown") total_damage -= remove_per_second * delta_time if (total_damage <= 0) diff --git a/code/datums/diseases/beesease.dm b/code/datums/diseases/beesease.dm index 2410d0eaa15d..077abdc5c575 100644 --- a/code/datums/diseases/beesease.dm +++ b/code/datums/diseases/beesease.dm @@ -28,7 +28,7 @@ if(DT_PROB(1, delta_time)) to_chat(affected_mob, span_danger("Your stomach stings painfully.")) if(prob(20)) - affected_mob.adjustToxLoss(2) + affected_mob.adjustToxLoss(2, cause_of_death = "Beesease") if(4) if(DT_PROB(5, delta_time)) affected_mob.visible_message(span_danger("[affected_mob] buzzes."), \ diff --git a/code/datums/diseases/dna_spread.dm b/code/datums/diseases/dna_spread.dm index df8b0d1df56f..d3ec071a2d7f 100644 --- a/code/datums/diseases/dna_spread.dm +++ b/code/datums/diseases/dna_spread.dm @@ -48,7 +48,7 @@ if(DT_PROB(0.5, delta_time)) affected_mob.apply_pain(1, BODY_ZONE_CHEST, "Your abdomen hurts.") if(prob(20)) - affected_mob.adjustToxLoss(2, FALSE) + affected_mob.adjustToxLoss(2, FALSE, cause_of_death = "Retrovirus") if(4) if(!transformed && !carrier) //Save original dna for when the disease is cured. diff --git a/code/datums/diseases/flu.dm b/code/datums/diseases/flu.dm index 19e78fce0355..2aa40f659bd5 100644 --- a/code/datums/diseases/flu.dm +++ b/code/datums/diseases/flu.dm @@ -30,7 +30,7 @@ if(DT_PROB(0.5, delta_time)) affected_mob.apply_pain(5, BODY_ZONE_CHEST, "Your abdomen hurts.") if(prob(20)) - affected_mob.adjustToxLoss(1, FALSE) + affected_mob.adjustToxLoss(1, FALSE, cause_of_death = "Influenza") if(affected_mob.body_position == LYING_DOWN && DT_PROB(10, delta_time)) to_chat(affected_mob, span_notice("You feel better.")) stage-- @@ -48,7 +48,7 @@ if(DT_PROB(0.5, delta_time)) affected_mob.apply_pain(5, BODY_ZONE_CHEST, "Your abdomen hurts.") if(prob(20)) - affected_mob.adjustToxLoss(1, FALSE) + affected_mob.adjustToxLoss(1, FALSE, cause_of_death = "Influenza") if(affected_mob.body_position == LYING_DOWN && DT_PROB(7.5, delta_time)) to_chat(affected_mob, span_notice("You feel better.")) stage-- diff --git a/code/datums/status_effects/debuffs/debuffs.dm b/code/datums/status_effects/debuffs/debuffs.dm index c90ba17a84b1..d7a939f18dea 100644 --- a/code/datums/status_effects/debuffs/debuffs.dm +++ b/code/datums/status_effects/debuffs/debuffs.dm @@ -296,7 +296,7 @@ return owner.adjustBruteLoss(0.1) owner.adjustFireLoss(0.1) - owner.adjustToxLoss(0.2, TRUE, TRUE) + owner.adjustToxLoss(0.2, TRUE, TRUE, cause_of_death = "His wrath") /datum/status_effect/cultghost //is a cult ghost and can't use manifest runes id = "cult_ghost" diff --git a/code/datums/status_effects/debuffs/drunk.dm b/code/datums/status_effects/debuffs/drunk.dm index 9bdef49a61e3..61b3509d398f 100644 --- a/code/datums/status_effects/debuffs/drunk.dm +++ b/code/datums/status_effects/debuffs/drunk.dm @@ -182,13 +182,13 @@ // Over 81, we will gain constant toxloss if(drunk_value >= 81) - owner.adjustToxLoss(1) + owner.adjustToxLoss(1, cause_of_death = "Alcohol poisoning") if(owner.stat == CONSCIOUS && prob(5)) to_chat(owner, span_warning("Maybe you should lie down for a bit...")) // Over 91, we gain even more toxloss, brain damage, and have a chance of dropping into a long sleep if(drunk_value >= 91) - owner.adjustToxLoss(1) + owner.adjustToxLoss(1, cause_of_death = "Alcohol poisoning") if(owner.stat == CONSCIOUS && prob(20)) // Don't put us in a deep sleep if the shuttle's here. QoL, mainly. if(SSshuttle.emergency.mode == SHUTTLE_DOCKED && is_station_level(owner.z)) @@ -200,7 +200,7 @@ // And finally, over 100 - let's be honest, you shouldn't be alive by now. if(drunk_value >= 101) - owner.adjustToxLoss(2) + owner.adjustToxLoss(2, cause_of_death = "Alcohol poisoning") /// Status effect for being fully drunk (not tipsy). /atom/movable/screen/alert/status_effect/drunk diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 069ff70a16e6..8aca4996bb23 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -31,6 +31,7 @@ GLOBAL_PROTECT(admin_verbs_admin) // /datum/admins/proc/show_traitor_panel, /*interface which shows a mob's mind*/ -Removed due to rare practical use. Moved to debug verbs ~Errorage /datum/admins/proc/show_lag_switch_panel, /datum/admins/proc/show_player_panel, /*shows an interface for individual players, with various links (links require additional flags*/ + /datum/admins/proc/check_death_info, /*Shows the Time of Death interface for the given player*/ /datum/verbs/menu/Admin/verb/playerpanel, /client/proc/game_panel, /*game panel, allows to change game-mode etc*/ /client/proc/check_ai_laws, /*shows AI and borg laws*/ diff --git a/code/modules/admin/verbs/admingame.dm b/code/modules/admin/verbs/admingame.dm index 6d4a585060f8..37eade9f6d0d 100644 --- a/code/modules/admin/verbs/admingame.dm +++ b/code/modules/admin/verbs/admingame.dm @@ -146,6 +146,18 @@ usr << browse(body, "window=adminplayeropts-[REF(M)];size=550x515") SSblackbox.record_feedback("tally", "admin_verb", 1, "Player Panel") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! +/datum/admins/proc/check_death_info(mob/living/carbon/human/H in GLOB.mob_list) + set category = "Admin.Game" + set name = "Show Death Info" + + if(!check_rights()) + return + + if(!ishuman(H)) + return + + H.show_death_stats(usr) + /client/proc/cmd_admin_godmode(mob/M in GLOB.mob_list) set category = "Admin.Game" set name = "Godmode" diff --git a/code/modules/antagonists/blob/blob_mobs.dm b/code/modules/antagonists/blob/blob_mobs.dm index 7ebd3b52af47..b1e957f2cbbf 100644 --- a/code/modules/antagonists/blob/blob_mobs.dm +++ b/code/modules/antagonists/blob/blob_mobs.dm @@ -196,7 +196,7 @@ if(!key) notify_ghosts("\A [src] has been created in \the [get_area(src)].", source = src, action = NOTIFY_ORBIT, flashwindow = FALSE, header = "Blob Zombie Created") -/mob/living/simple_animal/hostile/blob/blobspore/death(gibbed) +/mob/living/simple_animal/hostile/blob/blobspore/death(gibbed, cause_of_death = "Unknown") // On death, create a small smoke of harmful gas (s-Acid) var/datum/effect_system/fluid_spread/smoke/chem/S = new var/turf/location = get_turf(src) @@ -334,8 +334,8 @@ melee_damage_upper = initial(melee_damage_upper) attack_verb_continuous = initial(attack_verb_continuous) -/mob/living/simple_animal/hostile/blob/blobbernaut/death(gibbed) - ..(gibbed) +/mob/living/simple_animal/hostile/blob/blobbernaut/death(gibbed, cause_of_death = "Unknown") + ..() if(factory) factory.naut = null //remove this naut from its factory factory.max_integrity = initial(factory.max_integrity) diff --git a/code/modules/antagonists/blob/blobstrains/cryogenic_poison.dm b/code/modules/antagonists/blob/blobstrains/cryogenic_poison.dm index b199c0b6c7e8..40434445976b 100644 --- a/code/modules/antagonists/blob/blobstrains/cryogenic_poison.dm +++ b/code/modules/antagonists/blob/blobstrains/cryogenic_poison.dm @@ -28,7 +28,7 @@ /datum/reagent/blob/cryogenic_poison/affect_blood(mob/living/carbon/C, removed) C.adjustBruteLoss(1 * removed, FALSE) C.adjustFireLoss(1 * removed, FALSE) - C.adjustToxLoss(1* removed, FALSE) + C.adjustToxLoss(1* removed, FALSE, cause_of_death = "Cryogenic poison") return TRUE /datum/reagent/blob/cryogenic_poison/affect_touch(mob/living/carbon/C, removed) diff --git a/code/modules/antagonists/blob/blobstrains/regenerative_materia.dm b/code/modules/antagonists/blob/blobstrains/regenerative_materia.dm index ade037803146..efe3ba222865 100644 --- a/code/modules/antagonists/blob/blobstrains/regenerative_materia.dm +++ b/code/modules/antagonists/blob/blobstrains/regenerative_materia.dm @@ -26,7 +26,7 @@ /datum/reagent/blob/regenerative_materia/affect_blood(mob/living/carbon/C, removed) . = ..() - C.adjustToxLoss(1 * removed, FALSE) + C.adjustToxLoss(1 * removed, FALSE, "Regenerative materia") C.hal_screwyhud = SCREWYHUD_HEALTHY //fully healed, honest return TRUE diff --git a/code/modules/antagonists/heretic/mobs/maid_in_mirror.dm b/code/modules/antagonists/heretic/mobs/maid_in_mirror.dm index cea3ba483f1f..b0a90fea5620 100644 --- a/code/modules/antagonists/heretic/mobs/maid_in_mirror.dm +++ b/code/modules/antagonists/heretic/mobs/maid_in_mirror.dm @@ -31,7 +31,7 @@ /// A list of REFs to people who recently examined us var/list/recent_examiner_refs = list() -/mob/living/simple_animal/hostile/heretic_summon/maid_in_the_mirror/death(gibbed) +/mob/living/simple_animal/hostile/heretic_summon/maid_in_the_mirror/death(gibbed, cause_of_death = "Unknown") var/turf/death_turf = get_turf(src) death_turf.TakeTemperature(-40) return ..() diff --git a/code/modules/antagonists/morph/morph.dm b/code/modules/antagonists/morph/morph.dm index 52ca8e90571a..05c7fce73dae 100644 --- a/code/modules/antagonists/morph/morph.dm +++ b/code/modules/antagonists/morph/morph.dm @@ -138,7 +138,7 @@ update_med_hud() -/mob/living/simple_animal/hostile/morph/death(gibbed) +/mob/living/simple_animal/hostile/morph/death(gibbed, cause_of_death = "Unknown") if(morphed) visible_message(span_warning("[src] twists and dissolves into a pile of green flesh!"), \ span_userdanger("Your skin ruptures! Your flesh breaks apart! No disguise can ward off de--")) diff --git a/code/modules/antagonists/revenant/revenant.dm b/code/modules/antagonists/revenant/revenant.dm index 755fa7e5c8e0..67d29701a406 100644 --- a/code/modules/antagonists/revenant/revenant.dm +++ b/code/modules/antagonists/revenant/revenant.dm @@ -235,7 +235,7 @@ /mob/living/simple_animal/revenant/gib() death() -/mob/living/simple_animal/revenant/death() +/mob/living/simple_animal/revenant/death(gibbed, cause_of_death = "Unknown") if(!revealed || stasis) //Revenants cannot die if they aren't revealed //or are already dead return stasis = TRUE diff --git a/code/modules/antagonists/revenant/revenant_abilities.dm b/code/modules/antagonists/revenant/revenant_abilities.dm index 7d5818ba8b74..b380f31df25f 100644 --- a/code/modules/antagonists/revenant/revenant_abilities.dm +++ b/code/modules/antagonists/revenant/revenant_abilities.dm @@ -383,7 +383,7 @@ if(mob.reagents) mob.reagents.add_reagent(/datum/reagent/toxin/plasma, 5) else - mob.adjustToxLoss(5) + mob.adjustToxLoss(5, cause_of_death = "Blight") for(var/obj/structure/spacevine/vine in victim) //Fucking with botanists, the ability. vine.add_atom_colour("#823abb", TEMPORARY_COLOUR_PRIORITY) new /obj/effect/temp_visual/revenant(vine.loc) diff --git a/code/modules/antagonists/revenant/revenant_blight.dm b/code/modules/antagonists/revenant/revenant_blight.dm index ac5afb4735d4..a8f50d4b3dc7 100644 --- a/code/modules/antagonists/revenant/revenant_blight.dm +++ b/code/modules/antagonists/revenant/revenant_blight.dm @@ -40,7 +40,7 @@ new /obj/effect/temp_visual/revenant(affected_mob.loc) if(stagedamage < stage) stagedamage++ - affected_mob.adjustToxLoss(1 * stage * delta_time, FALSE) //should, normally, do about 30 toxin damage. + affected_mob.adjustToxLoss(1 * stage * delta_time, FALSE, cause_of_death = "Wasted away") //should, normally, do about 30 toxin damage. new /obj/effect/temp_visual/revenant(affected_mob.loc) if(DT_PROB(25, delta_time)) affected_mob.stamina.adjust(-stage) diff --git a/code/modules/awaymissions/mission_code/snowdin.dm b/code/modules/awaymissions/mission_code/snowdin.dm index ae2fb74064e0..556bc2e6afef 100644 --- a/code/modules/awaymissions/mission_code/snowdin.dm +++ b/code/modules/awaymissions/mission_code/snowdin.dm @@ -198,7 +198,7 @@ if(!IS_ORGANIC_LIMB(burn_limb)) robo_parts += burn_limb - burn_human.adjustToxLoss(15) + burn_human.adjustToxLoss(15, cause_of_death = "Liquid plasma") burn_human.adjustFireLoss(25) if(plasma_parts.len) var/obj/item/bodypart/burn_limb = pick(plasma_parts) //using the above-mentioned list to get a choice of limbs diff --git a/code/modules/cargo/gondolapod.dm b/code/modules/cargo/gondolapod.dm index 17fa49193d82..4cd641d636b0 100644 --- a/code/modules/cargo/gondolapod.dm +++ b/code/modules/cargo/gondolapod.dm @@ -75,7 +75,7 @@ opened = FALSE update_appearance() -/mob/living/simple_animal/pet/gondola/gondolapod/death() +/mob/living/simple_animal/pet/gondola/gondolapod/death(gibbed, cause_of_death = "Unknown") QDEL_NULL(linked_pod) //Will cause the open() proc for the linked supplypod to be called with the "broken" parameter set to true, meaning that it will dump its contents on death qdel(src) ..() diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index a29b70c072b8..0d3cc582c5f0 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -132,11 +132,11 @@ return if(prob(TOXICITY_MUTATION_PROB) && istype(crosser) && !isvineimmune(crosser)) to_chat(crosser, span_alert("You accidentally touch the vine and feel a strange sensation.")) - crosser.adjustToxLoss(20) + crosser.adjustToxLoss(20, cause_of_death = "Spacevine toxin") /datum/spacevine_mutation/toxicity/on_eat(obj/structure/spacevine/holder, mob/living/eater) if(!isvineimmune(eater)) - eater.adjustToxLoss(20) + eater.adjustToxLoss(20, cause_of_death = "Spacevine toxin") /datum/spacevine_mutation/explosive // JC IT'S A BOMB name = "Explosive" diff --git a/code/modules/mob/living/basic/basic.dm b/code/modules/mob/living/basic/basic.dm index 1b43b32bec17..1870ab59f700 100644 --- a/code/modules/mob/living/basic/basic.dm +++ b/code/modules/mob/living/basic/basic.dm @@ -99,7 +99,7 @@ verb_say = pick(speak_emote) return ..() -/mob/living/basic/death(gibbed) +/mob/living/basic/death(gibbed, cause_of_death = "Unknown") . = ..() if(basic_mob_flags & DEL_ON_DEATH) qdel(src) diff --git a/code/modules/mob/living/basic/basic_defense.dm b/code/modules/mob/living/basic/basic_defense.dm index 2cb5d51429de..0b16fe7d5325 100644 --- a/code/modules/mob/living/basic/basic_defense.dm +++ b/code/modules/mob/living/basic/basic_defense.dm @@ -177,13 +177,13 @@ ..() -/mob/living/basic/update_stat() +/mob/living/basic/update_stat(cause_of_death) if(status_flags & GODMODE) return if(stat != DEAD) if(health <= 0) - death() + death(cause_of_death = cause_of_death) else set_stat(CONSCIOUS) diff --git a/code/modules/mob/living/basic/health_adjustment.dm b/code/modules/mob/living/basic/health_adjustment.dm index beaece806cdf..3b86673458a3 100644 --- a/code/modules/mob/living/basic/health_adjustment.dm +++ b/code/modules/mob/living/basic/health_adjustment.dm @@ -36,7 +36,7 @@ else if(damage_coeff[OXY]) . = adjust_health(amount * damage_coeff[OXY] * CONFIG_GET(number/damage_multiplier), updating_health, forced) -/mob/living/basic/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/basic/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, cause_of_death = "Systemic organ failure") if(forced) . = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) else if(damage_coeff[TOX]) diff --git a/code/modules/mob/living/basic/vermin/cockroach.dm b/code/modules/mob/living/basic/vermin/cockroach.dm index 3ba46312b6ba..a8fdc6139e89 100644 --- a/code/modules/mob/living/basic/vermin/cockroach.dm +++ b/code/modules/mob/living/basic/vermin/cockroach.dm @@ -36,7 +36,7 @@ AddComponent(/datum/component/squashable, squash_chance = 50, squash_damage = 1) ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) -/mob/living/basic/cockroach/death(gibbed) +/mob/living/basic/cockroach/death(gibbed, cause_of_death = "Unknown") if(GLOB.station_was_nuked) //If the nuke is going off, then cockroaches are invincible. Keeps the nuke from killing them, cause cockroaches are immune to nukes. return ..() diff --git a/code/modules/mob/living/brain/brain_item.dm b/code/modules/mob/living/brain/brain_item.dm index 0bd70add5690..bc6e27d8a4ff 100644 --- a/code/modules/mob/living/brain/brain_item.dm +++ b/code/modules/mob/living/brain/brain_item.dm @@ -274,20 +274,20 @@ switch(blood_percent) if(BLOOD_CIRC_SAFE to INFINITY) if(can_heal) - . |= applyOrganDamage(-1, updating_health = FALSE) + applyOrganDamage(-1) if(BLOOD_CIRC_OKAY to BLOOD_CIRC_SAFE) if(owner.stat == CONSCIOUS && prob(1)) to_chat(owner, span_warning("You feel [pick("dizzy","woozy","faint")]...")) damprob = CHEM_EFFECT_MAGNITUDE(owner, CE_STABLE) ? 30 : 60 if(!past_damage_threshold(2) && prob(damprob)) - . |= applyOrganDamage(BRAIN_DECAY_RATE, updating_health = FALSE) + applyOrganDamage(BRAIN_DECAY_RATE, cause_of_death = "Hypoxemia") if(BLOOD_CIRC_BAD to BLOOD_CIRC_OKAY) owner.blur_eyes(6) damprob = CHEM_EFFECT_MAGNITUDE(owner, CE_STABLE) ? 40 : 80 if(!past_damage_threshold(4) && prob(damprob)) - . |= applyOrganDamage(BRAIN_DECAY_RATE, updating_health = FALSE) + applyOrganDamage(BRAIN_DECAY_RATE, cause_of_death = "Hypoxemia") if(owner.stat == CONSCIOUS && prob(10)) log_health(owner, "Passed out due to poor blood oxygenation, random chance.") @@ -298,7 +298,7 @@ owner.blur_eyes(6) damprob = CHEM_EFFECT_MAGNITUDE(owner, CE_STABLE) ? 60 : 100 if(!past_damage_threshold(6) && prob(damprob)) - . |= applyOrganDamage(BRAIN_DECAY_RATE, updating_health = FALSE) + applyOrganDamage(BRAIN_DECAY_RATE, updating_health = FALSE, cause_of_death = "Hypoxemia") if(owner.stat == CONSCIOUS && prob(15)) log_health(owner, "Passed out due to poor blood oxygenation, random chance.") @@ -309,9 +309,9 @@ owner.blur_eyes(6) damprob = CHEM_EFFECT_MAGNITUDE(owner, CE_STABLE) ? 80 : 100 if(prob(damprob)) - . |= applyOrganDamage(BRAIN_DECAY_RATE, updating_health = FALSE) + applyOrganDamage(BRAIN_DECAY_RATE, updating_health = FALSE, cause_of_death = "Hypoxemia") if(prob(damprob)) - . |= applyOrganDamage(BRAIN_DECAY_RATE, updating_health = FALSE) + applyOrganDamage(BRAIN_DECAY_RATE, updating_health = FALSE, cause_of_death = "Hypoxemia") . = ..() /obj/item/organ/brain/check_damage_thresholds(mob/M) @@ -373,7 +373,7 @@ to_chat(owner, span_danger("You black out!")) owner.Unconscious(5 SECOND) -/obj/item/organ/brain/applyOrganDamage(damage_amount, maximum, silent, updating_health = TRUE) +/obj/item/organ/brain/applyOrganDamage(damage_amount, maximum, silent, updating_health = TRUE, cause_of_death = "Organ failure") . = ..() if(. >= 20) //This probably won't be triggered by oxyloss or mercury. Probably. var/damage_secondary = min(. * 0.2, 20) @@ -386,15 +386,15 @@ /obj/item/organ/brain/getToxLoss() return 0 -/obj/item/organ/brain/set_organ_dead(failing) +/obj/item/organ/brain/set_organ_dead(failing, cause_of_death) . = ..() if(!.) return if(failing) if(owner) - owner.death() + owner.death(cause_of_death = cause_of_death) else if(brainmob) - brainmob.death() + brainmob.death(cause_of_death = cause_of_death) return else if(owner) @@ -602,7 +602,7 @@ /obj/item/organ/brain/get_scan_results(tag) . = ..() - var/list/traumas = owner.get_traumas() + var/list/traumas = owner?.get_traumas() if(!length(traumas)) return diff --git a/code/modules/mob/living/brain/death.dm b/code/modules/mob/living/brain/death.dm index 8166e9f84460..35f0ee0e8a06 100644 --- a/code/modules/mob/living/brain/death.dm +++ b/code/modules/mob/living/brain/death.dm @@ -1,4 +1,4 @@ -/mob/living/brain/death(gibbed) +/mob/living/brain/death(gibbed, cause_of_death = "Unknown") if(stat == DEAD) return set_stat(DEAD) diff --git a/code/modules/mob/living/brain/life.dm b/code/modules/mob/living/brain/life.dm index bc463dfc4fe5..75318103eb6e 100644 --- a/code/modules/mob/living/brain/life.dm +++ b/code/modules/mob/living/brain/life.dm @@ -7,13 +7,13 @@ . = ..() handle_emp_damage(delta_time, times_fired) -/mob/living/brain/update_stat() +/mob/living/brain/update_stat(cause_of_death) if(status_flags & GODMODE) return if(health > HEALTH_THRESHOLD_DEAD) return if(stat != DEAD) - death() + death(cause_of_death = cause_of_death) var/obj/item/organ/brain/BR if(container?.brain) BR = container.brain diff --git a/code/modules/mob/living/carbon/alien/damage_procs.dm b/code/modules/mob/living/carbon/alien/damage_procs.dm index 23c5c392da5f..13795f738c37 100644 --- a/code/modules/mob/living/carbon/alien/damage_procs.dm +++ b/code/modules/mob/living/carbon/alien/damage_procs.dm @@ -3,7 +3,7 @@ return FALSE ///alien immune to tox damage -/mob/living/carbon/alien/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/carbon/alien/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, cause_of_death = "Systemic organ failure") return FALSE ///aliens are immune to stamina damage. diff --git a/code/modules/mob/living/carbon/alien/humanoid/death.dm b/code/modules/mob/living/carbon/alien/humanoid/death.dm index a70600b81ef9..760c402489f4 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/death.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/death.dm @@ -1,4 +1,4 @@ -/mob/living/carbon/alien/humanoid/death(gibbed) +/mob/living/carbon/alien/humanoid/death(gibbed, cause_of_death = "Unknown") if(stat == DEAD) return @@ -8,7 +8,7 @@ status_flags |= CANPUSH //When the alien queen dies, all others must pay the price for letting her die. -/mob/living/carbon/alien/humanoid/royal/queen/death(gibbed) +/mob/living/carbon/alien/humanoid/royal/queen/death(gibbed, cause_of_death = "Unknown") if(stat == DEAD) return diff --git a/code/modules/mob/living/carbon/alien/larva/death.dm b/code/modules/mob/living/carbon/alien/larva/death.dm index 8fd6329a0c1d..733ee5853125 100644 --- a/code/modules/mob/living/carbon/alien/larva/death.dm +++ b/code/modules/mob/living/carbon/alien/larva/death.dm @@ -1,4 +1,4 @@ -/mob/living/carbon/alien/larva/death(gibbed) +/mob/living/carbon/alien/larva/death(gibbed, cause_of_death = "Unknown") if(stat == DEAD) return diff --git a/code/modules/mob/living/carbon/alien/larva/life.dm b/code/modules/mob/living/carbon/alien/larva/life.dm index ef5a4ad51f0b..d5847e70681c 100644 --- a/code/modules/mob/living/carbon/alien/larva/life.dm +++ b/code/modules/mob/living/carbon/alien/larva/life.dm @@ -10,12 +10,12 @@ update_icons() -/mob/living/carbon/alien/larva/update_stat() +/mob/living/carbon/alien/larva/update_stat(cause_of_death) if(status_flags & GODMODE) return if(stat != DEAD) if(health<= -maxHealth || !getorgan(/obj/item/organ/brain)) - death() + death(cause_of_death = cause_of_death) return if((HAS_TRAIT(src, TRAIT_KNOCKEDOUT))) set_stat(UNCONSCIOUS) diff --git a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm index 44ce67bbcd1a..dbd0f8f0bd6e 100644 --- a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm +++ b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm @@ -49,10 +49,10 @@ if(DT_PROB(2, delta_time)) to_chat(owner, span_danger("Your stomach hurts.")) if(prob(20)) - owner.adjustToxLoss(1) + owner.adjustToxLoss(1, cause_of_death = "Alien embryo") if(6) to_chat(owner, span_danger("You feel something tearing its way out of your chest...")) - owner.adjustToxLoss(5 * delta_time) // Why is this [TOX]? + owner.adjustToxLoss(5 * delta_time, cause_of_death = "Alien embryo") // Why is this [TOX]? /// Controls Xenomorph Embryo growth. If embryo is fully grown (or overgrown), stop the proc. If not, increase the stage by one and if it's not fully grown (stage 6), add a timer to do this proc again after however long the growth time variable is. /obj/item/organ/body_egg/alien_embryo/proc/advance_embryo_stage() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 09513330614c..5d13263f00c4 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -500,14 +500,14 @@ //Updates the mob's health from bodyparts and mob damage variables -/mob/living/carbon/updatehealth() +/mob/living/carbon/updatehealth(cause_of_death) if(status_flags & GODMODE) return set_health(round(maxHealth - getBrainLoss(), DAMAGE_PRECISION)) update_damage_hud() update_health_hud() - update_stat() + update_stat(cause_of_death) SEND_SIGNAL(src, COMSIG_CARBON_HEALTH_UPDATE) /mob/living/carbon/on_stamina_update() @@ -772,7 +772,7 @@ REMOVE_TRAIT(src, TRAIT_SIXTHSENSE, "near-death") -/mob/living/carbon/update_stat() +/mob/living/carbon/update_stat(cause_of_death) if(status_flags & GODMODE) return diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm index bd1166e92fe2..6858be35e3b0 100644 --- a/code/modules/mob/living/carbon/damage_procs.dm +++ b/code/modules/mob/living/carbon/damage_procs.dm @@ -76,7 +76,7 @@ heal_overall_damage(0, abs(amount), required_status ? required_status : BODYTYPE_ORGANIC, updating_health) return amount -/mob/living/carbon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/carbon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, cause_of_death = "Systemic organ failure") if(!amount) return var/heal = amount < 0 @@ -120,10 +120,7 @@ else if(amount <= 0) break - amount -= O.applyOrganDamage(amount, silent = TRUE, updating_health = FALSE) - - if(updating_health) - updatehealth() + amount -= O.applyOrganDamage(amount, silent = TRUE, cause_of_death = cause_of_death) /mob/living/carbon/getToxLoss() for(var/obj/item/organ/O as anything in processing_organs) diff --git a/code/modules/mob/living/carbon/death.dm b/code/modules/mob/living/carbon/death.dm index 521c1cb0091b..31ef0e7226d5 100644 --- a/code/modules/mob/living/carbon/death.dm +++ b/code/modules/mob/living/carbon/death.dm @@ -1,4 +1,4 @@ -/mob/living/carbon/death(gibbed) +/mob/living/carbon/death(gibbed, cause_of_death = "Unknown") if(stat == DEAD) return diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index 2c75a1848720..53190de671e1 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -21,7 +21,7 @@ GLOBAL_LIST_EMPTY(dead_players_during_shift) else new /obj/effect/decal/remains/human(loc) -/mob/living/carbon/human/death(gibbed) +/mob/living/carbon/human/death(gibbed, cause_of_death = "Unknown") if(stat == DEAD) return @@ -49,8 +49,6 @@ GLOBAL_LIST_EMPTY(dead_players_during_shift) SSblackbox.ReportDeath(src) log_message("has died (BRUTE: [src.getBruteLoss()], BURN: [src.getFireLoss()], TOX: [src.getToxLoss()], OXY: [src.getOxyLoss()], CLONE: [src.getCloneLoss()])", LOG_ATTACK) - to_chat(src, span_warning("You have died. Barring complete bodyloss, you can in most cases be revived by other players. If you do not wish to be brought back, use the \"Do Not Resuscitate\" verb in the ghost tab.")) - for(var/mob/living/L in viewers(src, world.view) - src) if(L.is_blind() || L.stat != CONSCIOUS || !L.client) continue @@ -77,3 +75,349 @@ GLOBAL_LIST_EMPTY(dead_players_during_shift) ADD_TRAIT(src, TRAIT_BADDNA, MADE_UNCLONEABLE) setBloodVolume(0) return TRUE + + +/mob/living/carbon/human/proc/show_death_stats(mob/user) + var/list/scan = time_of_death_stats + var/list/ui_content = list() + + var/datum/browser/popup = new(user, "timeofdeathinfo", "Time of Death Information", 600, 800) + + ui_content += {" +
+ "} + + ui_content += {" + + + + + + + + + + "} + + var/brain_activity = scan["brain_activity"] + switch(brain_activity) + if(0) + brain_activity = span_bad("None, patient is braindead") + if(-1) + brain_activity = span_bad("Patient is missing a brain") + if(100) + brain_activity = span_good("[brain_activity]%") + else + brain_activity = span_mild("[brain_activity]%") + + ui_content += {" + + + + + "} + var/pulse_string + if(scan["pulse"] == -1) + pulse_string = "[span_average("N/A")]" + else if(scan["pulse"] == -2) + pulse_string = "N/A" + else if(scan["pulse"] == -3) + pulse_string = "[span_bad("250+bpm")]" + else if(scan["pulse"] == 0) + pulse_string = "[span_bad("[scan["pulse"]]bpm")]" + else if(scan["pulse"] >= 140) + pulse_string = "[span_bad("[scan["pulse"]]bpm")]" + else if(scan["pulse"] >= 120) + pulse_string = "[span_average("[scan["pulse"]]bpm")]" + else + pulse_string = "[scan["pulse"]]bpm" + + ui_content += {" + + + + + "} + var/pressure_string + var/ratio = scan["blood_volume"]/scan["blood_volume_max"] + if(scan["blood_o2"] <= 70) + pressure_string = "([span_bad("[scan["blood_o2"]]% blood oxygenation")])" + else if(scan["blood_o2"] <= 85) + pressure_string = "([span_average("[scan["blood_o2"]]% blood oxygenation")])" + else if(scan["blood_o2"] <= 90) + pressure_string = "(["[scan["blood_o2"]]% blood oxygenation"])" + else + pressure_string = "([scan["blood_o2"]]% blood oxygenation)" + + ui_content += {" + + + + + "} + if(ratio <= 0.7) + ui_content += {" + + + + "} + + ui_content += {" + + + + + "} + + ui_content += {" + + + + + "} + + ui_content += {" + + + + + "} + + ui_content += {" + + + + + "} + + ui_content += {" + + + + + "} + + ui_content += {" + + + + + "} + + ui_content += {" + + + + + "} + + ui_content += {" + + + + + "} + + if(scan["dna_ruined"]) + ui_content += {" + + + + + "} + + if(scan["husked"]) + ui_content += {" + + + + + "} + if(scan["radiation"]) + ui_content += {" + + + + + "} + + if(scan["genetic_instability"]) + ui_content += {" + + + + + "} + + + if(length(scan["reagents"])) + ui_content += {" + + + + + + + + "} + else + ui_content += {" + + + + "} + + ui_content += {" + + " + ui_content += "
+ Scan Results For: + + [scan["name"]] +
+ Scan Performed At: + + [scan["time"]] +
+ Brain Activity: + + [brain_activity] +
+ Pulse Rate: + + [pulse_string] +
+ Blood Pressure: + + [pressure_string] +
+ [span_bad("Patient is in hypovolemic shock. Transfusion highly recommended.")] +
+ Blood Volume: + + [scan["blood_volume"]]u/[scan["blood_volume_max"]]u ([scan["blood_type"]]) +
+ Body Temperature: + + [scan["temperature"]-T0C]°C ([FAHRENHEIT(scan["temperature"])]°F) +
+ DNA: + + [scan["dna"]] +
+ Physical Trauma: + + [get_damage_severity(scan["brute"],TRUE)] +
+ Burn Severity: + + [get_damage_severity(scan["burn"],TRUE)] +
+ Systematic Organ Failure: + + [get_damage_severity(scan["toxin"],TRUE)] +
+ Oxygen Deprivation: + + [get_damage_severity(scan["oxygen"],TRUE)] +
+ Genetic Damage: + + [get_damage_severity(scan["genetic"],TRUE)] +
+ [span_bad("ERROR: patient's DNA sequence is unreadable.")] +
+ [span_bad("Husked cadaver detected: Replacement tissue required.")] +
+ Irradiated +
+ [span_bad("Genetic instability detected.")] +
+ Reagents detected in patient's bloodstream: +
+ "} + for(var/list/R as anything in scan["reagents"]) + if(R["visible"]) + ui_content += {" +
+ ["[R["quantity"]]u [R["name"]][R["overdosed"] ? " OVERDOSED" : ""]"] +
+ [span_average("Unknown Reagent")] +
+
+ + + + + + + + + + "} + + for(var/list/limb as anything in scan["bodyparts"]) + ui_content += {" + + + "} + + if(limb["is_stump"]) + ui_content += {" + + + "} + else + ui_content += "" + + else + if(limb["brute_dam"]) + ui_content += {" + [capitalize(get_wound_severity(limb["brute_ratio"]))] physical trauma
+ "} + if(limb["burn_dam"]) + ui_content += {" + [capitalize(get_wound_severity(limb["burn_ratio"]))] burns + "} + + ui_content += "" + + ui_content += {" + + "} + + ui_content += "" + + ui_content += "" + for(var/list/organ as anything in scan["organs"]) + ui_content += "" + + if(organ["damage_percent"]) + ui_content += "" + else + ui_content += "" + + ui_content += {" + + + "} + + if(scan["nearsight"]) + ui_content += "" + + ui_content += "
Body Status
OrganDamageStatus
[limb["name"]] + + Missing + + [english_list(limb["scan_results"], nothing_text = " ")] + " + if(!(limb["brute_dam"] || limb["burn_dam"])) + ui_content += "None + [english_list(limb["scan_results"], nothing_text = " ")] +
Internal Organs
[organ["name"]][get_damage_severity(organ["damage_percent"], TRUE)]None + [span_bad("[english_list(organ["scan_results"], nothing_text=" ")]")] +
[span_average( "Retinal misalignment detected.")]
" + + + popup.set_content(jointext(ui_content, "")) + popup.open(user) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index b7e8c120b371..56713e0d682c 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -106,6 +106,13 @@ to_chat(usr, span_warning("You can't reach that! Something is covering it.")) return + if(href_list["show_death_stats"]) + if(stat != DEAD || !(usr == src || usr.mind?.current != src)) + return + + show_death_stats(usr) + return + ///////HUDs/////// if(href_list["hud"]) if(!ishuman(usr)) @@ -966,7 +973,7 @@ return ..() -/mob/living/carbon/human/updatehealth() +/mob/living/carbon/human/updatehealth(cause_of_death) . = ..() dna?.species.spec_updatehealth(src) diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index f008afe5c192..30630536fd27 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -101,3 +101,5 @@ ///A lazylist of preference-applied appearance mods present on this human. Type:Instance var/list/appearance_mods + + var/list/time_of_death_stats diff --git a/code/modules/mob/living/carbon/human/monkey/monkey.dm b/code/modules/mob/living/carbon/human/monkey/monkey.dm index efca2c6c6a7a..470951905bd9 100644 --- a/code/modules/mob/living/carbon/human/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/human/monkey/monkey.dm @@ -76,7 +76,7 @@ memory_saved = TRUE ..() -/mob/living/carbon/human/species/monkey/punpun/death(gibbed) +/mob/living/carbon/human/species/monkey/punpun/death(gibbed, cause_of_death = "Unknown") if(!memory_saved) Write_Memory(TRUE, gibbed) ..() diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 6a61af1dcc06..751285a3a0b5 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -234,7 +234,7 @@ //PLASMA if(Plasma_partialpressure > safe_plas_max) var/ratio = breath.gas[GAS_PLASMA]/safe_plas_max * 10 - adjustToxLoss(clamp(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE)) + adjustToxLoss(clamp(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE), cause_of_death ="Plasma poisoning") throw_alert(ALERT_TOO_MUCH_PLASMA, /atom/movable/screen/alert/too_much_plas) else clear_alert(ALERT_TOO_MUCH_PLASMA) @@ -596,7 +596,7 @@ All effects don't start immediately, but rather get worse over time; the rate is if(HAS_TRAIT(src, TRAIT_STABLELIVER) || !needs_organ(ORGAN_SLOT_LIVER)) return - adjustToxLoss(0.6 * delta_time, TRUE, TRUE) + adjustToxLoss(0.6 * delta_time, TRUE, TRUE, cause_of_death = "Lack of a liver") if(DT_PROB(2, delta_time)) vomit(50, TRUE, FALSE, 1, TRUE, harm = FALSE, purge_ratio = 1) diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index 2474c9d02785..63cbeb95c61f 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -198,12 +198,12 @@ /mob/living/proc/getToxLoss() return toxloss -/mob/living/proc/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/proc/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, cause_of_death = "Systemic organ failure") if(!forced && (status_flags & GODMODE)) return FALSE toxloss = clamp((toxloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth) if(updating_health) - updatehealth() + updatehealth(cause_of_death = cause_of_death) return amount /mob/living/proc/setToxLoss(amount, updating_health = TRUE, forced = FALSE) diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index 1d3ce451e6d7..227cfa0934f5 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -67,14 +67,33 @@ * * Arguments: * * gibbed - Was the mob gibbed? + * * cod (cause of death) - A string that plainly describes how the mob died. */ -/mob/living/proc/death(gibbed) +/mob/living/proc/death(gibbed, cause_of_death = "Unknown") set_stat(DEAD) unset_machine() timeofdeath = world.time tod = stationtime2text() + + // tgchat displays doc strings with formatting, so we do stupid shit instead + var/list/death_message = list( + "
[span_statsbad("You Died")]
", + "
[span_statsbad("Cause of Death: [cause_of_death]")]
", + "
", + span_obviousnotice("Your story may not be over yet. You are able to be resuscitated as long as your brain was not destroyed, and you have not been dead for 10 minutes."), + ) + + if(ishuman(src)) + death_message.Insert(3, "
[button_element(src, "Click here to see stats", "show_death_stats=1")]
") + var/mob/living/carbon/human/H = src + H.time_of_death_stats = H.get_bodyscanner_data() + + death_message = examine_block(jointext(death_message, "")) + to_chat(src, death_message) + var/turf/T = get_turf(src) + if(mind && mind.name && mind.active && !istype(T.loc, /area/centcom/ctf)) deadchat_broadcast(" has died at [get_area_name(T)].", "[mind.name]", follow_target = src, turf_target = T, message_type=DEADCHAT_DEATHRATTLE) if(SSlag_switch.measures[DISABLE_DEAD_KEYLOOP] && !client?.holder) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index aef0337cd93a..4592ec2ef93c 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -601,14 +601,14 @@ health = new_value -/mob/living/proc/updatehealth() +/mob/living/proc/updatehealth(cause_of_death) if(status_flags & GODMODE) return set_health(maxHealth - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss()) med_hud_set_health() update_health_hud() - update_stat() + update_stat(cause_of_death) /mob/living/update_health_hud() var/severity = 0 diff --git a/code/modules/mob/living/silicon/ai/death.dm b/code/modules/mob/living/silicon/ai/death.dm index 0af8aec836a4..172ab7faa158 100644 --- a/code/modules/mob/living/silicon/ai/death.dm +++ b/code/modules/mob/living/silicon/ai/death.dm @@ -1,4 +1,4 @@ -/mob/living/silicon/ai/death(gibbed) +/mob/living/silicon/ai/death(gibbed, cause_of_death = "Unknown") if(stat == DEAD) return diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 9962baa674ba..3b780a0cbfc2 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -53,20 +53,20 @@ if(POWER_REQ_ALL) return !T || !A || ((!A.power_equip || isspaceturf(T)) && !is_type_in_list(loc, list(/obj/item, /obj/vehicle/sealed/mecha))) -/mob/living/silicon/ai/updatehealth() +/mob/living/silicon/ai/updatehealth(cause_of_death) if(status_flags & GODMODE) return set_health(maxHealth - getOxyLoss() - getToxLoss() - getBruteLoss() - getFireLoss()) - update_stat() + update_stat(cause_of_death) diag_hud_set_health() disconnect_shell() -/mob/living/silicon/ai/update_stat() +/mob/living/silicon/ai/update_stat(cause_of_death) if(status_flags & GODMODE) return if(stat != DEAD) if(health <= HEALTH_THRESHOLD_DEAD) - death() + death(cause_of_death = cause_of_death) return else if(stat >= UNCONSCIOUS) set_stat(CONSCIOUS) diff --git a/code/modules/mob/living/silicon/damage_procs.dm b/code/modules/mob/living/silicon/damage_procs.dm index 2c21599710df..af6afaea7929 100644 --- a/code/modules/mob/living/silicon/damage_procs.dm +++ b/code/modules/mob/living/silicon/damage_procs.dm @@ -15,7 +15,7 @@ /mob/living/silicon/apply_effect(effect = 0,effecttype = EFFECT_STUN, blocked = FALSE) return FALSE //The only effect that can hit them atm is flashes and they still directly edit so this works for now. (This was written in at least 2016. Help) -/mob/living/silicon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) //immune to tox damage +/mob/living/silicon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, cause_of_death = "Systemic organ failure") //immune to tox damage return FALSE /mob/living/silicon/setToxLoss(amount, updating_health = TRUE, forced = FALSE) diff --git a/code/modules/mob/living/silicon/death.dm b/code/modules/mob/living/silicon/death.dm index 413016519f88..1c3b63e932fd 100644 --- a/code/modules/mob/living/silicon/death.dm +++ b/code/modules/mob/living/silicon/death.dm @@ -4,7 +4,7 @@ /mob/living/silicon/spawn_dust() new /obj/effect/decal/remains/robot(loc) -/mob/living/silicon/death(gibbed) +/mob/living/silicon/death(gibbed, cause_of_death = "Unknown") if(!gibbed) emote("deathgasp") diag_hud_set_status() diff --git a/code/modules/mob/living/silicon/pai/death.dm b/code/modules/mob/living/silicon/pai/death.dm index c1307ce346dc..ad1f5f46c6b4 100644 --- a/code/modules/mob/living/silicon/pai/death.dm +++ b/code/modules/mob/living/silicon/pai/death.dm @@ -1,4 +1,4 @@ -/mob/living/silicon/pai/death(gibbed) +/mob/living/silicon/pai/death(gibbed, cause_of_death = "Unknown") if(stat == DEAD) return set_stat(DEAD) diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 7d1ed88727dd..0b0bf95344fb 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -240,11 +240,11 @@ . = ..() . += "A personal AI in holochassis mode. Its master ID string seems to be [master]." -/mob/living/silicon/pai/updatehealth() +/mob/living/silicon/pai/updatehealth(cause_of_death) if(status_flags & GODMODE) return set_health(maxHealth - getBruteLoss() - getFireLoss()) - update_stat() + update_stat(cause_of_death) /mob/living/silicon/pai/process(delta_time) emitterhealth = clamp((emitterhealth + (emitter_regen_per_second * delta_time)), -50, emittermaxhealth) diff --git a/code/modules/mob/living/silicon/robot/death.dm b/code/modules/mob/living/silicon/robot/death.dm index 626382f6bc89..e41cb02dda80 100644 --- a/code/modules/mob/living/silicon/robot/death.dm +++ b/code/modules/mob/living/silicon/robot/death.dm @@ -13,7 +13,7 @@ /mob/living/silicon/robot/dust_animation() new /obj/effect/temp_visual/dust_animation(loc, "dust-r") -/mob/living/silicon/robot/death(gibbed) +/mob/living/silicon/robot/death(gibbed, cause_of_death = "Unknown") if(stat == DEAD) return if(!gibbed) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index ab77be2b9576..7bbb08583ee9 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -572,7 +572,7 @@ return FALSE return ..() -/mob/living/silicon/robot/updatehealth() +/mob/living/silicon/robot/updatehealth(cause_of_death) ..() if(!model.breakable_modules) return @@ -654,12 +654,12 @@ sync_lighting_plane_alpha() -/mob/living/silicon/robot/update_stat() +/mob/living/silicon/robot/update_stat(cause_of_death) if(status_flags & GODMODE) return if(stat != DEAD) if(health <= -maxHealth) //die only once - death() + death(cause_of_death = cause_of_death) toggle_headlamp(1) return if(HAS_TRAIT(src, TRAIT_KNOCKEDOUT) || IsStun() || IsKnockdown() || IsParalyzed()) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 216160440eee..d5b26bbe718a 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -231,7 +231,7 @@ /mob/living/simple_animal/bot/bee_friendly() return TRUE -/mob/living/simple_animal/bot/death(gibbed) +/mob/living/simple_animal/bot/death(gibbed, cause_of_death = "Unknown") explode() return ..() @@ -288,7 +288,7 @@ new /obj/effect/decal/cleanable/oil(loc) return ..() -/mob/living/simple_animal/bot/updatehealth() +/mob/living/simple_animal/bot/updatehealth(cause_of_death) ..() diag_hud_set_bothealth() diff --git a/code/modules/mob/living/simple_animal/damage_procs.dm b/code/modules/mob/living/simple_animal/damage_procs.dm index 9118d8ab8b26..243a35dce3ce 100644 --- a/code/modules/mob/living/simple_animal/damage_procs.dm +++ b/code/modules/mob/living/simple_animal/damage_procs.dm @@ -36,7 +36,7 @@ else if(damage_coeff[OXY]) . = adjustHealth(amount * damage_coeff[OXY] * CONFIG_GET(number/damage_multiplier), updating_health, forced) -/mob/living/simple_animal/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, cause_of_death = "Systemic organ failure") if(forced) . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) else if(damage_coeff[TOX]) diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index c90f0ac29c5d..a0b8212c627b 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -130,7 +130,7 @@ children += baby return baby -/mob/living/simple_animal/pet/cat/runtime/death() +/mob/living/simple_animal/pet/cat/runtime/death(gibbed, cause_of_death = "Unknown") if(!memory_saved) Write_Memory(TRUE) ..() diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 893a6d5b4762..30cf77344898 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -176,7 +176,7 @@ var/newcolor = rgb(rand(0, 255), rand(0, 255), rand(0, 255)) add_atom_colour(newcolor, FIXED_COLOUR_PRIORITY) -/mob/living/simple_animal/pet/dog/corgi/death(gibbed) +/mob/living/simple_animal/pet/dog/corgi/death(gibbed, cause_of_death = "Unknown") ..(gibbed) regenerate_icons() @@ -487,7 +487,7 @@ GLOBAL_LIST_INIT(strippable_corgi_items, create_strippable_list(list( memory_saved = TRUE ..() -/mob/living/simple_animal/pet/dog/corgi/ian/death() +/mob/living/simple_animal/pet/dog/corgi/ian/death(gibbed, cause_of_death = "Unknown") if(!memory_saved) Write_Memory(TRUE) ..() diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm index ba46570d2277..7dc6231f527a 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm @@ -234,7 +234,7 @@ return client.holder.auto_deadmin() return ..() -/mob/living/simple_animal/drone/death(gibbed) +/mob/living/simple_animal/drone/death(gibbed, cause_of_death = "Unknown") ..(gibbed) if(internal_storage) dropItemToGround(internal_storage) diff --git a/code/modules/mob/living/simple_animal/friendly/mouse.dm b/code/modules/mob/living/simple_animal/friendly/mouse.dm index 4575f29c02ff..2d4bce4cdbbc 100644 --- a/code/modules/mob/living/simple_animal/friendly/mouse.dm +++ b/code/modules/mob/living/simple_animal/friendly/mouse.dm @@ -50,7 +50,7 @@ src.icon_dead = "mouse_[body_color]_splat" death() -/mob/living/simple_animal/mouse/death(gibbed, toast) +/mob/living/simple_animal/mouse/death(gibbed, cause_of_death = "Unknown", toast) if(!ckey) ..(1) if(!gibbed) diff --git a/code/modules/mob/living/simple_animal/friendly/pet.dm b/code/modules/mob/living/simple_animal/friendly/pet.dm index c4f621a3743e..48845eb06ac9 100644 --- a/code/modules/mob/living/simple_animal/friendly/pet.dm +++ b/code/modules/mob/living/simple_animal/friendly/pet.dm @@ -62,7 +62,7 @@ collar_type = "[initial(collar_type)]" regenerate_icons() -/mob/living/simple_animal/pet/death(gibbed) +/mob/living/simple_animal/pet/death(gibbed, cause_of_death = "Unknown") . = ..() if(collar_type) collar_type = "[initial(collar_type)]_dead" diff --git a/code/modules/mob/living/simple_animal/guardian/guardian.dm b/code/modules/mob/living/simple_animal/guardian/guardian.dm index 9911e3e0ec7a..8443ac607ad9 100644 --- a/code/modules/mob/living/simple_animal/guardian/guardian.dm +++ b/code/modules/mob/living/simple_animal/guardian/guardian.dm @@ -241,7 +241,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians else return ..() -/mob/living/simple_animal/hostile/guardian/death() +/mob/living/simple_animal/hostile/guardian/death(gibbed, cause_of_death = "Unknown") drop_all_held_items() ..() if(summoner) diff --git a/code/modules/mob/living/simple_animal/guardian/types/dextrous.dm b/code/modules/mob/living/simple_animal/guardian/types/dextrous.dm index 8394395d97fb..cf91d8ffbf4d 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/dextrous.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/dextrous.dm @@ -12,7 +12,7 @@ held_items = list(null, null) var/obj/item/internal_storage //what we're storing within ourself -/mob/living/simple_animal/hostile/guardian/dextrous/death(gibbed) +/mob/living/simple_animal/hostile/guardian/dextrous/death(gibbed, cause_of_death = "Unknown") ..() if(internal_storage) dropItemToGround(internal_storage) diff --git a/code/modules/mob/living/simple_animal/guardian/types/gravitokinetic.dm b/code/modules/mob/living/simple_animal/guardian/types/gravitokinetic.dm index 767b1ea25db8..40322e784f02 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/gravitokinetic.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/gravitokinetic.dm @@ -12,7 +12,7 @@ var/gravity_power_range = 10 //how close the stand must stay to the target to keep the heavy gravity ///Removes gravity from affected mobs upon guardian death to prevent permanent effects -/mob/living/simple_animal/hostile/guardian/gravitokinetic/death() +/mob/living/simple_animal/hostile/guardian/gravitokinetic/death(gibbed, cause_of_death = "Unknown") . = ..() for(var/i in gravito_targets) remove_gravity(i) diff --git a/code/modules/mob/living/simple_animal/hostile/bees.dm b/code/modules/mob/living/simple_animal/hostile/bees.dm index f08ea0c2ced0..ba46a0581913 100644 --- a/code/modules/mob/living/simple_animal/hostile/bees.dm +++ b/code/modules/mob/living/simple_animal/hostile/bees.dm @@ -87,7 +87,7 @@ return ..() -/mob/living/simple_animal/hostile/bee/death(gibbed) +/mob/living/simple_animal/hostile/bee/death(gibbed, cause_of_death = "Unknown") if(beehome) beehome.bees -= src beehome = null diff --git a/code/modules/mob/living/simple_animal/hostile/carp.dm b/code/modules/mob/living/simple_animal/hostile/carp.dm index 4231477928b5..4b85d0983851 100644 --- a/code/modules/mob/living/simple_animal/hostile/carp.dm +++ b/code/modules/mob/living/simple_animal/hostile/carp.dm @@ -124,7 +124,7 @@ our_color = pick(carp_colors) set_greyscale(colors=list(carp_colors[our_color])) -/mob/living/simple_animal/hostile/carp/death(gibbed) +/mob/living/simple_animal/hostile/carp/death(gibbed, cause_of_death = "Unknown") if(shiny) QDEL_NULL(particles) return ..() @@ -284,7 +284,7 @@ ADD_TRAIT(src, TRAIT_CAN_STRIP, INNATE_TRAIT) //carp can take the disk off the captain ADD_TRAIT(src, TRAIT_CAN_USE_NUKE, INNATE_TRAIT) //carp SMART -/mob/living/simple_animal/hostile/carp/cayenne/death(gibbed) +/mob/living/simple_animal/hostile/carp/cayenne/death(gibbed, cause_of_death = "Unknown") if(disky) disky.forceMove(drop_location()) disky = null diff --git a/code/modules/mob/living/simple_animal/hostile/hivebot.dm b/code/modules/mob/living/simple_animal/hostile/hivebot.dm index d384fc0441b3..c02570fe9b80 100644 --- a/code/modules/mob/living/simple_animal/hostile/hivebot.dm +++ b/code/modules/mob/living/simple_animal/hostile/hivebot.dm @@ -62,7 +62,7 @@ else icon_state = initial(icon_state) -/mob/living/simple_animal/hostile/hivebot/death(gibbed) +/mob/living/simple_animal/hostile/hivebot/death(gibbed, cause_of_death = "Unknown") do_sparks(3, TRUE, src) ..(TRUE) diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 2263216ecd8b..c9d4e0c648c5 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -367,7 +367,7 @@ //////////////END HOSTILE MOB TARGETTING AND AGGRESSION//////////// -/mob/living/simple_animal/hostile/death(gibbed) +/mob/living/simple_animal/hostile/death(gibbed, cause_of_death = "Unknown") LoseTarget() ..(gibbed) diff --git a/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm b/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm index 5e606b5bf833..2350da020c1d 100644 --- a/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm +++ b/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm @@ -122,7 +122,7 @@ /datum/reagent/toxin/leaper_venom/affect_blood(mob/living/carbon/C, removed) . = ..() if(volume >= 10) - C.adjustToxLoss(5 * removed, 0) + C.adjustToxLoss(5 * removed, 0, cause_of_death = "Leaper venom") return TRUE /obj/effect/temp_visual/leaper_crush diff --git a/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm b/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm index eef46aa551ef..f729ca77e6c9 100644 --- a/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm +++ b/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm @@ -43,7 +43,7 @@ if(mook_moover.attack_state == MOOK_ATTACK_ACTIVE && mook_moover.throwing) return TRUE -/mob/living/simple_animal/hostile/jungle/mook/death() +/mob/living/simple_animal/hostile/jungle/mook/death(gibbed, cause_of_death = "Unknown") desc = "A deceased primitive. Upon closer inspection, it was suffering from severe cellular degeneration and its garments are machine made..."//Can you guess the twist return ..() diff --git a/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm b/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm index 5800796f2a0b..692e5255b11f 100644 --- a/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm +++ b/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm @@ -246,7 +246,7 @@ -/mob/living/simple_animal/hostile/syndicate/mecha_pilot/death(gibbed) +/mob/living/simple_animal/hostile/syndicate/mecha_pilot/death(gibbed, cause_of_death = "Unknown") if(mecha) mecha.aimob_exit_mech(src) ..() diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm index 15514b0a4a8a..a8d8bd74636d 100644 --- a/code/modules/mob/living/simple_animal/hostile/mimic.dm +++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm @@ -91,7 +91,7 @@ ..() icon_state = initial(icon_state) -/mob/living/simple_animal/hostile/mimic/crate/death() +/mob/living/simple_animal/hostile/mimic/crate/death(gibbed, cause_of_death = "Unknown") var/obj/structure/closet/crate/C = new(get_turf(src)) // Put loot in crate for(var/obj/O in src) @@ -124,7 +124,7 @@ GLOBAL_LIST_INIT(mimic_blacklist, list(/obj/structure/table, /obj/structure/cabl for(var/mob/living/M in contents) //a fix for animated statues from the flesh to stone spell death() -/mob/living/simple_animal/hostile/mimic/copy/death() +/mob/living/simple_animal/hostile/mimic/copy/death(gibbed, cause_of_death = "Unknown") for(var/atom/movable/M in src) M.forceMove(get_turf(src)) ..() @@ -314,7 +314,7 @@ GLOBAL_LIST_INIT(mimic_blacklist, list(/obj/structure/table, /obj/structure/cabl return toggle_open() -/mob/living/simple_animal/hostile/mimic/xenobio/death() +/mob/living/simple_animal/hostile/mimic/xenobio/death(gibbed, cause_of_death = "Unknown") var/obj/structure/closet/crate/C = new(get_turf(src)) // Put loot in crate for(var/atom/movable/AM in src) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/brimdemon.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/brimdemon.dm index e1e9d3d1860b..17466489371c 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/brimdemon.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/brimdemon.dm @@ -55,7 +55,7 @@ ranged = FALSE return ..() -/mob/living/simple_animal/hostile/asteroid/brimdemon/death() +/mob/living/simple_animal/hostile/asteroid/brimdemon/death(gibbed, cause_of_death = "Unknown") firing = FALSE cut_overlay("brimdemon_telegraph_dir") move_resist = initial(move_resist) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goldgrub.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goldgrub.dm index 63571d15a497..5976d4dfbb35 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goldgrub.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goldgrub.dm @@ -116,7 +116,7 @@ return TRUE return FALSE -/mob/living/simple_animal/hostile/asteroid/goldgrub/death(gibbed) +/mob/living/simple_animal/hostile/asteroid/goldgrub/death(gibbed, cause_of_death = "Unknown") barf_contents() return ..() diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm index d449c1129ab7..4e1d367251f8 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm @@ -53,7 +53,7 @@ OpenFire() return TRUE -/mob/living/simple_animal/hostile/asteroid/hivelord/death(gibbed) +/mob/living/simple_animal/hostile/asteroid/hivelord/death(gibbed, cause_of_death = "Unknown") mouse_opacity = MOUSE_OPACITY_ICON ..(gibbed) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/ice_demon.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/ice_demon.dm index 1146d324271d..2e3b25d508fa 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/ice_demon.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/ice_demon.dm @@ -77,7 +77,7 @@ return adjustHealth(-0.0125 * maxHealth * delta_time) -/mob/living/simple_animal/hostile/asteroid/ice_demon/death(gibbed) +/mob/living/simple_animal/hostile/asteroid/ice_demon/death(gibbed, cause_of_death = "Unknown") move_force = MOVE_FORCE_DEFAULT move_resist = MOVE_RESIST_DEFAULT pull_force = PULL_FORCE_DEFAULT diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm index da83869530d1..e106b0352220 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm @@ -42,6 +42,6 @@ Aggro() ..() -/mob/living/simple_animal/hostile/asteroid/death(gibbed) +/mob/living/simple_animal/hostile/asteroid/death(gibbed, cause_of_death = "Unknown") SSblackbox.record_feedback("tally", "mobs_killed_mining", 1, type) ..(gibbed) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/polarbear.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/polarbear.dm index 5aefcd5379e7..783daaff5995 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/polarbear.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/polarbear.dm @@ -52,7 +52,7 @@ adjustHealth(-0.0125 * maxHealth * delta_time) aggressive_message_said = FALSE -/mob/living/simple_animal/hostile/asteroid/polarbear/death(gibbed) +/mob/living/simple_animal/hostile/asteroid/polarbear/death(gibbed, cause_of_death = "Unknown") move_force = MOVE_FORCE_DEFAULT move_resist = MOVE_RESIST_DEFAULT pull_force = PULL_FORCE_DEFAULT diff --git a/code/modules/mob/living/simple_animal/hostile/mushroom.dm b/code/modules/mob/living/simple_animal/hostile/mushroom.dm index a57a3b719cb7..7e159549901a 100644 --- a/code/modules/mob/living/simple_animal/hostile/mushroom.dm +++ b/code/modules/mob/living/simple_animal/hostile/mushroom.dm @@ -121,7 +121,7 @@ UpdateMushroomCap() . = 1 -/mob/living/simple_animal/hostile/mushroom/death(gibbed) +/mob/living/simple_animal/hostile/mushroom/death(gibbed, cause_of_death = "Unknown") ..(gibbed) UpdateMushroomCap() diff --git a/code/modules/mob/living/simple_animal/hostile/regalrat.dm b/code/modules/mob/living/simple_animal/hostile/regalrat.dm index 05ef8db9f125..c9171699197f 100644 --- a/code/modules/mob/living/simple_animal/hostile/regalrat.dm +++ b/code/modules/mob/living/simple_animal/hostile/regalrat.dm @@ -306,7 +306,7 @@ SSmobs.cheeserats -= src return ..() -/mob/living/simple_animal/hostile/rat/death(gibbed) +/mob/living/simple_animal/hostile/rat/death(gibbed, cause_of_death = "Unknown") if(!ckey) ..(TRUE) if(!gibbed) diff --git a/code/modules/mob/living/simple_animal/hostile/space_dragon.dm b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm index 04bb989f94a7..b21536a4cd7b 100644 --- a/code/modules/mob/living/simple_animal/hostile/space_dragon.dm +++ b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm @@ -194,7 +194,7 @@ ranged_cooldown = world.time + ranged_cooldown_time fire_stream() -/mob/living/simple_animal/hostile/space_dragon/death(gibbed) +/mob/living/simple_animal/hostile/space_dragon/death(gibbed, cause_of_death = "Unknown") empty_contents() if(!objective_complete) destroy_rifts() diff --git a/code/modules/mob/living/simple_animal/hostile/wumborian_fugu.dm b/code/modules/mob/living/simple_animal/hostile/wumborian_fugu.dm index 6a7f71074140..33f0e5f72e3c 100644 --- a/code/modules/mob/living/simple_animal/hostile/wumborian_fugu.dm +++ b/code/modules/mob/living/simple_animal/hostile/wumborian_fugu.dm @@ -128,7 +128,7 @@ mob_size = MOB_SIZE_SMALL speed = 0 -/mob/living/simple_animal/hostile/asteroid/fugu/death(gibbed) +/mob/living/simple_animal/hostile/asteroid/fugu/death(gibbed, cause_of_death = "Unknown") Deflate() ..(gibbed) diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index 26fb3e492ca8..8d06f0a1377e 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -138,7 +138,7 @@ else . += pick("This parrot is no more.","This is a late parrot.","This is an ex-parrot.") -/mob/living/simple_animal/parrot/death(gibbed) +/mob/living/simple_animal/parrot/death(gibbed, cause_of_death = "Unknown") if(held_item) held_item.forceMove(drop_location()) held_item = null @@ -923,7 +923,7 @@ GLOBAL_LIST_INIT(strippable_parrot_items, create_strippable_list(list( memory_saved = TRUE ..() -/mob/living/simple_animal/parrot/poly/death(gibbed) +/mob/living/simple_animal/parrot/poly/death(gibbed, cause_of_death = "Unknown") if(!memory_saved) Write_Memory(TRUE) if(rounds_survived == longest_survival || rounds_survived == longest_deathstreak || prob(0.666)) diff --git a/code/modules/mob/living/simple_animal/shade.dm b/code/modules/mob/living/simple_animal/shade.dm index 23d3beef0025..07fedac17900 100644 --- a/code/modules/mob/living/simple_animal/shade.dm +++ b/code/modules/mob/living/simple_animal/shade.dm @@ -41,7 +41,7 @@ ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT) ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) -/mob/living/simple_animal/shade/death() +/mob/living/simple_animal/shade/death(gibbed, cause_of_death = "Unknown") if(deathmessage == initial(deathmessage)) deathmessage = "lets out a contented sigh as [p_their()] form unwinds." ..() diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index bfb6bfd247d2..8105a70f340c 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -227,12 +227,12 @@ if(access_card) . += "There appears to be [icon2html(access_card, user)] \a [access_card] pinned to [p_them()]." -/mob/living/simple_animal/update_stat() +/mob/living/simple_animal/update_stat(cause_of_death) if(status_flags & GODMODE) return if(stat != DEAD) if(health <= 0) - death() + death(cause_of_death = cause_of_death) else set_stat(CONSCIOUS) med_hud_set_status() @@ -444,7 +444,7 @@ for(var/i in loot) new i(loc) -/mob/living/simple_animal/death(gibbed) +/mob/living/simple_animal/death(gibbed, cause_of_death = "Unknown") if(nest) nest.spawned_mobs -= src nest = null diff --git a/code/modules/mob/living/simple_animal/slime/death.dm b/code/modules/mob/living/simple_animal/slime/death.dm index 5d5845c41d3d..b9b03ba41c00 100644 --- a/code/modules/mob/living/simple_animal/slime/death.dm +++ b/code/modules/mob/living/simple_animal/slime/death.dm @@ -1,4 +1,4 @@ -/mob/living/simple_animal/slime/death(gibbed) +/mob/living/simple_animal/slime/death(gibbed, cause_of_death = "Unknown") if(stat == DEAD) return if(!gibbed) diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm index 752aeaa6b6e3..f2ff3f0608ab 100644 --- a/code/modules/mob/living/simple_animal/slime/life.dm +++ b/code/modules/mob/living/simple_animal/slime/life.dm @@ -177,7 +177,7 @@ if(iscarbon(M)) var/mob/living/carbon/C = M C.adjustCloneLoss(rand(2, 4) * 0.5 * delta_time) - C.adjustToxLoss(rand(1, 2) * 0.5 * delta_time) + C.adjustToxLoss(rand(1, 2) * 0.5 * delta_time, cause_of_death = name) if(DT_PROB(5, delta_time) && C.client) to_chat(C, "[pick("You can feel your body becoming weak!", \ diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index e1b890be7330..b4a404092a97 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -147,7 +147,7 @@ ..() -/mob/living/simple_animal/slime/updatehealth() +/mob/living/simple_animal/slime/updatehealth(cause_of_death) . = ..() var/mod = 0 if(!HAS_TRAIT(src, TRAIT_IGNOREDAMAGESLOWDOWN)) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index d1dafa252c85..77fbea26465f 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1258,7 +1258,7 @@ break search_pda = 0 -/mob/proc/update_stat() +/mob/proc/update_stat(cause_of_death) return /mob/proc/update_health_hud() diff --git a/code/modules/projectiles/projectile/special/floral.dm b/code/modules/projectiles/projectile/special/floral.dm index ceb939f10493..6d348c3abefb 100644 --- a/code/modules/projectiles/projectile/special/floral.dm +++ b/code/modules/projectiles/projectile/special/floral.dm @@ -12,7 +12,7 @@ var/mob/living/L = target if(L.mob_biotypes & MOB_PLANT) if(prob(15)) - L.adjustToxLoss(rand(3, 6)) + L.adjustToxLoss(rand(3, 6), cause_of_death = name) L.Paralyze(100) L.visible_message(span_warning("[L] writhes in pain as [L.p_their()] vacuoles boil."), span_userdanger("You writhe in pain as your vacuoles boil!"), span_hear("You hear the crunching of leaves.")) if(iscarbon(L) && L.has_dna()) diff --git a/code/modules/reagents/chemistry/goon_reagents/other_reagents.dm b/code/modules/reagents/chemistry/goon_reagents/other_reagents.dm index 335c46bf1a34..629b8e35a144 100644 --- a/code/modules/reagents/chemistry/goon_reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/goon_reagents/other_reagents.dm @@ -10,7 +10,7 @@ /datum/reagent/uranium/affect_blood(mob/living/carbon/C, removed) - C.adjustToxLoss(tox_damage * removed, FALSE) + C.adjustToxLoss(tox_damage * removed, FALSE, cause_of_death = "Uranium poisoning") return TRUE /datum/reagent/uranium/expose_turf(turf/exposed_turf, reac_volume) @@ -91,7 +91,7 @@ exposed_mob.adjust_fire_stacks(reac_volume / 10) /datum/reagent/fuel/affect_blood(mob/living/carbon/C, removed) - C.adjustToxLoss(0.5 * removed, 0) + C.adjustToxLoss(0.5 * removed, 0, cause_of_death = "Ingesting fuel") return TRUE /datum/reagent/space_cleaner @@ -145,7 +145,7 @@ /datum/reagent/space_cleaner/ez_clean/affect_blood(mob/living/carbon/C, removed) C.adjustBruteLoss(1.665*removed, FALSE) C.adjustFireLoss(1.665*removed, FALSE) - C.adjustToxLoss(1.665*removed, FALSE) + C.adjustToxLoss(1.665*removed, FALSE, cause_of_death = "Ingesting space cleaner") return TRUE /datum/reagent/space_cleaner/ez_clean/expose_mob(mob/living/exposed_mob, reac_volume, exposed_temperature = T20C, datum/reagents/source, methods=TOUCH, show_message = TRUE, touch_protection = 0) @@ -217,7 +217,7 @@ /datum/reagent/stimulants/overdose_process(mob/living/carbon/C) if(prob(25)) C.stamina.adjust(2.5) - C.adjustToxLoss(1, 0) + C.adjustToxLoss(1, 0, cause_of_death = "Stimulant overdose") C.losebreath++ . = TRUE @@ -331,7 +331,7 @@ value = DISPENSER_REAGENT_VALUE /datum/reagent/acetone/affect_blood(mob/living/carbon/C, removed) - C.adjustToxLoss(removed * 3, FALSE) + C.adjustToxLoss(removed * 3, FALSE, cause_of_death = "Ingesting acetone") return TRUE /datum/reagent/acetone/expose_obj(obj/exposed_obj, reac_volume, exposed_temperature) diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 07ac1dd5183e..ff47dbe6fcf9 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -237,7 +237,7 @@ Primarily used in reagents/reaction_agents /datum/reagent/proc/overdose_process(mob/living/carbon/C) SHOULD_NOT_SLEEP(TRUE) APPLY_CHEM_EFFECT(C, CE_TOXIN, 1) - C.adjustToxLoss(0.2, FALSE) + C.adjustToxLoss(0.2, FALSE, cause_of_death = "Overdose") return TRUE /// Called when an overdose starts diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index 33329eddd94d..b70dd55221ba 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -1355,7 +1355,7 @@ All effects don't start immediately, but rather get worse over time; the rate is . = TRUE if(201 to INFINITY) C.AdjustSleeping(40 * removed) - C.adjustToxLoss(2 * removed, 0) + C.adjustToxLoss(2 * removed, 0, cause_of_death = "Atomic bomb") . = TRUE return ..() || . @@ -1384,7 +1384,7 @@ All effects don't start immediately, but rather get worse over time; the rate is if(55 to 200) C.set_timed_status_effect(110 SECONDS * removed, /datum/status_effect/drugginess) if(200 to INFINITY) - C.adjustToxLoss(2 * removed, 0) + C.adjustToxLoss(2 * removed, 0, cause_of_death = "Gargle blaster") . = TRUE return ..() || . @@ -1484,7 +1484,7 @@ All effects don't start immediately, but rather get worse over time; the rate is spawn(-1) C.emote(pick("twitch","giggle")) if(prob(25)) - C.adjustToxLoss(2 * removed, 0) + C.adjustToxLoss(2 * removed, 0, cause_of_death = "Hippie's delight") . = TRUE return ..() || . @@ -1820,7 +1820,7 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/fernet/affect_ingest(mob/living/carbon/C, removed) if(C.nutrition <= NUTRITION_LEVEL_STARVING) - C.adjustToxLoss(1 * removed, 0) + C.adjustToxLoss(1 * removed, 0, cause_of_death = "Fernet") . = TRUE C.adjust_nutrition(-5 * removed) @@ -1840,7 +1840,7 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/fernet_cola/affect_ingest(mob/living/carbon/C, removed) if(C.nutrition <= NUTRITION_LEVEL_STARVING) - C.adjustToxLoss(0.5 * removed, 0) + C.adjustToxLoss(0.5 * removed, 0, cause_of_death = "Fernet cola") C.adjust_nutrition(-3 * removed) C.overeatduration = 0 return ..() @@ -2064,20 +2064,20 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/bug_spray/affect_ingest(mob/living/carbon/C, removed) //Bugs should not drink Bug spray. if(ismoth(C) || isflyperson(C)) - C.adjustToxLoss(1 * removed, 0) + C.adjustToxLoss(1 * removed, 0, cause_of_death = "Bug spray") . = TRUE return ..() || . /datum/reagent/consumable/ethanol/bug_spray/affect_touch(mob/living/carbon/C, removed) //Bugs should not drink Bug spray. if(ismoth(C) || isflyperson(C)) - C.adjustToxLoss(1 * removed, 0) + C.adjustToxLoss(1 * removed, 0, cause_of_death = "Bug spray") return TRUE /datum/reagent/consumable/ethanol/bug_spray/affect_blood(mob/living/carbon/C, removed) //Bugs should not drink Bug spray. if(ismoth(C) || isflyperson(C)) - C.adjustToxLoss(3 * removed, 0) + C.adjustToxLoss(3 * removed, 0, cause_of_death = "Bug spray") return TRUE /datum/reagent/consumable/ethanol/bug_spray/on_mob_metabolize(mob/living/carbon/C) diff --git a/code/modules/reagents/chemistry/reagents/dispenser_reagents.dm b/code/modules/reagents/chemistry/reagents/dispenser_reagents.dm index 0a3fb672387f..1764aa946220 100644 --- a/code/modules/reagents/chemistry/reagents/dispenser_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/dispenser_reagents.dm @@ -19,11 +19,11 @@ value = DISPENSER_REAGENT_VALUE /datum/reagent/ammonia/affect_blood(mob/living/carbon/C, removed) - C.adjustToxLoss(removed * 1.5, FALSE) + C.adjustToxLoss(removed * 1.5, FALSE, cause_of_death = "Ingesting ammonia") return TRUE /datum/reagent/ammonia/overdose_process(mob/living/carbon/C) - C.adjustToxLoss(0.5, FALSE) + C.adjustToxLoss(0.5, FALSE, cause_of_death = "Ingesting ALOT of ammonia") return TRUE /datum/reagent/carbon @@ -280,7 +280,7 @@ mytray.adjust_weedlevel(-rand(1,4)) /datum/reagent/fluorine/affect_blood(mob/living/carbon/C, removed) - C.adjustToxLoss(0.5*removed, 0) + C.adjustToxLoss(0.5*removed, 0, cause_of_death = "Ammonia poisoning") . = TRUE //This is intended to a be a scarce reagent to gate certain drugs and toxins with. Do not put in a synthesizer. Renewable sources of this reagent should be inefficient. @@ -338,7 +338,7 @@ /datum/reagent/chlorine/affect_blood(mob/living/carbon/C, removed) - C.adjustToxLoss(3 * removed, FALSE) + C.adjustToxLoss(3 * removed, FALSE, cause_of_death = "Chlorine poisoning") . = TRUE /datum/reagent/calcium diff --git a/code/modules/reagents/chemistry/reagents/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drink_reagents.dm index a517a7fbcc31..d8b95ba40fe1 100644 --- a/code/modules/reagents/chemistry/reagents/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drink_reagents.dm @@ -98,7 +98,7 @@ /datum/reagent/consumable/poisonberryjuice/affect_blood(mob/living/carbon/C, removed) - C.adjustToxLoss(1 * removed, 0) + C.adjustToxLoss(1 * removed, 0, cause_of_death = "Poison berry juice") . = TRUE /datum/reagent/consumable/watermelonjuice diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm index 221b4da8b696..40e779a1e5ba 100644 --- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm @@ -119,7 +119,7 @@ /datum/reagent/drug/krokodil/overdose_process(mob/living/carbon/C) C.adjustOrganLoss(ORGAN_SLOT_BRAIN, 0.25, updating_health = FALSE) - C.adjustToxLoss(0.25, 0) + C.adjustToxLoss(0.25, 0, cause_of_death = "Krokodil overdose") . = TRUE /datum/reagent/drug/methamphetamine @@ -172,7 +172,7 @@ C.visible_message(span_danger("[C]'s hands flip out and flail everywhere!")) C.drop_all_held_items() - C.adjustToxLoss(1, 0) + C.adjustToxLoss(1, 0, cause_of_death = "Methamphetamine overdose") C.adjustOrganLoss(ORGAN_SLOT_BRAIN, (rand(5, 10) / 10), updating_health = FALSE) . = TRUE @@ -243,7 +243,7 @@ to_chat(C, span_notice("[high_message]")) C.stamina.adjust(-18 * removed) - C.adjustToxLoss(0.5 * removed, 0) + C.adjustToxLoss(0.5 * removed, 0, cause_of_death = "Aransep poisoning") if(prob(30)) C.losebreath++ C.adjustOxyLoss(1 * removed, 0) @@ -277,7 +277,7 @@ if(prob(14)) C.losebreath++ - C.adjustToxLoss(2, 0) + C.adjustToxLoss(2, 0, cause_of_death = "Pump-Up") . = TRUE /datum/reagent/drug/pumpup/overdose_start(mob/living/carbon/C) @@ -295,7 +295,7 @@ C.stamina.adjust(-4) if(prob(14)) - C.adjustToxLoss(2, 0) + C.adjustToxLoss(2, 0, cause_of_death = "Pump-Up overdose") return TRUE /datum/reagent/drug/maint @@ -346,7 +346,7 @@ ADD_TRAIT(C,TRAIT_HARDLY_WOUNDED, type) /datum/reagent/drug/maint/sludge/affect_blood(mob/living/carbon/C, removed) - C.adjustToxLoss(0.5 * removed, FALSE) + C.adjustToxLoss(0.5 * removed, FALSE, cause_of_death = "Sludge poisoning") return TRUE /datum/reagent/drug/maint/sludge/on_mob_end_metabolize(mob/living/carbon/C, class) @@ -356,9 +356,9 @@ /datum/reagent/drug/maint/sludge/overdose_process(mob/living/carbon/C) //You will be vomiting so the damage is really for a few ticks before you flush it out of your system - C.adjustToxLoss(1, FALSE) + C.adjustToxLoss(1, FALSE, cause_of_death = "Sludge overdose") if(prob(10)) - C.adjustToxLoss(5, FALSE) + C.adjustToxLoss(5, FALSE, cause_of_death = "Sludge overdose") C.vomit() return TRUE @@ -381,7 +381,7 @@ return TRUE /datum/reagent/drug/maint/tar/overdose_process(mob/living/carbon/C) - C.adjustToxLoss(5, FALSE) + C.adjustToxLoss(5, FALSE, cause_of_death = "Tar overdose") C.adjustOrganLoss(ORGAN_SLOT_LIVER, 3, updating_health = FALSE) return TRUE diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 6b26c539d7b9..a4418a35d596 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -438,7 +438,7 @@ holder.remove_reagent(/datum/reagent/toxin/mindbreaker, 5) - C.adjustToxLoss(3 * removed, updating_health = FALSE) // It used to be incredibly deadly due to an oversight. Not anymore! + C.adjustToxLoss(3 * removed, updating_health = FALSE, cause_of_death = "Synaptizine") // It used to be incredibly deadly due to an oversight. Not anymore! APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 70) APPLY_CHEM_EFFECT(C, CE_STIMULANT, 10) return TRUE @@ -818,7 +818,7 @@ C.visible_message("A rubbery liquid coats [C]'s burns.") //we're avoiding using the phrases "burnt flesh" and "burnt skin" here because carbies could be a skeleton or a golem or something /datum/reagent/medicine/synthflesh/affect_blood(mob/living/carbon/C, removed) - C.adjustToxLoss(1 * removed) + C.adjustToxLoss(1 * removed, cause_of_death = "Synthflesh poisoning") return TRUE /datum/reagent/medicine/atropine @@ -957,7 +957,7 @@ return ..() /datum/reagent/medicine/ipecac/affect_blood(mob/living/carbon/C, removed) - C.adjustToxLoss(5 * removed, 0) + C.adjustToxLoss(5 * removed, 0, cause_of_death = "Ipecac") . = TRUE /datum/reagent/medicine/activated_charcoal diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index 064f8e1eca8b..7b0bf5ec085e 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -384,7 +384,7 @@ color = pick(potential_colors) /datum/reagent/hair_dye/affect_ingest(mob/living/carbon/C, removed) //What the fuck is wrong with you - C.adjustToxLoss(2 * removed, FALSE) + C.adjustToxLoss(2 * removed, FALSE, cause_of_death = "Ingesting hair dye") return ..() || TRUE /datum/reagent/hair_dye/expose_mob(mob/living/exposed_mob, methods=TOUCH, reac_volume, show_message=TRUE, touch_protection=FALSE) @@ -408,7 +408,7 @@ /datum/reagent/plantnutriment/affect_blood(mob/living/carbon/C, removed) if(prob(tox_prob *2)) - C.adjustToxLoss(1 * removed, 0) + C.adjustToxLoss(1 * removed, 0, cause_of_death = "Plant nutriment poisoning") . = TRUE /datum/reagent/plantnutriment/eznutriment @@ -574,7 +574,7 @@ /datum/reagent/technetium/affect_blood(mob/living/carbon/C, removed) if(!(current_cycle % 8)) - C.adjustToxLoss(5 * removed, FALSE) + C.adjustToxLoss(5 * removed, FALSE, cause_of_death = "Technetium 99 poisoning") . = TRUE /datum/reagent/helgrasp @@ -655,7 +655,7 @@ drinker.blood_volume += 3 * removed else drinker.adjustOrganLoss(ORGAN_SLOT_BRAIN, 3 * removed, 150, updating_health = FALSE) - drinker.adjustToxLoss(2 * removed, FALSE) + drinker.adjustToxLoss(2 * removed, FALSE, cause_of_death = "The devil") drinker.adjustFireLoss(2 * removed, FALSE) drinker.adjustOxyLoss(2 * removed, FALSE) drinker.adjustBruteLoss(2 * removed, FALSE) @@ -740,7 +740,7 @@ C.blood_volume += 3 * removed else // Will deal about 90 damage when 50 units are thrown C.adjustOrganLoss(ORGAN_SLOT_BRAIN, 3 * removed, 150, updating_health = FALSE) - C.adjustToxLoss(1 * removed, 0) + C.adjustToxLoss(1 * removed, 0, cause_of_death = "The devil") C.adjustFireLoss(1 * removed, 0) C.adjustOxyLoss(1 * removed, 0) C.adjustBruteLoss(1 * removed, 0) @@ -1114,7 +1114,7 @@ C.remove_status_effect(/datum/status_effect/jitter) /datum/reagent/medicine/changelingadrenaline/overdose_process(mob/living/carbon/C) - C.adjustToxLoss(0.2, 0) + C.adjustToxLoss(0.2, 0, cause_of_death = "Changeling adrenaline overdose") return TRUE /datum/reagent/medicine/changelinghaste @@ -1133,7 +1133,7 @@ C.remove_movespeed_modifier(/datum/movespeed_modifier/reagent/changelinghaste) /datum/reagent/medicine/changelinghaste/affect_blood(mob/living/carbon/C, removed) - C.adjustToxLoss(0.2, 0) + C.adjustToxLoss(0.2, 0, cause_of_death = "Changeling haste") return TRUE /datum/reagent/gold diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 432d9f905cc6..84392d548bab 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -20,7 +20,7 @@ /datum/reagent/toxin/affect_blood(mob/living/carbon/C, removed) if(toxpwr) - C.adjustToxLoss(toxpwr * removed, 0) + C.adjustToxLoss(toxpwr * removed, 0, cause_of_death = "Poisoning") . = TRUE /datum/reagent/toxin/amatoxin @@ -177,7 +177,7 @@ . = ..() if(prob(5)) to_chat(C, span_danger("Your insides burn!")) - C.adjustToxLoss(rand(20, 60), 0) + C.adjustToxLoss(rand(20, 60), 0, cause_of_death = "Slime jelly poisoning") else if(prob(30)) C.heal_bodypart_damage(5, updating_health = FALSE) @@ -319,12 +319,12 @@ . = ..() var/damage = min(round(0.4 * reac_volume, 0.1), 10) if(exposed_mob.mob_biotypes & MOB_PLANT) - exposed_mob.adjustToxLoss(damage) + exposed_mob.adjustToxLoss(damage, cause_of_death = "Plant-B-Gone") if(!(methods & VAPOR) || !iscarbon(exposed_mob)) return var/mob/living/carbon/exposed_carbon = exposed_mob if(!exposed_carbon.wear_mask) - exposed_carbon.adjustToxLoss(damage) + exposed_carbon.adjustToxLoss(damage, cause_of_death = "Plant-B-Gone") /datum/reagent/toxin/plantbgone/weedkiller name = "Weed Killer" @@ -359,13 +359,13 @@ . = ..() if(exposed_mob.mob_biotypes & MOB_BUG) var/damage = min(round(0.4*reac_volume, 0.1),10) - exposed_mob.adjustToxLoss(damage) + exposed_mob.adjustToxLoss(damage, cause_of_death = "Pestkiller") /datum/reagent/toxin/pestkiller/affect_blood(mob/living/carbon/C, removed) if(!(ismoth(C) || isflyperson(C))) return - C.adjustToxLoss(3 * removed, FALSE) + C.adjustToxLoss(3 * removed, FALSE, cause_of_death = "Pestkiller") return TRUE /datum/reagent/toxin/pestkiller/affect_touch(mob/living/carbon/C, removed) @@ -430,7 +430,7 @@ C.Sleeping(40 * removed) if(51 to INFINITY) C.Sleeping(40 * removed) - C.adjustToxLoss(1 * (current_cycle - 50) * removed, 0) + C.adjustToxLoss(1 * (current_cycle - 50) * removed, 0, cause_of_death = "Chloral hydrate poisoning") . = TRUE /datum/reagent/toxin/fakebeer //disguised as normal beer for use by emagged brobots @@ -452,7 +452,7 @@ C.adjust_drowsyness(2 * removed) if(51 to INFINITY) C.Sleeping(40 * removed) - C.adjustToxLoss(1 * (current_cycle - 50) * removed, 0) + C.adjustToxLoss(1 * (current_cycle - 50) * removed, 0, cause_of_death = "Beer...?") /datum/reagent/toxin/coffeepowder name = "Coffee Grounds" @@ -520,7 +520,7 @@ if (!HAS_TRAIT(C, TRAIT_IRRADIATED) && SSradiation.can_irradiate_basic(C)) C.AddComponent(/datum/component/irradiated) else - C.adjustToxLoss(1 * removed, FALSE) + C.adjustToxLoss(1 * removed, FALSE, cause_of_death = "Polonium poisoning") return TRUE /datum/reagent/toxin/histamine @@ -549,13 +549,13 @@ if(4) if(prob(75)) to_chat(C, span_danger("You scratch at an itch.")) - C.adjustBruteLoss(2*removed, 0) + C.adjustBruteLoss(2, 0) . = TRUE /datum/reagent/toxin/histamine/overdose_process(mob/living/carbon/C) C.adjustOxyLoss(2, FALSE) C.adjustBruteLoss(2, FALSE, FALSE, BODYTYPE_ORGANIC) - C.adjustToxLoss(2, FALSE) + C.adjustToxLoss(2, FALSE, cause_of_death = "Histamine overdose") . = TRUE /datum/reagent/toxin/venom @@ -605,7 +605,7 @@ /datum/reagent/toxin/fentanyl/affect_blood(mob/living/carbon/C, removed) C.adjustOrganLoss(ORGAN_SLOT_BRAIN, 3 * removed, 150, updating_health = FALSE) if(C.getToxLoss() <= 60) - C.adjustToxLoss(1 * removed, 0) + C.adjustToxLoss(1 * removed, 0, cause_of_death = "Fentanyl") if(current_cycle >= 18) C.Sleeping(40 * removed) return TRUE @@ -626,7 +626,7 @@ if(prob(8)) to_chat(C, span_danger("You feel horrendously weak!")) C.Stun(40) - C.adjustToxLoss(2 * removed, 0) + C.adjustToxLoss(2 * removed, 0, cause_of_death = "Cyanide poisoning") /datum/reagent/toxin/bad_food name = "Bad Food" @@ -791,7 +791,7 @@ /datum/reagent/toxin/amanitin/on_mob_end_metabolize(mob/living/carbon/C, class) C.log_message("has taken [delayed_toxin_damage] toxin damage from amanitin toxin", LOG_ATTACK) - C.adjustToxLoss(delayed_toxin_damage, FALSE) + C.adjustToxLoss(delayed_toxin_damage, FALSE, cause_of_death = "Amanitin") delayed_toxin_damage = 0 return TRUE @@ -808,7 +808,7 @@ /datum/reagent/toxin/lipolicide/affect_blood(mob/living/carbon/C, removed) . = ..() if(C.nutrition <= NUTRITION_LEVEL_STARVING) - C.adjustToxLoss(1 * removed, 0) + C.adjustToxLoss(1 * removed, 0, cause_of_death = "Lipolicide poisoning") . = TRUE C.adjust_nutrition(-3 * removed) // making the chef more valuable, one meme trap at a time C.overeatduration = 0 @@ -944,7 +944,7 @@ /datum/reagent/toxin/delayed/affect_blood(mob/living/carbon/C, removed) if(current_cycle > delay) - C.adjustToxLoss(actual_toxpwr * removed, 0) + C.adjustToxLoss(actual_toxpwr * removed, 0, cause_of_death = "Toxin microcapsules") if(prob(10)) C.Paralyze(20) . = TRUE diff --git a/code/modules/surgery/bodyparts/_bodyparts.dm b/code/modules/surgery/bodyparts/_bodyparts.dm index 9c1e6a173041..9407deacc113 100644 --- a/code/modules/surgery/bodyparts/_bodyparts.dm +++ b/code/modules/surgery/bodyparts/_bodyparts.dm @@ -549,6 +549,15 @@ if(!brute && !burn) return FALSE + var/cause_of_death + if(brute) + if(sharpness == NONE) + cause_of_death = "Blunt force trauma" + else + cause_of_death = "Laceration" + else + cause_of_death = "Third-degree burn" + if(bodytype & (BODYTYPE_ALIEN|BODYTYPE_LARVA_PLACEHOLDER)) //aliens take double burn //nothing can burn with so much snowflake code around burn *= 2 @@ -655,7 +664,7 @@ if(owner) update_disabled() if(updating_health) - owner.updatehealth() + owner.updatehealth(cause_of_death = cause_of_death) if(. & BODYPART_LIFE_UPDATE_DAMAGE_OVERLAYS) owner.update_damage_overlays() return . @@ -698,7 +707,6 @@ if(encased && !(bodypart_flags & BP_BROKEN_BONES)) //ribs protect organ_hit_chance *= 0.6 - organ_hit_chance = min(organ_hit_chance, 100) if(prob(organ_hit_chance)) var/obj/item/organ/victim = pick_weight(victims) damage *= victim.external_damage_modifier diff --git a/code/modules/surgery/bodyparts/germs_bodypart.dm b/code/modules/surgery/bodyparts/germs_bodypart.dm index 156099a7ce15..87b8def88b86 100644 --- a/code/modules/surgery/bodyparts/germs_bodypart.dm +++ b/code/modules/surgery/bodyparts/germs_bodypart.dm @@ -128,5 +128,5 @@ Note that amputating the affected organ does in fact remove the infection from t update_disabled() germ_level++ - if(owner.adjustToxLoss(1, FALSE)) + if(owner.adjustToxLoss(1, FALSE, cause_of_death = "Necrosis")) return BODYPART_LIFE_UPDATE_HEALTH diff --git a/code/modules/surgery/machines/bodyscanner.dm b/code/modules/surgery/machines/bodyscanner.dm index dbbed0687229..80855907a345 100644 --- a/code/modules/surgery/machines/bodyscanner.dm +++ b/code/modules/surgery/machines/bodyscanner.dm @@ -401,7 +401,7 @@ DEFINE_INTERACTABLE(/obj/machinery/bodyscanner_console) Physical Trauma: - [get_severity(scan["brute"],TRUE)] + [get_damage_severity(scan["brute"],TRUE)] "} @@ -412,7 +412,7 @@ DEFINE_INTERACTABLE(/obj/machinery/bodyscanner_console) Burn Severity: - [get_severity(scan["burn"],TRUE)] + [get_damage_severity(scan["burn"],TRUE)] "} @@ -423,7 +423,7 @@ DEFINE_INTERACTABLE(/obj/machinery/bodyscanner_console) Systematic Organ Failure: - [get_severity(scan["toxin"],TRUE)] + [get_damage_severity(scan["toxin"],TRUE)] "} @@ -434,7 +434,7 @@ DEFINE_INTERACTABLE(/obj/machinery/bodyscanner_console) Oxygen Deprivation: - [get_severity(scan["oxygen"],TRUE)] + [get_damage_severity(scan["oxygen"],TRUE)] "} @@ -445,7 +445,7 @@ DEFINE_INTERACTABLE(/obj/machinery/bodyscanner_console) Genetic Damage: - [get_severity(scan["genetic"],TRUE)] + [get_damage_severity(scan["genetic"],TRUE)] "} @@ -553,21 +553,25 @@ DEFINE_INTERACTABLE(/obj/machinery/bodyscanner_console) . += "" if(!(limb["brute_dam"] || limb["burn_dam"])) . += "None" + else + + if(limb["brute_dam"]) + . += {" + [capitalize(get_wound_severity(limb["brute_ratio"]))] physical trauma
+ "} + if(limb["burn_dam"]) + . += {" + [capitalize(get_wound_severity(limb["burn_ratio"]))] burns + "} + + . += "" - if(limb["brute_dam"]) - . += {" - [capitalize(get_wound_severity(limb["brute_ratio"]))] physical trauma
- "} - if(limb["burn_dam"]) - . += {" - [capitalize(get_wound_severity(limb["burn_ratio"]))] burns - - "} . += {" [english_list(limb["scan_results"], nothing_text = " ")] "} + . += "" . += "
Internal Organs
" @@ -575,7 +579,7 @@ DEFINE_INTERACTABLE(/obj/machinery/bodyscanner_console) . += "[organ["name"]]" if(organ["damage_percent"]) - . += "[get_severity(organ["damage_percent"], TRUE)]" + . += "[get_damage_severity(organ["damage_percent"], TRUE)]" else . += "None" diff --git a/code/modules/surgery/machines/bodyscanner_helpers.dm b/code/modules/surgery/machines/bodyscanner_helpers.dm index 17787a2de97c..65d3776e872a 100644 --- a/code/modules/surgery/machines/bodyscanner_helpers.dm +++ b/code/modules/surgery/machines/bodyscanner_helpers.dm @@ -55,7 +55,7 @@ for(var/datum/reagent/R in reagents.reagent_list) var/list/reagent = list() reagent["name"] = R.name - reagent["quantity"] = round(R.volume, 1) + reagent["quantity"] = round(R.volume, 0.1) reagent["visible"] = !(R.chemical_flags & (REAGENT_INVISIBLE)) reagent["overdosed"] = R.overdosed .["reagents"] += list(reagent) @@ -89,7 +89,7 @@ .["blind"] = HAS_TRAIT(src, TRAIT_BLIND) .["genetic_instability"] = !!GetComponent(/datum/component/genetic_damage) -/obj/machinery/bodyscanner_console/proc/get_severity(amount, tag = FALSE) +/proc/get_damage_severity(amount, tag = FALSE) if(!amount) return "none" diff --git a/code/modules/surgery/new_surgery/internal_organs.dm b/code/modules/surgery/new_surgery/internal_organs.dm index 60ba71b7582f..6ffff416610b 100644 --- a/code/modules/surgery/new_surgery/internal_organs.dm +++ b/code/modules/surgery/new_surgery/internal_organs.dm @@ -91,7 +91,7 @@ var/dam_amt = 2 dam_amt = 5 - target.adjustToxLoss(10) + target.adjustToxLoss(10, cause_of_death = "A bad surgeon") affected.receive_damage(dam_amt, sharpness = SHARP_EDGED|SHARP_POINTY) for(var/obj/item/organ/I in affected.contained_organs) diff --git a/code/modules/surgery/organs/_organ.dm b/code/modules/surgery/organs/_organ.dm index 47ad4e5e0e21..e5f9bc8e2d92 100644 --- a/code/modules/surgery/organs/_organ.dm +++ b/code/modules/surgery/organs/_organ.dm @@ -221,7 +221,7 @@ INITIALIZE_IMMEDIATE(/obj/item/organ) if(!cosmetic_only) if((organ_flags & ORGAN_VITAL) && !special && !(organ_owner.status_flags & GODMODE) && organ_owner.needs_organ(slot)) - organ_owner.death() + organ_owner.death(cause_of_death = "Brain removal") organ_owner.processing_organs -= src START_PROCESSING(SSobj, src) @@ -279,7 +279,7 @@ INITIALIZE_IMMEDIATE(/obj/item/organ) if(germ_level >= INFECTION_LEVEL_TWO) germ_level += rand(1,3) if(germ_level >= INFECTION_LEVEL_THREE) - set_organ_dead(TRUE) + set_organ_dead(TRUE, "Necrosis") /// Called once every life tick on every organ in a carbon's body /// NOTE: THIS IS VERY HOT. Be careful what you put in here @@ -354,7 +354,7 @@ INITIALIZE_IMMEDIATE(/obj/item/organ) ownerlimb.germ_level++ if (prob(3)) //about once every 30 seconds - . = applyOrganDamage(1,silent=prob(30), updating_health = FALSE) + applyOrganDamage(1,silent=prob(30), updating_health = FALSE) /obj/item/organ/examine(mob/user) . = ..() @@ -410,7 +410,7 @@ INITIALIZE_IMMEDIATE(/obj/item/organ) damage = min(damage, maxHealth) ///Adjusts an organ's damage by the amount "damage_amount", up to a maximum amount, which is by default max damage -/obj/item/organ/proc/applyOrganDamage(damage_amount, maximum = maxHealth, silent, updating_health = TRUE) //use for damaging effects +/obj/item/organ/proc/applyOrganDamage(damage_amount, maximum = maxHealth, silent, updating_health = TRUE, cause_of_death = "Organ failure") //use for damaging effects if(!damage_amount || cosmetic_only) //Micro-optimization. return if(maximum < damage) @@ -424,7 +424,7 @@ INITIALIZE_IMMEDIATE(/obj/item/organ) . = damage - old_damage var/mess = check_damage_thresholds(owner) - check_failing_thresholds() + check_failing_thresholds(cause_of_death = cause_of_death) prev_damage = damage if(!silent && damage_amount > 0 && owner && owner.stat < UNCONSCIOUS && !(organ_flags & ORGAN_SYNTHETIC) && (damage_amount > 5 || prob(10))) if(!mess) @@ -439,10 +439,6 @@ INITIALIZE_IMMEDIATE(/obj/item/organ) owner.apply_pain(damage_amount, ownerlimb.body_zone, "Something inside your [BP.plaintext_zone] hurts[degree].", updating_health = FALSE) - if(updating_health && owner) - owner.updatehealth() - - ///SETS an organ's damage to the amount "damage_amount", and in doing so clears or sets the failing flag, good for when you have an effect that should fix an organ if broken /obj/item/organ/proc/setOrganDamage(damage_amount) //use mostly for admin heals applyOrganDamage(damage_amount - damage) @@ -477,14 +473,14 @@ INITIALIZE_IMMEDIATE(/obj/item/organ) return now_fixed ///Checks if an organ should/shouldn't be failing and gives the appropriate organ flag -/obj/item/organ/proc/check_failing_thresholds(revivable) +/obj/item/organ/proc/check_failing_thresholds(revivable, cause_of_death) if(damage >= maxHealth) - set_organ_dead(TRUE) + set_organ_dead(TRUE, cause_of_death = cause_of_death) else if(revivable) set_organ_dead(FALSE) /// Set or unset the organ as failing. Returns TRUE on success. -/obj/item/organ/proc/set_organ_dead(failing) +/obj/item/organ/proc/set_organ_dead(failing, cause_of_death) if(failing) if(organ_flags & ORGAN_DEAD) return FALSE @@ -618,7 +614,7 @@ INITIALIZE_IMMEDIATE(/obj/item/organ) . += tag ? "[germ_message]" : germ_message // Add more info if Technetium is in their blood - if(owner.has_reagent(/datum/reagent/technetium)) + if(owner?.has_reagent(/datum/reagent/technetium)) . += tag ? " organ is [round((damage/maxHealth)*100, 1)]% damaged." : "[round((damage/maxHealth)*100, 1)]" else if(damage > high_threshold) . += tag ? "Severely Damaged" : "Severely Damaged" diff --git a/code/modules/surgery/organs/appendix.dm b/code/modules/surgery/organs/appendix.dm index c57a24481d98..487b3bc3badd 100644 --- a/code/modules/surgery/organs/appendix.dm +++ b/code/modules/surgery/organs/appendix.dm @@ -35,8 +35,9 @@ if(organ_flags & ORGAN_DEAD) // forced to ensure people don't use it to gain tox as slime person - organ_owner.adjustToxLoss(2 * delta_time, updating_health = FALSE, forced = TRUE) - return TRUE + organ_owner.adjustToxLoss(2 * delta_time, updating_health = FALSE, forced = TRUE, cause_of_death = "Necrotic appendix") + return + else if(inflamation_stage) return inflamation(delta_time) @@ -64,7 +65,7 @@ to_chat(organ_owner, span_warning("You feel a stabbing pain in your abdomen!")) organ_owner.adjustOrganLoss(ORGAN_SLOT_APPENDIX, 5) organ_owner.Stun(rand(40, 60)) - organ_owner.adjustToxLoss(1, updating_health = FALSE, forced = TRUE) + organ_owner.adjustToxLoss(1, updating_health = FALSE, forced = TRUE, cause_of_death = "Appendicitis") . = TRUE if(3) if(DT_PROB(0.5, delta_time)) diff --git a/code/modules/surgery/organs/heart.dm b/code/modules/surgery/organs/heart.dm index af8e39031208..d5bfec45b211 100644 --- a/code/modules/surgery/organs/heart.dm +++ b/code/modules/surgery/organs/heart.dm @@ -93,10 +93,8 @@ handle_heartbeat() if(pulse == PULSE_2FAST && prob(1)) applyOrganDamage(0.25, updating_health = FALSE) - . = TRUE if(pulse == PULSE_THREADY && prob(5)) applyOrganDamage(0.35, updating_health = FALSE) - . = TRUE /obj/item/organ/heart/proc/handle_pulse() if(organ_flags & ORGAN_SYNTHETIC) diff --git a/code/modules/surgery/organs/kidneys.dm b/code/modules/surgery/organs/kidneys.dm index 780a20b88610..6b58d1c9da57 100644 --- a/code/modules/surgery/organs/kidneys.dm +++ b/code/modules/surgery/organs/kidneys.dm @@ -18,21 +18,18 @@ if(damage > maxHealth * high_threshold) var/datum/reagent/coffee = locate(/datum/reagent/consumable/coffee) in owner.reagents.reagent_list if(coffee) - owner.adjustToxLoss(0.3, FALSE) - . = TRUE + owner.adjustToxLoss(0.3, FALSE, cause_of_death = "Kidney failure") if(!owner.reagents.has_reagent(/datum/reagent/potassium, 15)) owner.reagents.add_reagent(/datum/reagent/potassium, 0.4) if(!CHEM_EFFECT_MAGNITUDE(owner, CE_ANTITOX) && prob(33)) - owner.adjustToxLoss(0.3, FALSE) - . = TRUE + owner.adjustToxLoss(0.3, FALSE, cause_of_death = "Kidney failure") else if(damage > maxHealth * low_threshold) var/datum/reagent/coffee = locate(/datum/reagent/consumable/coffee) in owner.reagents.reagent_list if(coffee) - owner.adjustToxLoss(0.1, FALSE) - . = TRUE + owner.adjustToxLoss(0.1, FALSE, cause_of_death = "Kidney failure") if(!owner.reagents.has_reagent(/datum/reagent/potassium, 5)) owner.reagents.add_reagent(/datum/reagent/potassium, 1) @@ -44,5 +41,5 @@ return if(!CHEM_EFFECT_MAGNITUDE(owner, CE_ANTITOX) && prob(33)) - owner.adjustToxLoss(1, FALSE) + owner.adjustToxLoss(1, FALSE, cause_of_death = "Kidney failure") . = TRUE diff --git a/code/modules/surgery/organs/liver.dm b/code/modules/surgery/organs/liver.dm index 3457f41a06b4..05d4da43cc27 100755 --- a/code/modules/surgery/organs/liver.dm +++ b/code/modules/surgery/organs/liver.dm @@ -88,7 +88,6 @@ //Detox can heal small amounts of damage if (damage < maxHealth && !owner.chem_effects[CE_TOXIN]) applyOrganDamage(-0.2 * owner.chem_effects[CE_ANTITOX], updating_health = FALSE) - . = TRUE // Get the effectiveness of the liver. var/filter_effect = 3 @@ -105,19 +104,16 @@ // If you're not filtering well, you're in trouble. Ammonia buildup to toxic levels and damage from alcohol if(filter_effect < 2) if(owner.chem_effects[CE_ALCOHOL]) - owner.adjustToxLoss(0.5 * max(2 - filter_effect, 0) * (owner.chem_effects[CE_ALCOHOL_TOXIC] + 0.5 * owner.chem_effects[CE_ALCOHOL])) + owner.adjustToxLoss(0.5 * max(2 - filter_effect, 0) * (owner.chem_effects[CE_ALCOHOL_TOXIC] + 0.5 * owner.chem_effects[CE_ALCOHOL]), cause_of_death = "Alcohol poisoning") if(owner.chem_effects[CE_ALCOHOL_TOXIC]) applyOrganDamage(owner.chem_effects[CE_ALCOHOL_TOXIC], updating_health = FALSE) - . = TRUE // Heal a bit if needed and we're not busy. This allows recovery from low amounts of toxloss. if(!owner.chem_effects[CE_ALCOHOL] && !owner.chem_effects[CE_TOXIN] && !HAS_TRAIT(owner, TRAIT_IRRADIATED) && damage > 0) if(damage < low_threshold * maxHealth) applyOrganDamage(-0.3, updating_health = FALSE) - . = TRUE else if(damage < high_threshold * maxHealth) applyOrganDamage(-0.2, updating_health = FALSE) - . = TRUE if(damage > 10 && DT_PROB(damage/4, delta_time)) //the higher the damage the higher the probability to_chat(liver_owner, span_warning("You feel a dull pain in your abdomen.")) @@ -189,8 +185,9 @@ if(. & EMP_PROTECT_SELF) return if(!COOLDOWN_FINISHED(src, severe_cooldown)) //So we cant just spam emp to kill people. - owner.adjustToxLoss(10) + owner.adjustToxLoss(10, cause_of_death = "Faulty prosthetic liver") COOLDOWN_START(src, severe_cooldown, 10 SECONDS) + if(prob(emp_vulnerability/severity)) //Chance of permanent effects organ_flags |= ORGAN_SYNTHETIC_EMP //Starts organ faliure - gonna need replacing soon. diff --git a/code/modules/surgery/organs/stomach/_stomach.dm b/code/modules/surgery/organs/stomach/_stomach.dm index 14bac809bdb0..7395861440e5 100644 --- a/code/modules/surgery/organs/stomach/_stomach.dm +++ b/code/modules/surgery/organs/stomach/_stomach.dm @@ -52,7 +52,7 @@ human_owner.clear_alert(ALERT_NUTRITION) return ..() -/obj/item/organ/stomach/set_organ_dead(failing) +/obj/item/organ/stomach/set_organ_dead(failing, cause_of_death) . = ..() if(!.) return diff --git a/code/modules/unit_tests/bodypart_organ_sanity.dm b/code/modules/unit_tests/bodypart_organ_sanity.dm index b14d96b93b6d..2298fe7aff07 100644 --- a/code/modules/unit_tests/bodypart_organ_sanity.dm +++ b/code/modules/unit_tests/bodypart_organ_sanity.dm @@ -19,10 +19,10 @@ removed_organs += organ for(var/obj/item/organ/organ as anything in removed_organs) - TEST_ASSERT(!(organ in hollow_boy.organs), "Organ '[organ.name] remained inside human after forceMove into nullspace.") - TEST_ASSERT(isnull(organ.loc), "Organ '[organ.name] did not move to nullspace after being forced to.") - TEST_ASSERT(isnull(organ.owner), "Organ '[organ.name] kept reference to human after forceMove into nullspace.") - TEST_ASSERT(isnull(organ.ownerlimb), "Organ '[organ.name] kept reference to bodypart after forceMove into nullspace.") + TEST_ASSERT(!(organ in hollow_boy.organs), "Organ '[organ.name]' remained inside human after forceMove into nullspace.") + TEST_ASSERT(isnull(organ.loc), "Organ '[organ.name]' did not move to nullspace after being forced to.") + TEST_ASSERT(isnull(organ.owner), "Organ '[organ.name]' kept reference to human after forceMove into nullspace.") + TEST_ASSERT(isnull(organ.ownerlimb), "Organ '[organ.name]' kept reference to bodypart after forceMove into nullspace.") for(var/obj/item/bodypart/bodypart as anything in hollow_boy.bodyparts) bodypart = new bodypart.type() //fresh, duplice bodypart with no insides diff --git a/code/modules/wiremod/shell/drone.dm b/code/modules/wiremod/shell/drone.dm index af180036947a..3297752251a2 100644 --- a/code/modules/wiremod/shell/drone.dm +++ b/code/modules/wiremod/shell/drone.dm @@ -17,7 +17,7 @@ new /obj/item/circuit_component/bot_circuit() ), SHELL_CAPACITY_LARGE) -/mob/living/circuit_drone/updatehealth() +/mob/living/circuit_drone/updatehealth(cause_of_death) . = ..() if(health < 0) gib(no_brain = TRUE, no_organs = TRUE, no_bodyparts = TRUE) diff --git a/code/modules/zombie/organs.dm b/code/modules/zombie/organs.dm index 314da15cbdd7..a5da12b748e5 100644 --- a/code/modules/zombie/organs.dm +++ b/code/modules/zombie/organs.dm @@ -51,7 +51,7 @@ if(owner.mob_biotypes & MOB_MINERAL)//does not process in inorganic things return if (causes_damage && !iszombie(owner) && owner.stat != DEAD) - owner.adjustToxLoss(0.5 * delta_time) + owner.adjustToxLoss(0.5 * delta_time, cause_of_death = "Zombie infection") if (DT_PROB(5, delta_time)) to_chat(owner, span_danger("You feel sick...")) if(timer_id)