Adds in Fast Processing

This commit is contained in:
Fox-McCloud
2016-08-09 06:55:00 -04:00
parent b294a760d9
commit 8cd140e48a
17 changed files with 145 additions and 95 deletions
@@ -0,0 +1,32 @@
var/datum/controller/process/fast_process/fast_processes
/datum/controller/process/fast_process
var/list/currentrun = list()
/datum/controller/process/fast_process/setup()
name = "fast processing"
schedule_interval = 2 //every 0.2 seconds
start_delay = 9
fast_processes = src
log_startup_progress("Fast Processing starting up.")
/datum/controller/process/fast_process/statProcess()
..()
stat(null, "[fast_processing.len] fast machines")
/datum/controller/process/fast_process/doWork()
src.currentrun = fast_processing.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/thing = currentrun[1]
currentrun.Cut(1, 2)
if(thing)
try
thing.process()
catch(var/exception/e)
catchException(e, thing)
else
catchBadType(thing)
fast_processing -= thing
+5 -5
View File
@@ -7,7 +7,7 @@
/datum/controller/process/machinery/statProcess()
..()
stat(null, "[machines.len] machines")
stat(null, "[machine_processing.len] machines")
stat(null, "[powernets.len] powernets, [deferred_powernet_rebuilds.len] deferred")
/datum/controller/process/machinery/doWork()
@@ -19,15 +19,15 @@
/datum/controller/process/machinery/proc/process_sort()
if(machinery_sort_required)
machinery_sort_required = 0
machines = dd_sortedObjectList(machines)
machine_processing = dd_sortedObjectList(machine_processing)
/datum/controller/process/machinery/proc/process_machines()
for(last_object in machines)
for(last_object in machine_processing)
var/obj/machinery/M = last_object
if(istype(M) && isnull(M.gcDestroyed))
try
if(M.process() == PROCESS_KILL)
machines.Remove(M)
machine_processing.Remove(M)
continue
if(M.use_power)
@@ -36,7 +36,7 @@
catchException(e, M)
else
catchBadType(M)
machines -= M
machine_processing -= M
SCHECK_EVERY(100)