Skip to content

Commit

Permalink
Dying now shows a cause of death (#1082)
Browse files Browse the repository at this point in the history
* initial build

* death data

* fix hard del

* another harddel fix (lolo try catch)

* verb for cod

* fix compile error

* remove old death message
  • Loading branch information
Kapu1178 committed Aug 27, 2024
1 parent 06c8518 commit f92ab11
Show file tree
Hide file tree
Showing 109 changed files with 625 additions and 242 deletions.
2 changes: 1 addition & 1 deletion code/datums/components/genetic_damage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/diseases/beesease.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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."), \
Expand Down
2 changes: 1 addition & 1 deletion code/datums/diseases/dna_spread.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions code/datums/diseases/flu.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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--
Expand All @@ -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--
Expand Down
2 changes: 1 addition & 1 deletion code/datums/status_effects/debuffs/debuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions code/datums/status_effects/debuffs/drunk.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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*/
Expand Down
12 changes: 12 additions & 0 deletions code/modules/admin/verbs/admingame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions code/modules/antagonists/blob/blob_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/heretic/mobs/maid_in_mirror.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/morph/morph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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--"))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/revenant/revenant.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/revenant/revenant_abilities.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/revenant/revenant_blight.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/awaymissions/mission_code/snowdin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/cargo/gondolapod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
..()
4 changes: 2 additions & 2 deletions code/modules/events/spacevine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/basic/basic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/basic/basic_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/basic/health_adjustment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/basic/vermin/cockroach.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
..()
Expand Down
22 changes: 11 additions & 11 deletions code/modules/mob/living/brain/brain_item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand All @@ -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.")
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/brain/death.dm
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/brain/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/alien/damage_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/alien/humanoid/death.dm
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/alien/larva/death.dm
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Loading

0 comments on commit f92ab11

Please sign in to comment.