[MIRROR] Fixes a spurious runtime in AI code (#26356)

* Fixes a spurious runtime in AI code (#81253)

## About The Pull Request

Tin.

![300618628-255ded6c-09c8-4c5b-8557-2f8f2dfcc821](https://github.com/tgstation/tgstation/assets/13398309/4c30ab2d-cd15-411d-92fc-470effef8af3)

No more of this. It's been annoying downstream for the past few days, so
here's the fix. `find_this_thing()` should not be getting called when
`controller.pawn` is qdeleted so I just moved that check up a couple
lines.

## Why It's Good For The Game

Makes CI functional again. Tested downstream with 5 CI runs, the runtime
did not occur in any of them where it was happening just about every run
previously.

## Changelog

🆑
fix: fixes a runtime in AI search_tactic
/🆑

* Fixes a spurious runtime in AI code

---------

Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-02-05 21:19:37 +01:00
committed by GitHub
co-authored by Bloop
parent 11a59d74c0
commit 9cea942da4
2 changed files with 6 additions and 1 deletions
+4 -1
View File
@@ -11,8 +11,11 @@
if (controller.blackboard_key_exists(set_key))
finish_action(controller, TRUE)
return
if(QDELETED(controller.pawn))
finish_action(controller, FALSE)
return
var/find_this_thing = search_tactic(controller, locate_path, search_range)
if(QDELETED(controller.pawn) || isnull(find_this_thing))
if(isnull(find_this_thing))
finish_action(controller, FALSE)
return
controller.set_blackboard_key(set_key, find_this_thing)
@@ -75,6 +75,8 @@
var/list/found = typecache_filter_list(oview(search_range, controller.pawn), locate_paths)
var/list/ignore_list = controller.blackboard[BB_TEMPORARY_IGNORE_LIST]
for(var/atom/found_item in found)
if(QDELETED(controller.pawn))
break
if(LAZYACCESS(ignore_list, REF(found_item)))
continue
var/list/path = get_path_to(controller.pawn, found_item, max_distance = BOT_CLEAN_PATH_LIMIT, access = controller.get_access())