Merging Powernets into Machines

This commit is contained in:
Fox-McCloud
2015-07-15 03:36:35 -04:00
parent da8ac741e9
commit c81d7904c5
5 changed files with 12 additions and 59 deletions

View File

@@ -3,10 +3,10 @@
schedule_interval = 20 // every 2 seconds
/datum/controller/process/machinery/doWork()
//#ifdef PROFILE_MACHINES
//machine_profiling.len = 0
//#endif
process_power()
process_machines()
/datum/controller/process/machinery/proc/process_machines()
for(var/obj/machinery/M in machines)
if(M && isnull(M.gcDestroyed))
#ifdef PROFILE_MACHINES
@@ -33,3 +33,12 @@
machines -= M
scheck()
/datum/controller/process/machinery/proc/process_power()
for(var/datum/powernet/powerNetwork in powernets)
if(istype(powerNetwork) && isnull(powerNetwork.gcDestroyed))
powerNetwork.reset()
scheck()
continue
else
powernets -= powerNetwork

View File

@@ -1,40 +0,0 @@
var/global/list/power_machinery_profiling = list()
/datum/controller/process/power_machinery
var/tmp/datum/updateQueue/updateQueueInstance
/datum/controller/process/power_machinery/setup()
name = "pow_machine"
schedule_interval = 20 // every 2 seconds
/datum/controller/process/power_machinery/doWork()
for(var/obj/machinery/M in power_machines)
if(istype(M) && isnull(M.gcDestroyed))
#ifdef PROFILE_MACHINES
var/time_start = world.timeofday
#endif
if(M.process() == PROCESS_KILL)
M.inMachineList = 0
power_machines -= 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 power_machinery_profiling))
power_machinery_profiling[M.type] = 0
power_machinery_profiling[M.type] += (time_end - time_start)
#endif
else
power_machines -= M
else
if(istype(M))
M.inMachineList = 0
power_machines -= M
scheck()

View File

@@ -1,12 +0,0 @@
/datum/controller/process/powernet/setup()
name = "powernet"
schedule_interval = 20 // every 2 seconds
/datum/controller/process/powernet/doWork()
for(var/datum/powernet/powerNetwork in powernets)
if(istype(powerNetwork) && isnull(powerNetwork.gcDestroyed))
powerNetwork.reset()
scheck()
continue
else
powernets -= powerNetwork