Merge pull request #4345 from Aranclanos/dielighting

Removes lights from the machinery process() list
This commit is contained in:
Alex
2014-08-11 13:58:05 +01:00
6 changed files with 44 additions and 15 deletions
+4 -2
View File
@@ -1018,10 +1018,12 @@
use_power(src.environ_consumption, ENVIRON)
area.calc_lighting() */
lastused_light = area.usage(LIGHT)
lastused_light = area.usage(STATIC_LIGHT)
lastused_light += area.usage(LIGHT)
lastused_equip = area.usage(EQUIP)
lastused_equip += area.usage(STATIC_EQUIP)
lastused_environ = area.usage(ENVIRON)
lastused_environ += area.usage(STATIC_ENVIRON)
area.clear_usage()
lastused_total = lastused_light + lastused_equip + lastused_environ
+6 -8
View File
@@ -201,6 +201,7 @@
power_channel = LIGHT //Lights are calc'd via area so they dont need to be in the machine list
var/on = 0 // 1 if on, 0 if off
var/on_gs = 0
var/static_power_used = 0
var/brightness = 8 // luminosity when on, also used in power calculation
var/status = LIGHT_OK // LIGHT_OK, _EMPTY, _BURNED or _BROKEN
var/flickering = 0
@@ -302,6 +303,11 @@
active_power_usage = (luminosity * 10)
if(on != on_gs)
on_gs = on
if(on)
static_power_used = luminosity * 20 //20W per unit luminosity
addStaticPower(static_power_used, STATIC_LIGHT)
else
removeStaticPower(static_power_used, STATIC_LIGHT)
// attempt to set the light's on/off status
@@ -595,14 +601,6 @@
broken()
// timed process
// use power
#define LIGHTING_POWER_FACTOR 20 //20W per unit luminosity
/obj/machinery/light/process()//TODO: remove/add this from machines to save on processing as needed ~Carn PRIORITY
if(on)
use_power(luminosity * LIGHTING_POWER_FACTOR, LIGHT)
// called when area power state changes
/obj/machinery/light/power_change()
+9
View File
@@ -73,6 +73,15 @@
chan = power_channel
A.master.use_power(amount, chan)
/obj/machinery/proc/addStaticPower(value, powerchannel)
var/area/A = get_area(src)
if(!A || !A.master)
return
A.master.addStaticPower(value, powerchannel)
/obj/machinery/proc/removeStaticPower(value, powerchannel)
addStaticPower(-value, powerchannel)
/obj/machinery/proc/power_change() // called whenever the power settings of the containing area change
// by default, check equipment channel & set flag
// can override if needed