mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-12 07:33:34 +01:00
fix: fix APC behavior in unpowered areas (#25642)
* fix: make unpowered areas without APCs actually unpowered * Update code/modules/power/powernets/local_powernet.dm Co-authored-by: 1080pCat <96908085+1080pCat@users.noreply.github.com> Signed-off-by: warriorstar-orion <orion@snowfrost.garden> --------- Signed-off-by: warriorstar-orion <orion@snowfrost.garden> Co-authored-by: 1080pCat <96908085+1080pCat@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
37b08619b0
commit
5a2fd048b1
@@ -166,8 +166,15 @@
|
||||
|
||||
/obj/machinery/power/apc/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
var/area/A = get_area(src)
|
||||
|
||||
if(A.powernet && !A.powernet.powernet_apc)
|
||||
A.powernet.powernet_apc = src
|
||||
|
||||
if(!mapload)
|
||||
return
|
||||
|
||||
electronics_state = APC_ELECTRONICS_SECURED
|
||||
// is starting with a power cell installed, create it and set its charge level
|
||||
if(cell_type)
|
||||
@@ -175,9 +182,6 @@
|
||||
cell.maxcharge = cell_type // cell_type is maximum charge (old default was 1000 or 2500 (values one and two respectively)
|
||||
cell.charge = start_charge * cell.maxcharge / 100 // (convert percentage to actual value)
|
||||
|
||||
var/area/A = get_area(src)
|
||||
|
||||
|
||||
//if area isn't specified use current
|
||||
if(keep_preset_name)
|
||||
if(isarea(A))
|
||||
|
||||
@@ -618,13 +618,13 @@
|
||||
// if a light is turned off, it won't activate emergency power
|
||||
/obj/machinery/light/proc/turned_off()
|
||||
var/area/machine_area = get_area(src)
|
||||
return !machine_area.lightswitch && machine_area.powernet.lighting_powered
|
||||
return !machine_area.lightswitch && machine_area.powernet.has_power(PW_CHANNEL_LIGHTING)
|
||||
|
||||
// returns whether this light has power
|
||||
// true if area has power and lightswitch is on
|
||||
/obj/machinery/light/has_power()
|
||||
var/area/machine_area = get_area(src)
|
||||
return machine_area.lightswitch && machine_area.powernet.lighting_powered
|
||||
return machine_area.lightswitch && machine_area.powernet.has_power(PW_CHANNEL_LIGHTING)
|
||||
|
||||
// attempts to set emergency lights
|
||||
/obj/machinery/light/proc/set_emergency_lights()
|
||||
@@ -809,7 +809,7 @@
|
||||
/obj/machinery/light/power_change()
|
||||
var/area/A = get_area(src)
|
||||
if(A)
|
||||
seton(A.lightswitch && A.powernet.lighting_powered)
|
||||
seton(A.lightswitch && A.powernet.has_power(PW_CHANNEL_LIGHTING))
|
||||
|
||||
// called when on fire
|
||||
|
||||
|
||||
@@ -105,7 +105,9 @@
|
||||
return FALSE
|
||||
if(power_flags & PW_ALWAYS_POWERED) //if this powernet is always powered, we always return TRUE
|
||||
return TRUE
|
||||
if(powernet_apc?.stat & (BROKEN|MAINT)) //no working apc, no power
|
||||
if(!powernet_apc)
|
||||
return FALSE
|
||||
if(powernet_apc.stat & (BROKEN|MAINT)) // no working apc, no power
|
||||
return FALSE
|
||||
|
||||
switch(channel)
|
||||
|
||||
Reference in New Issue
Block a user