Removes lag.

This setup allows subsystems to pause themselves until next mc fire if they are about to go over a tick, and resume on the next mc tick
It also makes it so we prioritize running subsystems we skipped because there wasn't enough time in the current tick to run them based on their avg tick usage. (as well as subsystems paused mid way thru)

Adds a macro for adding this to non-mc procs. just drop it in the loop. There is a define version as well for if checks if you want to know if you just slept to avoid lag.

This is all inside #if DM_VERSION defines, so once i test that 509 still works to compile/test this should be good to merge
This commit is contained in:
MrStonedOne
2016-03-15 03:39:39 -07:00
parent 0288f7c592
commit 2887dc7ce0
13 changed files with 160 additions and 65 deletions
+13 -5
View File
@@ -10,6 +10,7 @@ var/datum/subsystem/objects/SSobj
priority = 12
var/list/processing = list()
var/list/currentrun = list()
var/list/burning = list()
/datum/subsystem/objects/New()
@@ -29,12 +30,19 @@ var/datum/subsystem/objects/SSobj
..("P:[processing.len]")
/datum/subsystem/objects/fire()
for(var/thing in SSobj.processing)
/datum/subsystem/objects/fire(resumed = 0)
if (!resumed)
currentrun = processing.Copy()
while(currentrun.len)
var/datum/thing = currentrun[1]
currentrun.Cut(1, 2)
if(thing)
thing:process(wait)
continue
SSobj.processing.Remove(thing)
thing.process(wait)
else
SSobj.processing.Remove(thing)
if (MC_TICK_CHECK)
return
for(var/obj/burningobj in SSobj.burning)
if(burningobj && (burningobj.burn_state == ON_FIRE))
if(burningobj.burn_world_time < world.time)