Clientless simple mobs no longer spams observers (#28694)

* Clientless simple mobs no longer spams observers

* wrong var name but it's basically the same code
This commit is contained in:
ShiftyRail
2021-01-28 12:01:04 +01:00
committed by GitHub
parent 1bbde3178d
commit 894f52143a
2 changed files with 21 additions and 9 deletions

View File

@@ -56,19 +56,25 @@
var/msg_runechat = msg
msg = "<b>[user]</b> " + msg
for(var/mob/M in dead_mob_list)
if(!M.client || isnewplayer(M))
continue
var/T = get_turf(user)
if(isobserver(M) && M.client && (M.client.prefs.toggles & CHAT_GHOSTSIGHT) && !(M in viewers(T)))
M.show_message("<a href='?src=\ref[M];follow=\ref[user]'>(Follow)</a> " + msg)
if (user.client && M?.client?.prefs.mob_chat_on_map && get_dist(M, user) < M?.client.view)
M.create_chat_message(user, null, msg_runechat, "", list("italics"))
var/obs_pass = TRUE
// Don't hear simple mobs without a client.
if (istype(user, /mob/living/simple_animal) && !user.client)
obs_pass = FALSE
if (obs_pass)
for(var/mob/M in dead_mob_list)
if(!M.client || isnewplayer(M))
continue
var/T = get_turf(user)
if(isobserver(M) && M.client && (M.client.prefs.toggles & CHAT_GHOSTSIGHT) && !(M in viewers(T)))
M.show_message("<a href='?src=\ref[M];follow=\ref[user]'>(Follow)</a> " + msg)
if (user.client && M?.client?.prefs.mob_chat_on_map && get_dist(M, user) < M?.client.view)
M.create_chat_message(user, null, msg_runechat, "", list("italics"))
if (emote_type == EMOTE_VISIBLE)
user.visible_message(msg)
for (var/mob/O in viewers(world.view, user))
if (user.client && O?.client?.prefs.mob_chat_on_map && O.stat != UNCONSCIOUS && !(isinvisible(user)))
if (user.client && O?.client?.prefs.mob_chat_on_map && O.stat != UNCONSCIOUS && !(isinvisible(user)))
O.create_chat_message(user, null, msg_runechat, "", list("italics"))
else
for(var/mob/O in get_hearers_in_view(world.view, user))

View File

@@ -31,6 +31,12 @@
var/source = speech.speaker.GetSource()
var/source_turf = get_turf(source)
// Don't hear simple mobs without a client.
if (istype(source, /mob/living/simple_animal) && (get_dist(source_turf, src) > get_view_range()))
var/mob/living/simple_animal/animal = source
if (!animal.client)
return
say_testing(src, "/mob/dead/observer/Hear(): source=[source], frequency=[speech.frequency], source_turf=[formatJumpTo(source_turf)]")
if (get_dist(source_turf, src) <= get_view_range())