Fixes AI Swarmers Doing Nothing (#46939)

About The Pull Request

AI swarmers are supposed to go after nearly everything in sight, including turfs, but this behavior is broken; I wouldn't be all surprised if other mobs targeting behavior is also broken.

In an attempt to make bees perform better, ListTargets behavior was changed here: #31250

While it does, supposedly, perform better, it also breaks swarmers---andddd I suspect other mobs, as well, as this effectively means anything that's not a mob or an object (primarily turfs).

Either case, this reverts ListTargets back to what it originally was, restoring intended behavior.

That said, since bees are so problematic, they use the current ListTargets behavior to only search for objects and mobs.

fixes: #46938
Changelog

cl Fox McCloud
fix: Fixes AI swarmers just sitting in their base doing nothing
/cl
This commit is contained in:
Fox McCloud
2019-10-12 23:39:57 -04:00
committed by oranges
parent eef5cbc96d
commit dfb8438cd7
2 changed files with 12 additions and 6 deletions

View File

@@ -86,6 +86,16 @@
if(!beehome)
. += "<span class='warning'>This bee is homeless!</span>"
/mob/living/simple_animal/hostile/poison/bees/ListTargets() // Bee processing is expessive, so we override them finding targets here.
if(!search_objects) //In case we want to have purely hostile bees
return ..()
else
. = list() // The following code is only very slightly slower than just returning oview(vision_range, targets_from), but it saves us much more work down the line
var/list/searched_for = oview(vision_range, targets_from)
for(var/obj/A in searched_for)
. += A
for(var/mob/A in searched_for)
. += A
/mob/living/simple_animal/hostile/poison/bees/proc/generate_bee_visuals()
cut_overlays()

View File

@@ -127,7 +127,7 @@
//////////////HOSTILE MOB TARGETTING AND AGGRESSION////////////
/mob/living/simple_animal/hostile/proc/ListTargets()//Step 1, find out what we can see
/mob/living/simple_animal/hostile/proc/ListTargets() //Step 1, find out what we can see
if(!search_objects)
. = hearers(vision_range, targets_from) - src //Remove self, so we don't suicide
@@ -137,11 +137,7 @@
if(can_see(targets_from, HM, vision_range))
. += HM
else
. = list() // The following code is only very slightly slower than just returning oview(vision_range, targets_from), but it saves us much more work down the line, particularly when bees are involved
for (var/obj/A in oview(vision_range, targets_from))
. += A
for (var/mob/A in oview(vision_range, targets_from))
. += A
. = oview(vision_range, targets_from)
/mob/living/simple_animal/hostile/proc/FindTarget(list/possible_targets, HasTargetsList = 0)//Step 2, filter down possible targets to things we actually care about
. = list()