From 29d9da37606d3fec548a4a38d09929c933005e3e Mon Sep 17 00:00:00 2001 From: Haevacht Date: Tue, 14 Mar 2017 02:43:16 +1100 Subject: [PATCH] Remie's listtarget() optimisations (#25024) * remie's suggestions * by raz's comment --- code/modules/mob/living/simple_animal/hostile/hostile.dm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index aac60f82fe5..b653bdcb4cc 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -103,10 +103,8 @@ //////////////HOSTILE MOB TARGETTING AND AGGRESSION//////////// /mob/living/simple_animal/hostile/proc/ListTargets()//Step 1, find out what we can see - . = list() if(!search_objects) - var/list/Mobs = hearers(vision_range, targets_from) - src //Remove self, so we don't suicide - . += Mobs + . = hearers(vision_range, targets_from) - src //Remove self, so we don't suicide var/static/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/mecha, /obj/structure/destructible/clockwork/ocular_warden)) @@ -114,8 +112,7 @@ if(can_see(targets_from, HM, vision_range)) . += HM else - var/list/Objects = oview(vision_range, targets_from) - . += Objects + . = oview(vision_range, targets_from) /mob/living/simple_animal/hostile/proc/FindTarget(var/list/possible_targets, var/HasTargetsList = 0)//Step 2, filter down possible targets to things we actually care about . = list() @@ -438,4 +435,4 @@ /mob/living/simple_animal/hostile/proc/RegainSearchObjects(value) if(!value) value = initial(search_objects) - search_objects = value \ No newline at end of file + search_objects = value