Files
Yogstation/code/controllers/subsystem/processing/processing.dm
Cyberboss fb596bcdb3 _DEF
2017-03-22 14:52:21 -04:00

36 lines
861 B
Plaintext

//Used to process objects. Fires once every second.
SUBSYSTEM_DEF(processing)
name = "Processing"
priority = 25
flags = SS_BACKGROUND|SS_POST_FIRE_TIMING|SS_NO_INIT
wait = 10
var/stat_tag = "P" //Used for logging
var/list/processing = list()
var/list/currentrun = list()
/datum/controller/subsystem/processing/stat_entry()
..("[stat_tag]:[processing.len]")
/datum/controller/subsystem/processing/fire(resumed = 0)
if (!resumed)
currentrun = processing.Copy()
//cache for sanic speed (lists are references anyways)
var/list/current_run = currentrun
while(current_run.len)
var/datum/thing = current_run[current_run.len]
current_run.len--
if(thing)
thing.process(wait)
else
processing -= thing
if (MC_TICK_CHECK)
return
/datum/var/isprocessing = 0
/datum/proc/process()
set waitfor = 0
STOP_PROCESSING(SSobj, src)
return 0