mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 20:20:33 +01:00
[MIRROR] Power failure event will now only provide an announcement if the previous power failure has ended [MDB IGNORE] (#15419)
* Power failure event will now only provide an announcement if the previous power failure has ended (#68943) Power failure event will now only provide a message if a previous power failure has ended * Power failure event will now only provide an announcement if the previous power failure has ended Co-authored-by: ShizCalev <ShizCalev@users.noreply.github.com>
This commit is contained in:
@@ -385,8 +385,12 @@
|
||||
|
||||
return pick(possible_loc)
|
||||
|
||||
///Prevents power_failure message spam if a traitor purchases repeatedly.
|
||||
GLOBAL_VAR_INIT(power_failure_message_cooldown, 0)
|
||||
|
||||
///Disable power in the station APCs
|
||||
/proc/power_fail(duration_min, duration_max)
|
||||
var/message_cooldown
|
||||
for(var/obj/machinery/power/apc/current_apc as anything in GLOB.apcs_list)
|
||||
if(!current_apc.cell || !SSmapping.level_trait(current_apc.z, ZTRAIT_STATION))
|
||||
continue
|
||||
@@ -394,7 +398,10 @@
|
||||
if(GLOB.typecache_powerfailure_safe_areas[apc_area.type])
|
||||
continue
|
||||
|
||||
current_apc.energy_fail(rand(duration_min,duration_max))
|
||||
var/duration = rand(duration_min,duration_max)
|
||||
message_cooldown = max(duration, message_cooldown)
|
||||
current_apc.energy_fail(duration)
|
||||
GLOB.power_failure_message_cooldown = world.time + message_cooldown
|
||||
|
||||
/**
|
||||
* Sends a round tip to a target. If selected_tip is null, a random tip will be sent instead (5% chance of it being silly).
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/proc/power_failure()
|
||||
priority_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", ANNOUNCER_POWEROFF)
|
||||
if(GLOB.power_failure_message_cooldown > world.time)
|
||||
priority_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", ANNOUNCER_POWEROFF)
|
||||
for(var/obj/machinery/power/smes/S in GLOB.machines)
|
||||
if(istype(get_area(S), /area/station/ai_monitored/turret_protected) || !is_station_level(S.z))
|
||||
continue
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
startWhen = 1
|
||||
|
||||
/datum/round_event/grid_check/announce(fake)
|
||||
priority_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", ANNOUNCER_POWEROFF)
|
||||
if(fake || (GLOB.power_failure_message_cooldown > world.time))
|
||||
priority_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", ANNOUNCER_POWEROFF)
|
||||
|
||||
/datum/round_event/grid_check/start()
|
||||
power_fail(30, 120)
|
||||
|
||||
Reference in New Issue
Block a user