Files
Bubberstation/code/modules/modular_computers/file_system/programs/alarm.dm
John Willard ddd3f53943 PDA general maintenance (NTNet downloader rework) (#79741)
## About The Pull Request

I deleted the documentation file of ModPCs because it was barebones and
had no new information to give that autodoc couldn't. Just to make sure
this isn't a net-negative, I improved on much of the autodoc and
comments in general around ModPC code to help people understand easier
what's going on around it.
I also renamed vars that were too easily confused with other var names,
and reworked the ntnet downloader a little;
- it now has a search bar
- it now has more sections to scroll through, hopefully making it more
accurate and easy to find what you need.
- also organized the apps that were previously shoved in 'other'.
- i also upgraded it to a .tsx because why not

video demonstration


https://github.com/tgstation/tgstation/assets/53777086/cbba4c1c-b8a8-4ba4-8628-aea8389999fc

## Why It's Good For The Game

Adds in a lot of comments that were previously missing, clears up some
sources of confusion within ModPC code, and improves NTNet Downloader,
something I've procrastinated on doing for a very long time now.

## Changelog

🆑
qol: NTNet Downloader now has a search bar, and programs are now better
sorted.
/🆑
2023-11-19 19:00:18 -05:00

49 lines
1.9 KiB
Plaintext

/datum/computer_file/program/alarm_monitor
filename = "alarmmonitor"
filedesc = "Canary"
downloader_category = PROGRAM_CATEGORY_ENGINEERING
ui_header = "alarm_green.gif"
program_open_overlay = "alert-green"
extended_desc = "This program provides visual interface for a station's alarm system."
requires_ntnet = 1
size = 4
tgui_id = "NtosStationAlertConsole"
program_icon = "bell"
/// If there is any station alert
var/has_alert = FALSE
/// Station alert datum for showing alerts UI
var/datum/station_alert/alert_control
/datum/computer_file/program/alarm_monitor/on_install()
. = ..()
//We want to send an alarm if we're in one of the mining home areas
//Or if we're on station. Otherwise, die.
var/list/allowed_areas = GLOB.the_station_areas + typesof(/area/mine)
alert_control = new(computer, list(ALARM_ATMOS, ALARM_FIRE, ALARM_POWER), listener_areas = allowed_areas)
RegisterSignals(alert_control.listener, list(COMSIG_ALARM_LISTENER_TRIGGERED, COMSIG_ALARM_LISTENER_CLEARED), PROC_REF(update_alarm_display))
/datum/computer_file/program/alarm_monitor/Destroy()
QDEL_NULL(alert_control)
return ..()
/datum/computer_file/program/alarm_monitor/ui_data(mob/user)
var/list/data = list()
data += alert_control.ui_data(user)
return data
/datum/computer_file/program/alarm_monitor/proc/update_alarm_display()
SIGNAL_HANDLER
// has_alert is true if there are any active alarms in our listener.
has_alert = (length(alert_control.listener.alarms) > 0)
if(!has_alert)
program_open_overlay = "alert-green"
ui_header = "alarm_green.gif"
else
// If we don't know the status, assume the worst.
// Technically we should never have anything other than a truthy or falsy value
// but this will allow for unknown values to fall through to be an actual alert.
program_open_overlay = "alert-red"
ui_header = "alarm_red.gif"
update_computer_icon() // Always update the icon after we check our conditional because we might've changed it