diff --git a/code/modules/power/apc/apc_main.dm b/code/modules/power/apc/apc_main.dm index 8cf44a970ee..2f53861f406 100644 --- a/code/modules/power/apc/apc_main.dm +++ b/code/modules/power/apc/apc_main.dm @@ -586,7 +586,7 @@ update_appearance() if(machine_stat & (BROKEN|MAINT)) return - if(!area || !area.requires_power) + if(!area?.requires_power) return if(failure_timer) failure_timer-- @@ -631,6 +631,7 @@ if(cell && !shorted) //need to check to make sure the cell is still there since rigged/corrupted cells can randomly explode after give(). // set channels depending on how much charge we have left + var/cell_percent = cell.percent() if(cell.charge <= 0) // zero charge, turn all off equipment = autoset(equipment, AUTOSET_FORCE_OFF) lighting = autoset(lighting, AUTOSET_FORCE_OFF) @@ -639,7 +640,7 @@ if(!nightshift_lights || (nightshift_lights && !low_power_nightshift_lights)) low_power_nightshift_lights = TRUE INVOKE_ASYNC(src, PROC_REF(set_nightshift), TRUE) - else if(cell.percent() < APC_CHANNEL_LIGHT_TRESHOLD) // turn off lighting & equipment + else if(cell_percent < APC_CHANNEL_LIGHT_TRESHOLD) // turn off lighting & equipment equipment = autoset(equipment, AUTOSET_OFF) lighting = autoset(lighting, AUTOSET_OFF) environ = autoset(environ, AUTOSET_ON) @@ -647,7 +648,7 @@ if(!nightshift_lights || (nightshift_lights && !low_power_nightshift_lights)) low_power_nightshift_lights = TRUE INVOKE_ASYNC(src, PROC_REF(set_nightshift), TRUE) - else if(cell.percent() < APC_CHANNEL_EQUIP_TRESHOLD) // turn off equipment + else if(cell_percent < APC_CHANNEL_EQUIP_TRESHOLD) // turn off equipment equipment = autoset(equipment, AUTOSET_OFF) lighting = autoset(lighting, AUTOSET_ON) environ = autoset(environ, AUTOSET_ON) @@ -663,7 +664,7 @@ low_power_nightshift_lights = FALSE if(!SSnightshift.nightshift_active) INVOKE_ASYNC(src, PROC_REF(set_nightshift), FALSE) - if(cell.percent() > APC_CHANNEL_ALARM_TRESHOLD) + if(cell_percent > APC_CHANNEL_ALARM_TRESHOLD) alarm_manager.clear_alarm(ALARM_POWER) else // no cell, switch everything off