Adds an action button for succumbing, broadcasts last words (#24501)

* succumb

* Apply suggestions from code review

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

* capitalize

* clear the alert, and no more last words when you're already dead!

* Update code/modules/mob/living/death.dm

---------

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
This commit is contained in:
Luc
2024-03-16 16:13:30 +00:00
committed by GitHub
co-authored by DGamerL
parent dcb0167ce8
commit a65809e32f
7 changed files with 42 additions and 0 deletions
+14
View File
@@ -817,3 +817,17 @@ so as to remain in compliance with the most up-to-date laws."
master = null
screen_loc = ""
return ..()
/// Gives the player the option to succumb while in critical condition
/atom/movable/screen/alert/succumb
name = "Succumb"
desc = "Shuffle off this mortal coil."
icon_state = "succumb"
/atom/movable/screen/alert/succumb/Click()
if(!usr || !usr.client)
return
var/mob/living/living_owner = usr
if(!istype(usr))
return
living_owner.do_succumb(TRUE)
@@ -662,6 +662,11 @@
healthdoll.overlays -= (cached_overlays - new_overlays)
healthdoll.cached_healthdoll_overlays = new_overlays
if(health <= HEALTH_THRESHOLD_CRIT)
throw_alert("succumb", /atom/movable/screen/alert/succumb)
else
clear_alert("succumb")
#undef BODYPART_PAIN_REDUCTION
/mob/living/carbon/human/proc/handle_nutrition_alerts() //This is a terrible abuse of the alert system; something like this should be a HUD element
+4
View File
@@ -87,10 +87,14 @@
var/mob/M = P
if((M.client?.prefs.toggles2 & PREFTOGGLE_2_DEATHMESSAGE) && (isobserver(M) || M.stat == DEAD))
to_chat(M, "<span class='deadsay'><b>[mind.name]</b> has died at <b>[area_name]</b>. (<a href='?src=[M.UID()];jump=\ref[T]'>JMP</a>)</span>")
if(last_words)
to_chat(M, "<span class='deadsay'><b>[p_their(TRUE)] last words were:</b> \"[last_words]\"</span>")
if(SSticker && SSticker.mode)
SSticker.mode.check_win()
clear_alert("succumb")
// u no we dead
return TRUE
+12
View File
@@ -291,18 +291,30 @@
/mob/living/verb/succumb()
set hidden = TRUE
// if you use the verb you better mean it
do_succumb(FALSE)
/mob/living/proc/do_succumb(cancel_on_no_words)
if(stat == DEAD)
to_chat(src, "<span class='notice'>It's too late, you're already dead!</span>")
return
if(health >= HEALTH_THRESHOLD_CRIT)
to_chat(src, "<span class='warning'>You are unable to succumb to death! This life continues!</span>")
return
var/last_words = tgui_input_text(src, "Do you have any last words?", "Goodnight, Sweet Prince", encode = FALSE)
if(isnull(last_words) && cancel_on_no_words)
to_chat(src, "<span class='notice'>You decide you aren't quite ready to die.</span>")
return
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]")
src.last_words = last_words // sorry
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!")
@@ -97,6 +97,9 @@
var/datum/middleClickOverride/middleClickOverride = null
/// Famous last words -- if succumbing, what the user's last words were
var/last_words
/*
Taste Vars
*/
+4
View File
@@ -176,3 +176,7 @@
overlay_fullscreen("brute", /atom/movable/screen/fullscreen/brute, severity)
else
clear_fullscreen("brute")
if(health <= HEALTH_THRESHOLD_CRIT)
throw_alert("succumb", /atom/movable/screen/alert/succumb)
else
clear_alert("succumb")
Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB