mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Co-authored-by: ShadowLarkens <shadowlarkens@gmail.com> Co-authored-by: Kashargul <KashL@t-online.de>
32 lines
828 B
Plaintext
32 lines
828 B
Plaintext
SUBSYSTEM_DEF(aifast)
|
|
name = "AI (Fast)"
|
|
init_order = INIT_ORDER_AI_FAST
|
|
priority = FIRE_PRIORITY_AI
|
|
wait = 0.25 SECONDS // Every quarter second
|
|
flags = SS_NO_INIT
|
|
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
|
|
|
|
var/list/processing = list()
|
|
var/list/currentrun = list()
|
|
|
|
/datum/controller/subsystem/aifast/stat_entry(msg)
|
|
msg = "P:[processing.len]"
|
|
return ..()
|
|
|
|
/datum/controller/subsystem/aifast/fire(resumed = 0)
|
|
if (!resumed)
|
|
src.currentrun = processing.Copy()
|
|
|
|
//cache for sanic speed (lists are references anyways)
|
|
var/list/currentrun = src.currentrun
|
|
|
|
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
|
|
A.handle_tactics()
|
|
|
|
if(MC_TICK_CHECK)
|
|
return
|