Files
vgstation13/code/controllers/Processes/fast_machinery.dm
D3athrow 57c8aa2d22 Merge branch Bleeding-Edge into snowflake_the_world
Conflicts:
	code/game/objects/effects/overlays.dm
	code/modules/projectiles/projectile.dm
	code/modules/projectiles/projectile/beams.dm
2015-08-25 04:18:02 -05:00

58 lines
1.3 KiB
Plaintext

//Faster version of the one in machinery.dm
var/global/list/fast_machines = list()
/datum/controller/process/fast_machinery
schedule_interval = 7 // every 0.6 second.
/datum/controller/process/fast_machinery/setup()
name = "fast_machinery"
/datum/controller/process/fast_machinery/doWork()
//#ifdef PROFILE_MACHINES
//machine_profiling.len = 0
//#endif
if(!fast_machines || !fast_machines.len) return
for(var/i = 1 to fast_machines.len)
if(i > fast_machines.len)
break
try
var/obj/machinery/M = fast_machines[i]
if(istype(M) && !M.gcDestroyed)
if(M.timestopped) continue
#ifdef PROFILE_MACHINES
var/time_start = world.timeofday
#endif
if(M.process() == PROCESS_KILL)
M.inMachineList = 0
fast_machines.Remove(M)
continue
if(M && M.use_power)
M.auto_use_power()
if(istype(M))
#ifdef PROFILE_MACHINES
var/time_end = world.timeofday
if(!(M.type in machine_profiling))
machine_profiling[M.type] = 0
machine_profiling[M.type] += (time_end - time_start)
#endif
else
if(!fast_machines.Remove(M))
fast_machines.Cut(i, i + 1)
else
if(M)
M.inMachineList = 0
if(!fast_machines.Remove(M))
fast_machines.Cut(i, i + 1)
catch(var/exception/e)
world.Error(e)
continue
if(!(i % 20)) scheck()