Adds a notification in dchat when a player dies (#14946)

* Death Note

* Adds a preference

* Probably should've done this

* Changed the list and shuffled some stuff around
This commit is contained in:
SabreML
2020-11-24 20:12:24 +00:00
committed by GitHub
parent 674a53e1b0
commit 40c4476ec1
3 changed files with 20 additions and 3 deletions
+3 -2
View File
@@ -49,10 +49,11 @@
#define PREFTOGGLE_2_ANONDCHAT 16
#define PREFTOGGLE_2_AFKWATCH 32
#define PREFTOGGLE_2_RUNECHAT 64
#define PREFTOGGLE_2_DEATHMESSAGE 128
#define TOGGLES_2_TOTAL 127 // If you add or remove a preference toggle above, make sure you update this define with the total value of the toggles combined.
#define TOGGLES_2_TOTAL 255 // If you add or remove a preference toggle above, make sure you update this define with the total value of the toggles combined.
#define TOGGLES_2_DEFAULT (PREFTOGGLE_2_FANCYUI|PREFTOGGLE_2_ITEMATTACK|PREFTOGGLE_2_WINDOWFLASHING|PREFTOGGLE_2_RUNECHAT)
#define TOGGLES_2_DEFAULT (PREFTOGGLE_2_FANCYUI|PREFTOGGLE_2_ITEMATTACK|PREFTOGGLE_2_WINDOWFLASHING|PREFTOGGLE_2_RUNECHAT|PREFTOGGLE_2_DEATHMESSAGE)
// Sanity checks
#if TOGGLES_TOTAL > 16777215
@@ -293,7 +293,7 @@
/client/verb/toggle_ghost_pda()
set name = "Show/Hide GhostPDA"
set category = "Preferences"
set desc = ".Toggle seeing PDA messages as an observer."
set desc = "Toggle seeing PDA messages as an observer."
prefs.toggles ^= PREFTOGGLE_CHAT_GHOSTPDA
to_chat(src, "As a ghost, you will now [(prefs.toggles & PREFTOGGLE_CHAT_GHOSTPDA) ? "see all PDA messages" : "no longer see PDA messages"].")
prefs.save_preferences(src)
@@ -314,3 +314,11 @@
prefs.toggles2 ^= PREFTOGGLE_2_RUNECHAT
prefs.save_preferences(src)
to_chat(src, "You will [(prefs.toggles2 & PREFTOGGLE_2_RUNECHAT) ? "now see" : "no longer see"] floating chat messages.")
/client/verb/toggle_death_messages()
set name = "Show/Hide Death Notifications"
set category = "Preferences"
set desc = "Toggle player death notifications"
prefs.toggles2 ^= PREFTOGGLE_2_DEATHMESSAGE
prefs.save_preferences(src)
to_chat(src, "You will [(prefs.toggles2 & PREFTOGGLE_2_DEATHMESSAGE) ? "now" : "no longer"] see a notification in deadchat when a player dies.")
+8
View File
@@ -94,6 +94,14 @@
mind.store_memory("Time of death: [station_time_timestamp("hh:mm:ss", timeofdeath)]", 0)
GLOB.respawnable_list += src
if(mind.name && !isbrain(src)) // !isbrain() is to stop it from being called twice
var/turf/T = get_turf(src)
var/area_name = get_area_name(T)
for(var/P in GLOB.dead_mob_list)
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[src]'>JMP</a>)</span>")
if(SSticker && SSticker.mode)
SSticker.mode.check_win()
if(mind && mind.devilinfo) // Expand this into a general-purpose death-response system when appropriate