Whisper snooping for ghosts

Todo: Fix the double message when observing the character directly.
This commit is contained in:
SoundScopes
2014-12-08 07:55:56 +00:00
parent c50177ff93
commit 29775ff70d
+21 -15
View File
@@ -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 = "<span class='game say'><span class='name'>[src.name]</span> whispers something.</span>"
for (var/mob/M in watching)