Fixes APC load totals periodically doubling

Also fixes areas updating excessively when update_use_power() was
called.
This commit is contained in:
mwerezak
2014-09-06 11:35:58 -04:00
parent 265c46be7d
commit e045c84f97
3 changed files with 8 additions and 11 deletions
+1
View File
@@ -299,6 +299,7 @@ datum/controller/game_controller/proc/process_machines_power()
var/area/A = active_areas[i]
if(A.powerupdate && A.master == A)
A.powerupdate -= 1
A.clear_usage()
for(var/j = 1; j <= A.related.len; j++)
var/area/SubArea = A.related[j]
for(var/obj/machinery/M in SubArea)
+3 -7
View File
@@ -165,13 +165,9 @@ Class Procs:
use_power = new_use_power
//force area power update
//use_power() forces an area power update on the next tick so have to pass the correct power amount for this tick
if (use_power >= 2)
use_power(active_power_usage)
else if (use_power == 1)
use_power(idle_power_usage)
else
use_power(0)
var/area/A = get_area(src)
if(A && A.master)
A.master.powerupdate = 1
/obj/machinery/proc/auto_use_power()
if(!powered(power_channel))
+4 -4
View File
@@ -1174,10 +1174,7 @@
lastused_light = area.usage(LIGHT)
lastused_equip = area.usage(EQUIP)
lastused_environ = area.usage(ENVIRON)
if(area.powerupdate)
if(debug) log_debug("power update in [area.name] / [name]")
area.clear_usage()
lastused_total = lastused_light + lastused_equip + lastused_environ
//store states to update icon if any change
@@ -1195,6 +1192,9 @@
if(debug)
log_debug( "Status: [main_status] - Excess: [excess] - Last Equip: [lastused_equip] - Last Light: [lastused_light]")
if(area.powerupdate)
log_debug("power update in [area.name] / [name]")
if(cell && !shorted)
//var/cell_charge = cell.charge