From 29775ff70d8949ff4910b26ef5897857aba0cfe4 Mon Sep 17 00:00:00 2001 From: SoundScopes Date: Mon, 8 Dec 2014 07:55:56 +0000 Subject: [PATCH] Whisper snooping for ghosts Todo: Fix the double message when observing the character directly. --- .../mob/living/carbon/human/whisper.dm | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/code/modules/mob/living/carbon/human/whisper.dm b/code/modules/mob/living/carbon/human/whisper.dm index c77bef27..20c6f491 100644 --- a/code/modules/mob/living/carbon/human/whisper.dm +++ b/code/modules/mob/living/carbon/human/whisper.dm @@ -5,7 +5,7 @@ if(say_disabled) //This is here to try to identify lag problems usr << "\red Speech is currently admin-disabled." return - + log_whisper("[src.name]/[src.key] : [message]") if (src.client) @@ -21,17 +21,17 @@ if (src.stat) return - + message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN)) //made consistent with say if(name != GetVoice()) alt_name = "(as [get_id_name("Unknown")])" - + //parse the language code and consume it var/datum/language/speaking = parse_language(message) if (speaking) message = copytext(message,3) - + whisper_say(message, speaking, alt_name) @@ -42,15 +42,18 @@ var/watching_range = 5 var/italics = 1 + if(speaking && speaking.flags & SIGNLANG) // You can't whisper sign language yet that's silly + return + if (speaking) verb = speaking.speech_verb + pick(" quietly", " softly") - + message = capitalize(trim(message)) - + //TODO: handle_speech_problems for silent if (!message || silent || miming) return - + // Mute disability //TODO: handle_speech_problems if (src.sdisabilities & MUTE) @@ -86,20 +89,23 @@ var/list/listening = hearers(message_range, src) listening |= src - + //ghosts - for (var/mob/M in dead_mob_list) //does this include players who joined as observers as well? + for (var/mob/M in player_list) //does this include players who joined as observers as well? No it doesn't. + if(istype(M, /mob/new_player)) + continue if (!(M.client)) continue if(M.stat == DEAD && M.client && (M.client.prefs.toggles & CHAT_GHOSTEARS)) - listening |= M - + //listening |= M + M.hear_say(message, verb, speaking, alt_name, italics, src) + //Pass whispers on to anything inside the immediate listeners. for(var/mob/L in listening) for(var/mob/C in L.contents) if(istype(C,/mob/living)) listening += C - + //pass on the message to objects that can hear us. for (var/obj/O in view(message_range, src)) spawn (0) @@ -119,17 +125,17 @@ var/speech_bubble_test = say_test(message) var/image/speech_bubble = image('icons/mob/talk.dmi',src,"h[speech_bubble_test]") spawn(30) del(speech_bubble) - + for(var/mob/M in listening) M << speech_bubble M.hear_say(message, verb, speaking, alt_name, italics, src) - + if (eavesdropping.len) var/new_message = stars(message) //hopefully passing the message twice through stars() won't hurt... I guess if you already don't understand the language, when they speak it too quietly to hear normally you would be able to catch even less. for(var/mob/M in eavesdropping) M << speech_bubble M.hear_say(new_message, verb, speaking, alt_name, italics, src) - + if (watching.len) var/rendered = "[src.name] whispers something." for (var/mob/M in watching)