mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2025-12-09 14:27:09 +00:00
60 lines
2.2 KiB
Plaintext
60 lines
2.2 KiB
Plaintext
|
|
/proc/power_failure(var/announce = 1)
|
|
if(announce)
|
|
command_announcement.Announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", new_sound = 'sound/AI/poweroff.ogg')
|
|
|
|
var/list/skipped_areas = list(/area/ai)
|
|
|
|
for(var/obj/machinery/power/smes/S in GLOB.machines)
|
|
var/area/current_area = get_area(S)
|
|
if((current_area.type in skipped_areas) || !(S.z in (LEGACY_MAP_DATUM).station_levels))
|
|
continue
|
|
S.last_charge = S.charge
|
|
S.last_output_attempt = S.output_attempt
|
|
S.last_input_attempt = S.input_attempt
|
|
S.powerout_holders_used = TRUE
|
|
S.charge = 0
|
|
S.inputting(0)
|
|
S.outputting(0)
|
|
S.update_icon()
|
|
S.power_change()
|
|
|
|
|
|
for(var/obj/machinery/power/apc/C in GLOB.apcs)
|
|
if(!C.is_critical && C.cell && (C.z in (LEGACY_MAP_DATUM).station_levels))
|
|
C.cell.charge = 0
|
|
|
|
/proc/power_restore(var/announce = 1)
|
|
var/list/skipped_areas = list(/area/ai)
|
|
|
|
if(announce)
|
|
command_announcement.Announce("Power has been restored to [station_name()]. We apologize for the inconvenience.", "Power Systems Nominal", new_sound = 'sound/AI/poweron.ogg')
|
|
for(var/obj/machinery/power/apc/C in GLOB.apcs)
|
|
if(C.cell && (C.z in (LEGACY_MAP_DATUM).station_levels))
|
|
C.cell.charge = C.cell.maxcharge
|
|
for(var/obj/machinery/power/smes/S in GLOB.machines)
|
|
var/area/current_area = get_area(S)
|
|
if((current_area.type in skipped_areas) || isNotStationLevel(S.z))
|
|
continue
|
|
if(S.powerout_holders_used)
|
|
S.charge = S.last_charge
|
|
S.output_attempt = S.last_output_attempt
|
|
S.input_attempt = S.last_input_attempt
|
|
S.powerout_holders_used = FALSE
|
|
S.update_icon()
|
|
S.power_change()
|
|
|
|
/proc/power_restore_quick(var/announce = 1)
|
|
|
|
if(announce)
|
|
command_announcement.Announce("All SMESs on [station_name()] have been recharged. We apologize for the inconvenience.", "Power Systems Nominal", new_sound = 'sound/AI/poweron.ogg')
|
|
for(var/obj/machinery/power/smes/S in GLOB.machines)
|
|
if(isNotStationLevel(S.z))
|
|
continue
|
|
S.charge = S.capacity
|
|
S.output_level = S.output_level_max
|
|
S.output_attempt = 1
|
|
S.input_attempt = 1
|
|
S.update_icon()
|
|
S.power_change()
|