From 7f8d0cd59b1add2ed3bb158bb011a20971ced295 Mon Sep 17 00:00:00 2001 From: "giacomand@gmail.com" Date: Tue, 14 Aug 2012 18:09:52 +0000 Subject: [PATCH] -I found the bug. Apparently view also gets the area that you are in and I wasn't accounting for it. I've made it so that the atom has to be an object or a mob before it will recursively check them. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4405 316c924e-a436-60f5-8080-3fe189b3f50e --- code/defines/procs/gamehelpers.dm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/code/defines/procs/gamehelpers.dm b/code/defines/procs/gamehelpers.dm index 887a27b420a..1490e73a25f 100644 --- a/code/defines/procs/gamehelpers.dm +++ b/code/defines/procs/gamehelpers.dm @@ -144,9 +144,8 @@ //debug_mob += O.contents.len if(!recursion_limit) return L - for(var/atom/A in O) - if(isturf(A)) - continue + for(var/atom/A in O.contents) + if(ismob(A)) var/mob/M = A if(client_check && !M.client) @@ -161,7 +160,9 @@ if(sight_check && !isInSight(A, O)) continue L |= A - L = recursive_mob_check(A, L, recursion_limit - 1, client_check, sight_check, include_radio) + + if(isobj(A) || ismob(A)) + L = recursive_mob_check(A, L, recursion_limit - 1, client_check, sight_check, include_radio) return L // The old system would loop through lists for a total of 5000 per function call, in an empty server. @@ -174,17 +175,17 @@ var/list/hear = list() var/list/range = hear(R, T) - for(var/A in range) - if(isturf(A) || A == source) - continue + for(var/atom/A in range) if(ismob(A)) var/mob/M = A if(M.client) - hear |= M + hear += M //world.log << "Start = [M] - [get_turf(M)] - ([M.x], [M.y], [M.z])" else if(istype(A, /obj/item/device/radio)) - hear |= A - hear = recursive_mob_check(A, hear, 3, 1, 0, 1) + hear += A + + if(isobj(A) || ismob(A)) + hear = recursive_mob_check(A, hear, 3, 1, 0, 1) return hear