mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-24 00:51:46 +00:00
Begins work on new AI.
This commit is contained in:
30
code/controllers/subsystems/ai.dm
Normal file
30
code/controllers/subsystems/ai.dm
Normal file
@@ -0,0 +1,30 @@
|
||||
SUBSYSTEM_DEF(ai)
|
||||
name = "AI"
|
||||
priority = 9
|
||||
wait = 5 // This gets run twice a second, however this is technically two loops in one, with the second loop being run every four iterations.
|
||||
flags = SS_NO_INIT|SS_TICKER
|
||||
|
||||
var/list/processing = list()
|
||||
var/list/currentrun = list()
|
||||
|
||||
/datum/controller/subsystem/ai/stat_entry()
|
||||
..("P:[processing.len]")
|
||||
|
||||
/datum/controller/subsystem/ai/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/mob/living/L = currentrun[currentrun.len]
|
||||
var/datum/ai_holder/A = currentrun[currentrun.len]
|
||||
--currentrun.len
|
||||
if(times_fired % 4 == 0 && A.holder.stat != DEAD)
|
||||
A.handle_strategicals()
|
||||
if(A.holder.stat != DEAD) // The /TG/ version checks stat twice, presumably in-case processing somehow got the mob killed in that instant.
|
||||
A.handle_tactics()
|
||||
|
||||
if(MC_TICK_CHECK)
|
||||
return
|
||||
Reference in New Issue
Block a user