Files
vgstation13/code/controllers/Processes/powernet.dm
clusterfack 147c5bd5a7 A process scheduler thing
Included:
-The process lists use |= instead of += due to the increased stability of the former against double additions.

-Atmospherics machinery is moved under the pipenet processing.

-Modified the atmospherics processes to return 1 when theyve done something, and 0 if they aint done jack shit. Then called scheck() if they return 1, possibly  reducing unnecessary scheck calls while still managing to smooth out the atmospherics processing.

-If a powernet happens to get rebuilt by either powernets or power machinery scheck() is also called
2015-05-08 01:15:19 -05:00

20 lines
718 B
Plaintext

var/global/list/datum/powernet/powernets = list() //Holds all powernet datums in use or pooled
var/global/list/cable_list = list() //Index for all cables, so that powernets don't have to look through the entire world all the time
/datum/controller/process/powernet/setup()
name = "powernet"
schedule_interval = 20 // every 2 seconds
/datum/controller/process/powernet/doWork()
for(var/obj/structure/cable/PC in cable_list)
if(PC.build_status)
if(PC.rebuild_from()) //Does a powernet need rebuild? Lets do it!
scheck()
for(var/datum/powernet/powerNetwork in powernets)
if(istype(powerNetwork) && !powerNetwork.disposed)
powerNetwork.reset()
scheck()
continue
powernets.Remove(powerNetwork)