"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>
This commit is contained in:
Luc
2023-12-16 16:12:08 +00:00
committed by GitHub
co-authored by Ryan
parent 4f9b62316e
commit 6d9018ad42
+29 -12
View File
@@ -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, "<span class='warning'>You are unable to succumb to death! This life continues!</span>")
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, "<span class='notice'>You have given up life and succumbed to death.</span>")
to_chat(src, "<span class='notice'>You have given up life and succumbed to death.</span>")
/mob/living/proc/InCritical()