Merge pull request #16028 from DeltaFire15/powernet-optim
Minor power_change optimization (updated)
This commit is contained in:
+15
-10
@@ -322,7 +322,7 @@ GLOBAL_LIST_EMPTY(teleportlocs)
|
||||
A.power_light = FALSE
|
||||
A.power_equip = FALSE
|
||||
A.power_environ = FALSE
|
||||
INVOKE_ASYNC(A, .proc/power_change)
|
||||
A.power_change()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return ..()
|
||||
|
||||
@@ -579,15 +579,20 @@ GLOBAL_LIST_EMPTY(teleportlocs)
|
||||
// called when power status changes
|
||||
|
||||
/area/proc/power_change()
|
||||
for(var/obj/machinery/M in src) // for each machine in the area
|
||||
M.power_change() // reverify power status (to update icons etc.)
|
||||
if(sub_areas)
|
||||
for(var/i in sub_areas)
|
||||
var/area/A = i
|
||||
A.power_light = power_light
|
||||
A.power_equip = power_equip
|
||||
A.power_environ = power_environ
|
||||
INVOKE_ASYNC(A, .proc/power_change)
|
||||
SHOULD_NOT_SLEEP(TRUE)
|
||||
if(contents.len < GLOB.machines.len) // it would be faster to loop over contents
|
||||
for(var/obj/machinery/M in src) // for each machine in the area
|
||||
M.power_change() // reverify power status (to update icons etc.)
|
||||
else // it would be faster to loop over the machines list
|
||||
for(var/obj/machinery/M as anything in GLOB.machines) // for each machine
|
||||
if(get_area(M) != src) // in the area
|
||||
continue
|
||||
M.power_change() // reverify power status (to update icons etc.)
|
||||
for(var/area/A as anything in sub_areas)
|
||||
A.power_light = power_light
|
||||
A.power_equip = power_equip
|
||||
A.power_environ = power_environ
|
||||
A.power_change()
|
||||
update_appearance()
|
||||
|
||||
/area/proc/usage(chan)
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
/obj/machinery/door/firedoor/power_change()
|
||||
if(powered(power_channel))
|
||||
stat &= ~NOPOWER
|
||||
latetoggle()
|
||||
INVOKE_ASYNC(src, .proc/latetoggle)
|
||||
else
|
||||
stat |= NOPOWER
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
addStaticPower(-value, powerchannel)
|
||||
|
||||
/obj/machinery/proc/power_change()
|
||||
//SIGNAL_HANDLER
|
||||
SHOULD_NOT_SLEEP(TRUE)
|
||||
//SHOULD_CALL_PARENT(TRUE)
|
||||
|
||||
if(stat & BROKEN)
|
||||
|
||||
Reference in New Issue
Block a user