Files
Paradise/code/game/gamemodes/events/power_failure.dm
2015-02-16 20:33:28 +01:00

61 lines
2.1 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/turret_protected/ai)
var/list/skipped_areas_apc = list(/area/engine/engineering)
for(var/obj/machinery/power/smes/S in machines)
var/area/current_area = get_area(S)
if(current_area.type in skipped_areas || !(S.z in config.station_levels))
continue
S.charge = 0
S.output = 0
S.online = 0
S.updateicon()
S.power_change()
for(var/obj/machinery/power/apc/C in world)
var/area/current_area = get_area(C)
if(current_area.type in skipped_areas_apc || !(C.z in config.station_levels))
continue
if(C.cell)
C.cell.charge = 0
/proc/power_restore(var/announce = 1)
var/list/skipped_areas = list(/area/turret_protected/ai)
var/list/skipped_areas_apc = list(/area/engine/engineering)
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 machines)
var/area/current_area = get_area(C)
if(current_area.type in skipped_areas_apc || !(C.z in config.station_levels))
continue
if(C.cell)
C.cell.charge = C.cell.maxcharge
for(var/obj/machinery/power/smes/S in machines)
var/area/current_area = get_area(S)
if(current_area.type in skipped_areas || !(S.z in config.station_levels))
continue
S.charge = S.capacity
S.output = 200000
S.online = 1
S.updateicon()
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 machines)
if(S.z != 1)
continue
S.charge = S.capacity
S.output = 200000
S.online = 1
S.updateicon()
S.power_change()