diff --git a/code/_helpers/game.dm b/code/_helpers/game.dm index 52fca32e175..c16abc8a45b 100644 --- a/code/_helpers/game.dm +++ b/code/_helpers/game.dm @@ -195,41 +195,31 @@ DVIEW(hear, range, T, INVISIBILITY_MAXIMUM) var/list/hearturfs = list() - for(var/am in hear) - var/atom/movable/AM = am - if (!AM.loc) - continue + if(islist(mobs)) + for(var/mob/M in hear) + mobs[M] = TRUE + hearturfs[get_turf(M)] = TRUE - var/turf/AM_turf = get_turf(AM) - - if(ismob(AM)) - mobs[AM] = TRUE - hearturfs[AM_turf] = TRUE - else if(isobj(AM)) - objs[AM] = TRUE - hearturfs[AM_turf] = TRUE - - for(var/m in player_list) - var/mob/M = m - if(istype(M, /mob/living/test)) - if (!mobs[M]) + for(var/mob/M in player_list) +#ifdef UNIT_TEST + if(istype(M, /mob/living/test)) mobs[M] = TRUE - continue - if(checkghosts == GHOSTS_ALL_HEAR && M.stat == DEAD && !isnewplayer(M) && (M.client && M.client.prefs.toggles & CHAT_GHOSTEARS)) - if (!mobs[M]) + continue +#endif + if(checkghosts == GHOSTS_ALL_HEAR && M.stat == DEAD && !isnewplayer(M) && (M.client && M.client.prefs.toggles & CHAT_GHOSTEARS)) mobs[M] = TRUE - continue + continue - var/turf/M_turf = get_turf(M) - if(M.loc && hearturfs[M_turf]) - if (!mobs[M]) + if(M.loc && hearturfs[get_turf(M)]) mobs[M] = TRUE - for(var/o in listening_objects) - var/obj/O = o - var/turf/O_turf = get_turf(O) - if(O && O.loc && hearturfs[O_turf]) - if (!objs[O]) + if(islist(objs)) + for(var/obj/O in hear) + objs[O] = TRUE + hearturfs[get_turf(O)] = TRUE + + for(var/obj/O in listening_objects) + if(O.loc && hearturfs[get_turf(O)]) objs[O] = TRUE proc diff --git a/code/game/atoms.dm b/code/game/atoms.dm index b664d94eb81..f83c616c259 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -576,7 +576,7 @@ M.show_message(blind_message, 2) if(intent_message) - intent_message(intent_message, intent_range) + intent_message(intent_message, intent_range, mobs) // pass our mobs list through to intent_message so it doesn't have to call get_mobs_or_objs_in_view again // Show a message to all mobs and objects in earshot of this atom. // Use for objects performing audible actions. @@ -601,15 +601,14 @@ O.show_message(message,2,deaf_message,1) if(intent_message) - intent_message(intent_message, intent_range) + intent_message(intent_message, intent_range, mobs) // pass our mobs list through to intent_message so it doesn't have to call get_mobs_or_objs_in_view again -/atom/proc/intent_message(var/message, var/range = 7) +/atom/proc/intent_message(var/message, var/range = 7, var/list/mobs = list()) set waitfor = FALSE if(air_sound(src)) var/turf/T = get_turf(src) - var/list/mobs = list() - var/list/objs = list() - get_mobs_or_objs_in_view(T, range, mobs, objs, ONLY_GHOSTS_IN_VIEW) + if(!mobs.len) + get_mobs_or_objs_in_view(T, range, mobs, checkghosts = ONLY_GHOSTS_IN_VIEW) for(var/mob/living/carbon/human/H as anything in intent_listener) if(!(H in mobs)) if(src.z == H.z && get_dist(src, H) <= range) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 89ff8f7978c..e55da9f390e 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -153,7 +153,7 @@ O.see_emote(src, message) if(intent_message) - intent_message(intent_message, intent_range) + intent_message(intent_message, intent_range, messagemobs) // Designed for mobs contained inside things, where a normal visible message wont actually be visible // Useful for visible actions by pAIs, and held mobs @@ -343,7 +343,7 @@ /mob/living/simple_animal/borer/can_examine() . = ..() if(!. && iscarbon(loc) && isturf(loc.loc)) // We're inside someone, let us examine still. - return TRUE + return TRUE /mob/var/obj/effect/decal/point/pointing_effect = null//Spam control, can only point when the previous pointer qdels