Further optimizations, no need to loop through items with multiple istype checks

This commit is contained in:
Ccomp5950
2014-02-19 19:38:36 -05:00
committed by ZomgPonies
parent 214af388ec
commit 9a16b0386c
+4 -15
View File
@@ -180,20 +180,7 @@
var/list/objects = list()
var/list/obj_to_check = list() //IF SOMEONE DOESN'T HEAR SOMETHING AND ARE IN INSIDE A CONTAINER ADD IT TO THIS LIST.
obj_to_check += typesof(/obj/item/device/paicard)
obj_to_check += typesof(/obj/item/device/aicard)
obj_to_check += typesof(/obj/machinery/computer/aifixer)
for(var/obj/O in range) //Get a list of objects in hearing range. We'll check to see if any clients have their "eye" set to the object
if(istype(O, /obj/item/device/radio)) //This avoids all that bullshit with recursion. FUCK RECURSION ~Ccomp
hear += O
if(O.type in obj_to_check)
for(var/mob/living/M in O.contents)
if(!(M in hear))
hear += M
objects += O
for(var/client/C in clients)
@@ -207,9 +194,11 @@
hear += C.mob
else if(!(C.mob in hear))
if(C.mob.loc in (hear|objects))
if(C.mob.loc && C.mob.loc in (hear|objects))
hear += C.mob
else if(C.mob.loc.loc in (hear|objects))
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