From e63b2eea56065e66fdcfe13b02e4bc1166fccdb5 Mon Sep 17 00:00:00 2001
From: Contrabang <91113370+Contrabang@users.noreply.github.com>
Date: Mon, 25 Nov 2024 13:38:38 -0500
Subject: [PATCH] Deadchat now has runechat (#27366)
* Deadchat now has runechat
* invisible gone, welcome viewers
* cached viewers
* botch
* im dumb
---
code/__DEFINES/misc_defines.dm | 1 +
code/datums/chatmessage.dm | 3 +++
code/modules/mob/mob_misc_procs.dm | 6 +++++-
code/modules/mob/mob_say_base.dm | 4 ++--
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/code/__DEFINES/misc_defines.dm b/code/__DEFINES/misc_defines.dm
index ccc3f766950..1a1e5967a79 100644
--- a/code/__DEFINES/misc_defines.dm
+++ b/code/__DEFINES/misc_defines.dm
@@ -550,6 +550,7 @@
// Runechat symbol types
#define RUNECHAT_SYMBOL_EMOTE 1
#define RUNECHAT_SYMBOL_LOOC 2
+#define RUNECHAT_SYMBOL_DEAD 3
/// Waits at a line of code until X is true
#define UNTIL(X) while(!(X)) sleep(world.tick_lag)
diff --git a/code/datums/chatmessage.dm b/code/datums/chatmessage.dm
index 46852784a0f..8108bf3f430 100644
--- a/code/datums/chatmessage.dm
+++ b/code/datums/chatmessage.dm
@@ -137,6 +137,9 @@
symbol = "\[LOOC] "
size ||= "small"
output_color = "gray"
+ if(RUNECHAT_SYMBOL_DEAD)
+ symbol = null
+ output_color = "#b826b3"
else
symbol = null
diff --git a/code/modules/mob/mob_misc_procs.dm b/code/modules/mob/mob_misc_procs.dm
index c8226c08b14..9412c112aac 100644
--- a/code/modules/mob/mob_misc_procs.dm
+++ b/code/modules/mob/mob_misc_procs.dm
@@ -513,7 +513,7 @@
//Direct dead say used both by emote and say
//It is somewhat messy. I don't know what to do.
//I know you can't see the change, but I rewrote the name code. It is significantly less messy now
-/proc/say_dead_direct(message, mob/subject = null)
+/proc/say_dead_direct(message, mob/subject, raw_message)
var/name
var/keyname
if(subject && subject.client)
@@ -534,6 +534,8 @@
for(var/obj/item/radio/deadsay_radio_system as anything in GLOB.deadsay_radio_systems)
deadsay_radio_system.attempt_send_deadsay_message(subject, message)
+ var/should_show_runechat = (subject && raw_message && !subject.orbiting_uid)
+
for(var/mob/M in GLOB.player_list)
if(M.client && ((!isnewplayer(M) && M.stat == DEAD) || check_rights(R_ADMIN|R_MOD,0,M) || istype(M, /mob/living/simple_animal/revenant)) && M.get_preference(PREFTOGGLE_CHAT_DEAD))
var/follow
@@ -558,6 +560,8 @@
lname = name
lname = "[lname] "
to_chat(M, "[lname][follow][message]")
+ if(should_show_runechat && (M.client?.prefs.toggles2 & PREFTOGGLE_2_RUNECHAT) && M.see_invisible >= subject.invisibility)
+ M.create_chat_message(subject, raw_message, symbol = RUNECHAT_SYMBOL_DEAD)
/proc/notify_ghosts(message, ghost_sound = null, enter_link = null, title = null, atom/source = null, image/alert_overlay = null, flashwindow = TRUE, action = NOTIFY_JUMP, role = null) //Easy notification of ghosts.
for(var/mob/O in GLOB.player_list)
diff --git a/code/modules/mob/mob_say_base.dm b/code/modules/mob/mob_say_base.dm
index 6b193b3fe96..ddb279e0ac9 100644
--- a/code/modules/mob/mob_say_base.dm
+++ b/code/modules/mob/mob_say_base.dm
@@ -65,13 +65,13 @@
create_log(DEADCHAT_LOG, message)
return
- say_dead_direct("[pick("complains", "moans", "whines", "laments", "blubbers", "salts", "copes", "seethes", "malds")], \"[message]\"", src)
+ say_dead_direct("[pick("complains", "moans", "whines", "laments", "blubbers", "salts", "copes", "seethes", "malds")], \"[message]\"", src, raw_message=message)
create_log(DEADCHAT_LOG, message)
log_ghostsay(message, src)
/**
* Checks if the mob can understand the other speaker
- *
+ *
* If it return FALSE, then the message will have some letters replaced with stars from the heard message
*/
/mob/proc/say_understands(atom/movable/other, datum/language/speaking = null)