mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-14 19:51:59 +00:00
Revamp of the software downloader program for modular computers. Changes: - Programs are now sorted alphabetically with incompatible ones in the end of the list. - Installed programs are now displayed in the list. - Added program icons. - Moved the error messages in place of the download button. - Only the most important error message is displayed now. Priority: compatibility, access, free space. - Syndicate programs are now displayed in the same list, but have a warning message from NT (There are no warning messages on syndicate OS). - Added program categories to improve navigation. The default option "All" contains items from all categories. - Download progress bar moved in place of the Disk usage bar. Disk usage is updated only after the download is complete, so the information was inaccurate during download. And the download bar now always visible regardless of selected category. - The old download progress bar (next to the corresponding program) is replaced with "Downloading" indicator with a spinner. Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
108 lines
2.7 KiB
Plaintext
108 lines
2.7 KiB
Plaintext
/datum/computer_file/program/alarm_monitor
|
|
filename = "alarmmonitor"
|
|
filedesc = "Canary"
|
|
category = PROGRAM_CATEGORY_ENGI
|
|
ui_header = "alarm_green.gif"
|
|
program_icon_state = "alert-green"
|
|
extended_desc = "This program provides visual interface for a station's alarm system."
|
|
requires_ntnet = 1
|
|
size = 5
|
|
tgui_id = "NtosStationAlertConsole"
|
|
program_icon = "bell"
|
|
var/has_alert = 0
|
|
var/alarms = list("Fire" = list(), "Atmosphere" = list(), "Power" = list())
|
|
|
|
/datum/computer_file/program/alarm_monitor/process_tick()
|
|
..()
|
|
|
|
if(has_alert)
|
|
program_icon_state = "alert-red"
|
|
ui_header = "alarm_red.gif"
|
|
update_computer_icon()
|
|
else
|
|
if(!has_alert)
|
|
program_icon_state = "alert-green"
|
|
ui_header = "alarm_green.gif"
|
|
update_computer_icon()
|
|
return 1
|
|
|
|
/datum/computer_file/program/alarm_monitor/ui_data(mob/user)
|
|
var/list/data = get_header_data()
|
|
|
|
data["alarms"] = list()
|
|
for(var/class in alarms)
|
|
data["alarms"][class] = list()
|
|
for(var/area in alarms[class])
|
|
data["alarms"][class] += area
|
|
|
|
return data
|
|
|
|
/datum/computer_file/program/alarm_monitor/proc/triggerAlarm(class, area/A, O, obj/source)
|
|
if(is_station_level(source.z))
|
|
if(!(A.type in GLOB.the_station_areas))
|
|
return
|
|
else if(!is_mining_level(source.z) || istype(A, /area/ruin))
|
|
return
|
|
|
|
var/list/L = alarms[class]
|
|
for(var/I in L)
|
|
if (I == A.name)
|
|
var/list/alarm = L[I]
|
|
var/list/sources = alarm[3]
|
|
if (!(source in sources))
|
|
sources += source
|
|
return 1
|
|
var/obj/machinery/camera/C = null
|
|
var/list/CL = null
|
|
if(O && istype(O, /list))
|
|
CL = O
|
|
if (CL.len == 1)
|
|
C = CL[1]
|
|
else if(O && istype(O, /obj/machinery/camera))
|
|
C = O
|
|
L[A.name] = list(A, (C ? C : O), list(source))
|
|
|
|
update_alarm_display()
|
|
|
|
return 1
|
|
|
|
|
|
/datum/computer_file/program/alarm_monitor/proc/cancelAlarm(class, area/A, obj/origin)
|
|
var/list/L = alarms[class]
|
|
var/cleared = 0
|
|
var/arealevelalarm = FALSE // set to TRUE for alarms that set/clear whole areas
|
|
if (class=="Fire")
|
|
arealevelalarm = TRUE
|
|
for (var/I in L)
|
|
if (I == A.name)
|
|
if (!arealevelalarm) // the traditional behaviour
|
|
var/list/alarm = L[I]
|
|
var/list/srcs = alarm[3]
|
|
if (origin in srcs)
|
|
srcs -= origin
|
|
if (srcs.len == 0)
|
|
cleared = 1
|
|
L -= I
|
|
else
|
|
L -= I // wipe the instances entirely
|
|
cleared = 1
|
|
|
|
|
|
update_alarm_display()
|
|
return !cleared
|
|
|
|
/datum/computer_file/program/alarm_monitor/proc/update_alarm_display()
|
|
has_alert = FALSE
|
|
for(var/cat in alarms)
|
|
var/list/L = alarms[cat]
|
|
if(L.len)
|
|
has_alert = TRUE
|
|
|
|
/datum/computer_file/program/alarm_monitor/run_program(mob/user)
|
|
. = ..(user)
|
|
GLOB.alarmdisplay += src
|
|
|
|
/datum/computer_file/program/alarm_monitor/kill_program(forced = FALSE)
|
|
GLOB.alarmdisplay -= src
|
|
..()
|