From ddac27ccc51802b26f2e758d85c539b3be8ed9e8 Mon Sep 17 00:00:00 2001
From: Seris02 <49109742+Seris02@users.noreply.github.com>
Date: Thu, 12 Aug 2021 13:54:48 +0800
Subject: [PATCH] stops dchat clog from clientless mobs (#60772)
bug fix, because obviously the user.client check in the emote proc was supposed to work for this, but they forgot to put it in manual_emote as well.
also moved the user.client check in the emote proc a few lines above, for sliiiightly better performance, ghosts will still get the message from visible_message, but only if nearby, so it has the same effect as where it was before.
---
code/datums/emotes.dm | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/code/datums/emotes.dm b/code/datums/emotes.dm
index a871f217802..d05c9e4a814 100644
--- a/code/datums/emotes.dm
+++ b/code/datums/emotes.dm
@@ -114,11 +114,12 @@
playsound(user, tmp_sound, 50, vary)
var/user_turf = get_turf(user)
- for(var/mob/ghost in GLOB.dead_mob_list)
- if(!ghost.client || isnewplayer(ghost))
- continue
- if(ghost.stat == DEAD && ghost.client && user.client && (ghost.client.prefs.chat_toggles & CHAT_GHOSTSIGHT) && !(ghost in viewers(user_turf, null)))
- ghost.show_message("[FOLLOW_LINK(ghost, user)] [dchatmsg]")
+ if (user.client)
+ for(var/mob/ghost as anything in GLOB.dead_mob_list)
+ if(!ghost.client || isnewplayer(ghost))
+ continue
+ if(ghost.client.prefs.chat_toggles & CHAT_GHOSTSIGHT && !(ghost in viewers(user_turf, null)))
+ ghost.show_message("[FOLLOW_LINK(ghost, user)] [dchatmsg]")
if(emote_type == EMOTE_AUDIBLE)
user.audible_message(msg, deaf_message = "You see how [user] [msg]", audible_message_flags = EMOTE_MESSAGE)
@@ -283,10 +284,11 @@
var/ghost_text = "[src] [text]"
var/origin_turf = get_turf(src)
- for(var/mob/ghost in GLOB.dead_mob_list)
- if(!ghost.client || isnewplayer(ghost))
- continue
- if(ghost.stat == DEAD && ghost.client && (ghost.client.prefs.chat_toggles & CHAT_GHOSTSIGHT) && !(ghost in viewers(origin_turf, null)))
- ghost.show_message("[FOLLOW_LINK(ghost, src)] [ghost_text]")
+ if(client)
+ for(var/mob/ghost as anything in GLOB.dead_mob_list)
+ if(!ghost.client || isnewplayer(ghost))
+ continue
+ if(ghost.client.prefs.chat_toggles & CHAT_GHOSTSIGHT && !(ghost in viewers(origin_turf, null)))
+ ghost.show_message("[FOLLOW_LINK(ghost, src)] [ghost_text]")
visible_message(text, visible_message_flags = EMOTE_MESSAGE)