mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Merge pull request #12091 from Heroman3003/aifix2
Fixes AI subsystem locking up on trying to process null entries
This commit is contained in:
@@ -32,8 +32,11 @@ SUBSYSTEM_DEF(ai)
|
||||
while(currentrun.len)
|
||||
var/datum/ai_holder/A = currentrun[currentrun.len]
|
||||
--currentrun.len
|
||||
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(!A || QDELETED(A) || !L?.loc || A.busy) // Doesn't exist or won't exist soon or not doing it this tick
|
||||
if(!L?.loc)
|
||||
continue
|
||||
|
||||
if(process_z[get_z(L)] || !L.low_priority) //VOREStation Edit End
|
||||
|
||||
@@ -291,6 +291,9 @@
|
||||
|
||||
// 'Tactical' processes such as moving a step, meleeing an enemy, firing a projectile, and other fairly cheap actions that need to happen quickly.
|
||||
/datum/ai_holder/proc/handle_tactics()
|
||||
if(!istype(holder) || QDELETED(holder))
|
||||
qdel(src)
|
||||
return
|
||||
if(holder.key && !autopilot)
|
||||
return
|
||||
handle_special_tactic()
|
||||
@@ -298,6 +301,9 @@
|
||||
|
||||
// 'Strategical' processes that are more expensive on the CPU and so don't get run as often as the above proc, such as A* pathfinding or robust targeting.
|
||||
/datum/ai_holder/proc/handle_strategicals()
|
||||
if(!istype(holder) || QDELETED(holder))
|
||||
qdel(src)
|
||||
return
|
||||
if(holder.key && !autopilot)
|
||||
return
|
||||
handle_special_strategical()
|
||||
|
||||
Reference in New Issue
Block a user