Ghosts now have (better) runechat (#95843)

## About The Pull Request

Ports our optimizations to the version of ghost runechat introduced by
https://github.com/tgstation/tgstation/pull/95223

Instead of looping through all the mobs a second time it will do it in
deadchat_broadcast(). Also adds a global for if drunechat is
enabled/disabled and an admin verb for toggling it on or off.

<details><summary>still works</summary>

<img width="330" height="220" alt="dreamseeker_kkNBPBjbMv"
src="https://github.com/user-attachments/assets/4706ad98-fafe-4f88-9de0-6b72983ab044"
/>

</details>

## Why It's Good For The Game

Better option for performance

## Changelog

🆑
code: speeds ghost runechat up a bit, and makes it show as italic
admin: adds a 'toggle dead runechat' admin verb in case you need to
disable it midround for an event or something
/🆑
This commit is contained in:
Bloop
2026-05-05 14:54:04 -04:00
committed by GitHub
parent 5da29c311b
commit faaa1f1516
6 changed files with 21 additions and 14 deletions
+15 -5
View File
@@ -363,9 +363,11 @@ GLOBAL_LIST_INIT(skin_tone_names, list(
return spawned_mobs
#define SEE_DEADCHAT_ADMIN (1<<0)
#define SEE_DEADCHAT_NORMAL (1<<1)
// Displays a message in deadchat, sent by source. source is not linkified, message is, to avoid stuff like character names to be linkified.
// Automatically gives the class deadsay to the whole message (message + source)
/proc/deadchat_broadcast(message, source=null, mob/follow_target=null, turf/turf_target=null, speaker_key=null, message_type=DEADCHAT_REGULAR, admin_only=FALSE)
/proc/deadchat_broadcast(message, source=null, mob/follow_target=null, turf/turf_target=null, speaker_key=null, message_type=DEADCHAT_REGULAR, admin_only=FALSE, original_message)
message = span_deadsay("[source][span_linkify(message)]")
if(admin_only)
@@ -383,13 +385,13 @@ GLOBAL_LIST_INIT(skin_tone_names, list(
if(admin_only)
if(!M.client?.holder)
continue
var/override = FALSE
var/override = NONE
if(M.client?.holder && (chat_toggles & CHAT_DEAD))
override = TRUE
override = SEE_DEADCHAT_ADMIN
if(HAS_TRAIT(M, TRAIT_SIXTHSENSE) && message_type == DEADCHAT_REGULAR)
override = TRUE
override = SEE_DEADCHAT_NORMAL
if(SSticker.current_state == GAME_STATE_FINISHED)
override = TRUE
override = SEE_DEADCHAT_NORMAL
if(isnewplayer(M) && !override)
continue
if(M.stat != DEAD && !override)
@@ -413,6 +415,7 @@ GLOBAL_LIST_INIT(skin_tone_names, list(
if(isobserver(M))
var/rendered_message = message
override = SEE_DEADCHAT_NORMAL
if(follow_target)
var/F
@@ -429,6 +432,13 @@ GLOBAL_LIST_INIT(skin_tone_names, list(
else
to_chat(M, message, avoid_highlighting = speaker_key == M.key)
// Ghost runechat
if(original_message && ((override & SEE_DEADCHAT_NORMAL) || M.see_invisible >= follow_target.invisibility) && (!SSlag_switch.measures[DISABLE_DEAD_RUNECHAT] || HAS_TRAIT(M, TRAIT_BYPASS_MEASURES)) && M.runechat_prefs_check(M))
M.create_chat_message(follow_target, /datum/language/common, original_message, list(SPAN_ITALICS))
#undef SEE_DEADCHAT_ADMIN
#undef SEE_DEADCHAT_NORMAL
//Used in chemical_mob_spawn. Generates a random mob based on a given gold_core_spawnable value.
/proc/create_random_mob(spawn_location, mob_class = HOSTILE_SPAWN)
var/static/list/mob_spawn_meancritters = list() // list of possible hostile mobs