Ghosts can now hear whispers (#16878)

This commit is contained in:
Doxxmedearly
2023-07-25 19:16:20 +00:00
committed by GitHub
parent 7d65e5f8e9
commit b79d4ace32
4 changed files with 26 additions and 21 deletions
-2
View File
@@ -48,8 +48,6 @@
var/track = null
if(isobserver(src))
if(italics && client.prefs.toggles & CHAT_GHOSTRADIO)
return
if(speaker_name != speaker.real_name && speaker.real_name)
speaker_name = "[speaker.real_name] ([speaker_name])"
track = "[ghost_follow_link(speaker, src)] "
+4 -2
View File
@@ -285,7 +285,7 @@ var/list/channel_to_radio_key = new
//speaking into radios
if(length(used_radios))
italics = 1
italics = TRUE
message_range = 1
if(speaking)
message_range = speaking.get_talkinto_msg_range(message)
@@ -312,7 +312,7 @@ var/list/channel_to_radio_key = new
message_range = 1
if (pressure < ONE_ATMOSPHERE*0.4) //sound distortion pressure, to help clue people in that the air is thin, even if it isn't a vacuum yet
italics = 1
italics = TRUE
sound_vol *= 0.5 //muffle the sound a bit, so it's like we're actually talking through contact
listening = get_hearers_in_view(message_range, src)
@@ -321,6 +321,8 @@ var/list/channel_to_radio_key = new
for (var/mob/player_mob in player_list)
if(!player_mob || player_mob.stat != DEAD || (player_mob in listening))
continue
if(player_mob.client?.prefs.toggles & CHAT_GHOSTRADIO && length(used_radios)) //If they are talking into a radio and we hear all radio messages, don't duplicate for observers
continue
if(player_mob.client?.prefs.toggles & CHAT_GHOSTEARS)
listening |= player_mob
+18 -17
View File
@@ -56,29 +56,30 @@
whisper_text = "[speak_text] [adverb]"
not_heard = "[speak_text] something [adverb]"
var/list/listening = list(src)
//ghosts
for(var/mob/M in dead_mob_list)
if(M.stat == DEAD && M.client && (M.client.prefs.toggles & CHAT_GHOSTEARS))
listening |= M
//Pass whispers on to anything inside the immediate listeners.
for(var/mob/L in listening)
for(var/mob/living/C in L.contents)
listening += C
//Check to see who hears the full whisper message, and who just gets the not_heard message
var/list/eavesdropping = list()
var/list/watching = list()
var/list/observers = list()
var/list/all_in_range = hearers(watching_range, src)
for(var/mob/M as anything in all_in_range)
if(get_dist(src, M) <= message_range)
listening |= M
if(M.stat == DEAD && M.client && (M.client.prefs.toggles & CHAT_GHOSTEARS)) //Preventing duplicate messages to ghostear'd observers
continue
if(get_dist(src, M) <= message_range) //In range to hear
continue
else if(get_dist(src, M) <= eavesdropping_range)
eavesdropping += M
if(M.stat == DEAD && M.client)
observers += M
else
eavesdropping += M
else if(get_dist(src, M) <= watching_range)
watching += M
if(M.stat == DEAD && M.client)
observers += M
else
watching += M
if(length(observers)) //For ghosts who do NOT have ghost ears. They will see the whole message if nearby, no *s or not_heard messages.
for(var/mob/M in observers)
M.hear_say(message, "whispers", speaking, "", TRUE, src)
if(length(eavesdropping))
var/new_message = stars(message)