mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-28 18:11:16 +00:00
* Fixes admin "power failure" secret. (#73277) ## About The Pull Request - Fixes "power failure" secret not working. `GLOB.the_station_areas` is a list of types, not list of areas. This `as anything` was causing runtimes, as it was accessing values on types, and not area instances. Swaps it over to use `GLOB.areas` + location check that the areas are on station Z level. - Fixes "power failure" secret having no announcement if no grid check has occurred `GLOB.power_failure_message_cooldown` starts at 0, so it was always lower than `world.time` if an admin uses it when no grid check has occurred. Delving deeper, these should not have been linked whatsoever. The power failure spam prevention is now tied to the grid check event itself. I also don't believe it to be necessary, as we fixed discounts having infinite stock, but I'll keep it just cause. ## Why It's Good For The Game Secrets work as advertised ## Changelog 🆑 Melbert fix: Admins, "All areas unpowered" in the secrets menu will now function again. /🆑 * Fixes admin "power failure" secret. --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
26 lines
1.1 KiB
Plaintext
26 lines
1.1 KiB
Plaintext
/datum/round_event_control/grid_check
|
|
name = "Grid Check"
|
|
typepath = /datum/round_event/grid_check
|
|
weight = 10
|
|
max_occurrences = 3
|
|
category = EVENT_CATEGORY_ENGINEERING
|
|
description = "Turns off all APCs for a while, or until they are manually rebooted."
|
|
/// Cooldown for the announement associated with this event.
|
|
/// Necessary due to the fact that this event is player triggerable.
|
|
COOLDOWN_DECLARE(announcement_spam_protection)
|
|
|
|
/datum/round_event/grid_check
|
|
announce_when = 1
|
|
start_when = 1
|
|
|
|
/datum/round_event/grid_check/announce(fake)
|
|
var/datum/round_event_control/grid_check/controller = control
|
|
if(!COOLDOWN_FINISHED(controller, announcement_spam_protection) && !fake)
|
|
return
|
|
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) // Only start the CD if we're real
|
|
COOLDOWN_START(controller, announcement_spam_protection, 30 SECONDS)
|
|
|
|
/datum/round_event/grid_check/start()
|
|
power_fail(30, 120)
|