Removes area.master. Moves area/New to Initialize (#24134)

* Removes master areas

* Ports area/New to Initialize
This commit is contained in:
Cyberboss
2017-02-18 01:04:47 +13:00
committed by oranges
parent e0ee608ed6
commit b6d5aba7b2
21 changed files with 66 additions and 85 deletions
+2 -3
View File
@@ -408,8 +408,8 @@
// returns whether this light has power
// true if area has power and lightswitch is on
/obj/machinery/light/proc/has_power()
var/area/A = src.loc.loc
return A.master.lightswitch && A.master.power_light
var/area/A = get_area(src)
return A.lightswitch && A.power_light
/obj/machinery/light/proc/flicker(var/amount = rand(10, 20))
set waitfor = 0
@@ -534,7 +534,6 @@
// called when area power state changes
/obj/machinery/light/power_change()
var/area/A = get_area(src)
A = A.master
seton(A.lightswitch && A.power_light)
// called when on fire
+7 -7
View File
@@ -56,27 +56,27 @@
if(!use_power)
return 1
var/area/A = src.loc.loc // make sure it's in an area
if(!A || !isarea(A) || !A.master)
var/area/A = get_area(src) // make sure it's in an area
if(!A)
return 0 // if not, then not powered
if(chan == -1)
chan = power_channel
return A.master.powered(chan) // return power status of the area
return A.powered(chan) // return power status of the area
// increment the power usage stats for an area
/obj/machinery/proc/use_power(amount, chan = -1) // defaults to power_channel
var/area/A = get_area(src) // make sure it's in an area
if(!A || !isarea(A) || !A.master)
if(!A)
return
if(chan == -1)
chan = power_channel
A.master.use_power(amount, chan)
A.use_power(amount, chan)
/obj/machinery/proc/addStaticPower(value, powerchannel)
var/area/A = get_area(src)
if(!A || !A.master)
if(!A)
return
A.master.addStaticPower(value, powerchannel)
A.addStaticPower(value, powerchannel)
/obj/machinery/proc/removeStaticPower(value, powerchannel)
addStaticPower(-value, powerchannel)