Files
1aaa18070f Adds a station_only subtype of Atmospherics/Station Alerts Consoles that only displays station (+mining station) alarms (#88343)
## About The Pull Request
A more proper way to be solving the alarm appearing in #88335 (That PR
still actually makes the alarm read the inside of the booth so its still
important)

As it turns out, Canary already does this - when creating a new
`/datum/station_alert/` to track the alarms, it passes the optional
areas filter included in the datum with a preset of all station areas
plus the mining station areas.

This PR (after a slight rework) adds a Subtype of the monitoring
consoles called `station_only`, which have checks that only display
alarms from the station and miningstation. These replace all pre-mapped
consoles in stations only.
This will mostly be notable on Icebox and other Multi-Z stations, where
ruins will stop polluting the alarm boards and alarms on all levels will
be displayed - and, on other stations, the fact that alarm boards will
now also display the mining station.
<details><summary>z-level vs station_only</summary>


![image](https://github.com/user-attachments/assets/625eeb1a-0dcf-4842-b02d-4d4dcf9fed51)


![image](https://github.com/user-attachments/assets/1627b062-11bd-4f1e-ac3d-f8824018460f)


</details>

Examining the console will display if it's in z-level or station-area
mode, and this can be changed by multitooling the circuitboard (for crew
rebuilding both damaged station consoles, or space ruins)

<details><summary>examines</summary>


![image](https://github.com/user-attachments/assets/3e9d863e-a7f8-4fdf-8545-cf5c2c4b3bf5)

![image](https://github.com/user-attachments/assets/7e06cdc0-8dce-4006-9d75-29f2fb291cab)


</details>

- [x] TO-DO: Fix Station Alerts Consoles not get set up correctly when
rebuilt ~~(the tracking is set up before the circuit can pass on
`station_only`)~~ (Done much cleaner now, thank you Lemon/Potato)
- [x] TO-DO: Test how this behaves with renamed or newly created
areas... (Renamed functions fine, Newly Created is probably better fixed
in the creation code so that it applies to other station area checks.)

## Why It's Good For The Game
Engineering shouldn't need to worry about ruins or otherwise non-station
alarms. Appearing in the station consoles is confusing and annoying to
those who like to see the board green all across.
Plus, they SHOULD be at least slightly worried about the mining station,
or at least able to tell somebody else about alerts there.
Also of course they should just be able to see all of icebox/tram/other
multi-z stations from alert consoles instead of needing to have one
per-zlevel
## Changelog
🆑
qol: Atmospherics/Station Alerts Consoles can now be set to only display
station (+mining station) areas. Station-mapped ones are set to this by
default. Use a multitool on the circuitboard to toggle between z-level
or station-area tracking!
fix: In turn, Atmospherics Alert Consoles now actually show the whole of
multi-z stations instead of ignoring other z-levels
/🆑

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2025-01-15 11:40:57 +01:00

104 lines
3.2 KiB
Plaintext

/obj/machinery/computer/atmos_alert
name = "atmospheric alert console"
desc = "Used to monitor the station's air alarms."
circuit = /obj/item/circuitboard/computer/atmos_alert
icon_screen = "alert:0"
icon_keyboard = "atmos_key"
light_color = LIGHT_COLOR_CYAN
var/list/priority_alarms = list()
var/list/minor_alarms = list()
/obj/machinery/computer/atmos_alert/examine(mob/user)
. = ..()
var/obj/item/circuitboard/computer/atmos_alert/my_circuit = circuit
. += span_info("The console is set to [my_circuit.station_only ? "track all station and mining alarms" : "track alarms on the same z-level"].")
/obj/machinery/computer/atmos_alert/ui_interact(mob/user, datum/tgui/ui)
. = ..()
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "AtmosAlertConsole", name)
ui.open()
/obj/machinery/computer/atmos_alert/ui_data(mob/user)
var/list/data = list()
data["priority"] = list()
for(var/zone in priority_alarms)
data["priority"] += zone
data["minor"] = list()
for(var/zone in minor_alarms)
data["minor"] += zone
return data
/obj/machinery/computer/atmos_alert/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
switch(action)
if("clear")
var/zone = params["zone"]
if(zone in priority_alarms)
to_chat(usr, span_notice("Priority alarm for [zone] cleared."))
priority_alarms -= zone
. = TRUE
if(zone in minor_alarms)
to_chat(usr, span_notice("Minor alarm for [zone] cleared."))
minor_alarms -= zone
. = TRUE
update_appearance()
/obj/machinery/computer/atmos_alert/process()
. = ..()
if (!.)
return FALSE
var/alarm_count = priority_alarms.len + minor_alarms.len
priority_alarms.Cut()
minor_alarms.Cut()
// An area list used for station_only circuits, so we only send an alarm if we're in one of the station or mining home areas
var/list/station_alert_areas = GLOB.the_station_areas + typesof(/area/mine)
// Setting up a variable for checking our circuit's station_only
var/obj/item/circuitboard/computer/atmos_alert/my_circuit = circuit
for (var/obj/machinery/airalarm/air_alarm as anything in GLOB.air_alarms)
// If the circuit has station_only, check if alarm areas are in the station list
if(my_circuit.station_only)
if (!(air_alarm.my_area.type in station_alert_areas))
continue
// Otherwise just check if alarms match the console's z-level
else if (air_alarm.z != z)
continue
switch (air_alarm.danger_level)
if (AIR_ALARM_ALERT_NONE)
continue
if (AIR_ALARM_ALERT_WARNING)
minor_alarms += get_area_name(air_alarm, format_text = TRUE)
if (AIR_ALARM_ALERT_HAZARD)
priority_alarms += get_area_name(air_alarm, format_text = TRUE)
// Either we got new alarms, or we have no alarms anymore
if ((alarm_count == 0) != (minor_alarms.len + priority_alarms.len == 0))
update_appearance(UPDATE_ICON)
return TRUE
/obj/machinery/computer/atmos_alert/update_overlays()
. = ..()
if(machine_stat & (NOPOWER|BROKEN))
return
if(priority_alarms.len)
. += "alert:2"
return
if(minor_alarms.len)
. += "alert:1"
// Subtype with the board pre-set to check only station areas and the mining station
/obj/machinery/computer/atmos_alert/station_only
circuit = /obj/item/circuitboard/computer/atmos_alert/station_only