From 6d9018ad422cfc5ee6e9ceedfcc570414375642d Mon Sep 17 00:00:00 2001
From: Luc <89928798+lewcc@users.noreply.github.com>
Date: Sat, 16 Dec 2023 11:12:08 -0500
Subject: [PATCH] "You'll find all my treasure in one place..." -- Adds
optional last words whispered when succumbing (#23441)
* Allows for final words when succumbing
* slightly rework input
* oops
* moment
* better logic
* prevent the dead from speaking
* Update code/modules/mob/living/living.dm
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
---------
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
---
code/modules/mob/living/living.dm | 41 ++++++++++++++++++++++---------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index b84208fba69..bbed15a5c3d 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -290,19 +290,36 @@
return TRUE
/mob/living/verb/succumb()
- set hidden = 1
- if(InCritical())
- create_attack_log("[src] has ["succumbed to death"] with [round(health, 0.1)] points of health!")
- create_log(MISC_LOG, "has succumbed to death with [round(health, 0.1)] points of health")
- adjustOxyLoss(health - HEALTH_THRESHOLD_DEAD)
- // super check for weird mobs, including ones that adjust hp
- // we don't want to go overboard and gib them, though
- for(var/i = 1 to 5)
- if(health < HEALTH_THRESHOLD_DEAD)
- break
- take_overall_damage(max(5, health - HEALTH_THRESHOLD_DEAD), 0)
+ set hidden = TRUE
+ if(health >= HEALTH_THRESHOLD_CRIT || stat != UNCONSCIOUS)
+ to_chat(src, "You are unable to succumb to death! This life continues!")
+ return
+
+ var/last_words = input(src, "Do you have any last words?", "Goodnight, Sweet Prince") as text|null
+
+ if(stat == DEAD)
+ // cancel em out if they died while they had the message box up
+ last_words = null
+
+ if(!isnull(last_words))
+ create_log(MISC_LOG, "gave their final words, [last_words]")
+ whisper(last_words)
+
+ add_attack_logs(src, src, "[src] has [!isnull(last_words) ? "whispered [p_their()] final words" : "succumbed to death"] with [round(health, 0.1)] points of health!")
+
+ create_log(MISC_LOG, "has succumbed to death with [round(health, 0.1)] points of health")
+ adjustOxyLoss(max(health - HEALTH_THRESHOLD_DEAD, 0))
+ // super check for weird mobs, including ones that adjust hp
+ // we don't want to go overboard and gib them, though
+ for(var/i in 1 to 5)
+ if(health < HEALTH_THRESHOLD_DEAD)
+ break
+ take_overall_damage(max(5, health - HEALTH_THRESHOLD_DEAD), 0)
+ if(!isnull(last_words))
+ addtimer(CALLBACK(src, PROC_REF(death)), 1 SECONDS)
+ else
death()
- to_chat(src, "You have given up life and succumbed to death.")
+ to_chat(src, "You have given up life and succumbed to death.")
/mob/living/proc/InCritical()