Merge pull request #12091 from Heroman3003/aifix2

Fixes AI subsystem locking up on trying to process null entries
This commit is contained in:
Novacat
2022-01-22 09:16:57 -05:00
committed by CHOMPStation2
parent e611f86f3f
commit affc70ee1b
2 changed files with 16 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ SUBSYSTEM_DEF(ai)
var/list/currentrun = list()
var/slept_mobs = 0
var/list/process_z = list()
var/list/process_z = list()
/datum/controller/subsystem/ai/stat_entry(msg_prefix)
..("P: [processing.len] | S: [slept_mobs]")
@@ -32,10 +32,13 @@ SUBSYSTEM_DEF(ai)
while(currentrun.len)
var/datum/ai_holder/A = currentrun[currentrun.len]
--currentrun.len
var/mob/living/L = A.holder //VOREStation Edit Start
if(!A || QDELETED(A) || !L?.loc || A.busy) // Doesn't exist or won't exist soon or not doing it this tick
if(!A || QDELETED(A) || A.busy) // Doesn't exist or won't exist soon or not doing it this tick
continue
var/mob/living/L = A.holder //VOREStation Edit Start
if(!L?.loc)
continue
if(process_z[get_z(L)] || !L.low_priority) //VOREStation Edit End
A.handle_strategicals()
else