From 04a0537b1fbc9f4d2a923751a0331ff9e527f1b9 Mon Sep 17 00:00:00 2001 From: Ccomp5950 Date: Wed, 19 Feb 2014 00:12:14 -0600 Subject: [PATCH] Compile fix / optimizations Removed client check from mob so that if a pAI is being held by a SSD client it can still hear. Removed 3rd deep .loc check 2 is plenty, and was making the proc rather expensive (if you shove a pAI in a bag and toss the bag into a locker, the pAI will be deaf, you jerk). --- code/__HELPERS/game.dm | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index a6a7e825903..577c8093390 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -175,8 +175,7 @@ var/list/range = hear(R, T) for(var/mob/M in range) - if(M.client) - hear += M + hear += M var/list/objects = list() @@ -187,24 +186,21 @@ if(!istype(C) || !C.eye) continue //I have no idea when this client check would be needed, but if this runtimes people won't hear anything //So kinda paranoid about runtime avoidance. - if(istype(C.eye, /obj/machinery/camera) + if(istype(C.eye, /obj/machinery/camera)) continue //No microphones in cameras. if(C.mob in hear) continue - if(C.eye in (hear|objects)) - if(!(C.mob in hear)) - hear += C.mob - - else if(!(C.mob in hear)) - if(C.mob.loc && C.mob.loc in (hear|objects)) - hear += C.mob - else if(C.mob.loc.loc && C.mob.loc.loc in (hear|objects)) - hear += C.mob - else if(C.mob.loc.loc.loc && C.mob.loc.loc.loc in (hear|objects)) //Going a little deeper - hear += C.mob - + var/list/hear_and_objects = (hear|objects) //Combined these lists here instead of doing the combine 3 more times. + + if(C.eye in hear_and_objects) + hear += C.mob + + else if(C.mob.loc in hear_and_objects) + hear += C.mob + else if(C.mob.loc.loc in hear_and_objects) + hear += C.mob return hear