Effeciency Project: APC / Machinery power usage.

We no longer run auto_use_power() on every machine every tick.
We now have a global list of areas, and areas that have an APC in them (all_areas and active_areas) no more looping through world bullshit.
A bunch of snowflakey as fuck machines won't use_power() in their process, you get two options, active and idle, use them!
This means a lot of machines won't double dip on power as well so power usage for the station has dropped about 20%

Because everything is snowflakey as fuck we're going to have some machines that don't force an update on their power usage.  Fuck them.
We should catch them with the root obj/machine/proc's forcing updates.
This commit is contained in:
Ccomp5950
2014-03-08 03:42:44 -06:00
parent e0e1bd9cfb
commit bb9a66cc3a
14 changed files with 75 additions and 67 deletions
+2 -2
View File
@@ -33,7 +33,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
var/eject = null
var/debug = 0
var/powerupdate = 0
var/powerupdate = 10 //We give everything 10 ticks to settle out it's power usage.
var/requires_power = 1
var/always_unpowered = 0 //this gets overriden to 1 for space in area/New()
@@ -46,7 +46,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
var/used_environ = 0
var/has_gravity = 1
var/list/apc = list()
var/no_air = null
var/area/master // master area used for power calcluations
// (original area before splitting due to sd_DAL)
+2
View File
@@ -14,6 +14,7 @@
uid = ++global_uid
related = list(src)
active_areas += src
all_areas += src
if(type == /area) // override defaults for space. TODO: make space areas of type /area/space rather than /area
requires_power = 1
@@ -217,6 +218,7 @@
// called when power status changes
/area/proc/power_change()
master.powerupdate = 2
for(var/area/RA in related)
for(var/obj/machinery/M in RA) // for each machine in the area
M.power_change() // reverify power status (to update icons etc.)
+5 -1
View File
@@ -181,10 +181,12 @@
return
return
/*
/obj/machinery/body_scanconsole/process() //not really used right now
if(stat & (NOPOWER|BROKEN))
return
use_power(250) // power stuff
//use_power(250) // power stuff
// var/mob/M //occupant
// if (!( src.status )) //remove this
@@ -200,6 +202,8 @@
// src.updateDialog()
// return
*/
/obj/machinery/body_scanconsole/attack_paw(user as mob)
return src.attack_hand(user)
+2 -2
View File
@@ -10,7 +10,7 @@
var/id
use_power = 1
idle_power_usage = 2
active_power_usage = 4
active_power_usage = 5
/obj/machinery/meter/New()
..()
@@ -30,7 +30,7 @@
icon_state = "meter0"
return 0
use_power(5)
//use_power(5)
var/datum/gas_mixture/environment = target.return_air()
if(!environment)
+1 -1
View File
@@ -273,7 +273,7 @@
src.locked = 0
if (!src.mess)
icon_state = "pod_0"
use_power(200)
//use_power(200)
return
return
+1 -1
View File
@@ -75,4 +75,4 @@
..(severity)
return
power_change()
..(severity)
..(severity)