mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-04 14:33:10 +00:00
Rock the UI Away - Removes VueUI and adds TGUI (#16509)
* tgui the beginning * binaries and the like * Bring in the last of it * Example radio UI * delete example * NTOS Main Menu, start on manifest, tgui states * tasks.json * gunnery ui pt 1 * okay * fix everything * scss update * oops * manifest gigablast * downloader part 1 * download prt 2 * NTOSDownloader final * mfw committing to_worlds * gunnery console pt2 * i cooked * targeting (finished) * one vueui down * voting ui almost done * MY MIND FEELS LIKE AN ARCH ENEMYYYY * voting ui down * photocopier * ntos config + download fixes * photocopier 2 * refactor define * NTOS client manager + fixes * fax machine final (it also uses toner now) * marching forwards... left behind... * ntnrc part 1 * canister * add quotes * portable pumps pt1 + more backgrounds * oops * finish the portable pump * freezers so I'll keep on pushing forward... you haven't seen the last of me... oooooooh... * doors ui pt1 * finish doors UI (forgive me wildkins it's a bit of shitcode) * vitals monitor, make things use labeled lists, new backgrounds * mais j'envoyé aucun mayday... * maglock pt1 * pour ça je me suis perdu... * infrared * fix that * prox sensor pt1 * prox sensor * signaler (this was actually pretty hard) * atmos control pt1 * atmos control pt1.1 * atmos pt 2 * fuel injector * multitool UI * jammer * list viewer * APC * portgen * targeting console updates + SMES ui * new themes, shield generator * supermatter * Add ore detector and (shitty) NTNet Relay * orderterminal pt1 * orderterminal pt2 * smartfridge * Add (air-)tank GUI update ore detector size * Adds Transfer Valves * Add AtmoScrubber * analyzer pt1 * weapons analyzer pt2 * bodyscanner pt1 * bodyscanner pt2 * fix this shitcode * seed storage * appearance changer * appearance changer final * sleeper pt1 * sleeper * gps * vehicles * chem dispenser * lily request * holopad * tgui modules pt1 * ppanel * damage menu * fixes * im here too now * follow menu, search bars * quikpay * quikpay fixes * circuit printer * ppanel * ppanel updates * pai * turret controls (i want to kill myself) * tweak * remove the boardgame * guntracker * implant tracker * penal mechs come close to me, come close to me * chem codex * pai radio * doorjack * pai directives * signaler removal, sensors * ghost spawner * spawnpoint * fixes * teleporter * one more to the chopping block * account database * remove divider * scanner, atmos * latejoin ui pt1 * latejoin * records pt1 * RECORDS UI DONE * delete interpreter & records * CHAT FUCKING CLIENT * data updates * fix some things * final UI, log * basic nanoui fix * antag panel * remove vueui * atm update * vending update * warrants, cameras * ntmonitor * time comes for all * preserve this legacy * bring that back (oops) * rcon, ui auto update for computer UIs, remove rcon computers * alarm monitoring (a bit broke and also todo: add custom alarm monitoring programs to a few consoles) * A LIKE SUPREME * a * power monitor * lights on * fuck this code, fuck nanoui modules, and fuck nanoui * LEAVE IT OH SO FAR BEHIND * fix alarm monitoring for synths * I SAW IN YOU WHAT LIFE WAS MISSING * comms console * idcard and record updates * turn the light on * arcade * pt2 * news browser * static * crusher * f * COULD I JUST SLEIGH THE GOLD FROM THE BALLS? I'M SO FRUSTRATED OH COULD YOU TELL? IF I HEAR ONE MORE VUEUI OR ONE NANOUI I'M GONNA LOSE IT SO LET ME GOOOOOOOOOOOOOOOOO * codeowners & suit sensors * html ui style removal * make lint happy * resist and disorder * i slowly get up and turn off the noise, already fed up... * pleaseeeeeeeeeeeeeee * THE CREDIT LARP IS NECESSARY * i hold the keys * RISE UP * fix that? * harry's suggestions xoxo * runtime fix pt2 * You are the only thing that I still care about * adds build workflow * Update update_tgui.yml * adds some needed steps * ATM * misc fixes and tweaks * fixes 2 * make newscasters usable and fix use power on freezers * turret control is clearer --------- Co-authored-by: John Wildkins <john.wildkins@gmail.com> Co-authored-by: Matt Atlas <liermattia@gmail.com> Co-authored-by: harryob <55142896+harryob@users.noreply.github.com> Co-authored-by: Werner <Arrow768@users.noreply.github.com> Co-authored-by: Geeves <ggrobler447@gmail.com> Co-authored-by: harryob <me@harryob.live>
This commit is contained in:
@@ -1,43 +1,7 @@
|
||||
// These programs are associated with engineering.
|
||||
|
||||
/datum/computer_file/program/power_monitor
|
||||
filename = "powermonitor"
|
||||
filedesc = "Power Monitoring"
|
||||
nanomodule_path = /datum/nano_module/power_monitor
|
||||
program_icon_state = "power_monitor"
|
||||
program_key_icon_state = "yellow_key"
|
||||
extended_desc = "This program connects to sensors around the station to provide information about electrical systems"
|
||||
ui_header = "power_norm.gif"
|
||||
required_access_run = access_engine
|
||||
required_access_download = access_ce
|
||||
requires_ntnet = TRUE
|
||||
network_destination = "power monitoring system"
|
||||
usage_flags = PROGRAM_ALL
|
||||
size = 9
|
||||
var/has_alert = FALSE
|
||||
color = LIGHT_COLOR_ORANGE
|
||||
|
||||
/datum/computer_file/program/power_monitor/process_tick()
|
||||
..()
|
||||
var/datum/nano_module/power_monitor/NMA = NM
|
||||
if(istype(NMA) && NMA.has_alarm())
|
||||
if(!has_alert)
|
||||
program_icon_state = "power_monitor_warn"
|
||||
ui_header = "power_warn.gif"
|
||||
update_computer_icon()
|
||||
has_alert = TRUE
|
||||
else
|
||||
if(has_alert)
|
||||
program_icon_state = "power_monitor"
|
||||
ui_header = "power_norm.gif"
|
||||
update_computer_icon()
|
||||
has_alert = FALSE
|
||||
|
||||
/datum/computer_file/program/alarm_monitor
|
||||
filename = "alarmmonitor"
|
||||
filedesc = "Alarm Monitoring"
|
||||
program_key_icon_state = "cyan_key"
|
||||
nanomodule_path = /datum/nano_module/alarm_monitor/engineering
|
||||
ui_header = "alarm_green.gif"
|
||||
program_icon_state = "alert:0"
|
||||
extended_desc = "This program provides visual interface for station's alarm system."
|
||||
@@ -45,13 +9,125 @@
|
||||
network_destination = "alarm monitoring network"
|
||||
usage_flags = PROGRAM_ALL
|
||||
size = 5
|
||||
var/has_alert = FALSE
|
||||
color = LIGHT_COLOR_CYAN
|
||||
tgui_id = "AlarmMonitoring"
|
||||
var/list_cameras = 0 // Whether or not to list camera references. A future goal would be to merge this with the enginering/security camera console. Currently really only for AI-use.
|
||||
var/list/datum/alarm_handler/alarm_handlers // The particular list of alarm handlers this alarm monitor should present to the user.
|
||||
var/has_alert = FALSE
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/New()
|
||||
..()
|
||||
alarm_handlers = list()
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/all
|
||||
filename = "alarmmonitorall"
|
||||
filedesc = "Alarm Monitoring (All)"
|
||||
required_access_download = access_heads
|
||||
required_access_run = access_heads
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/all/New()
|
||||
..()
|
||||
alarm_handlers = SSalarm.all_handlers
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/engineering
|
||||
filename = "alarmmonitoreng"
|
||||
filedesc = "Alarm Monitoring (Engineering)"
|
||||
required_access_download = access_engine
|
||||
required_access_run = access_engine
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/engineering/New()
|
||||
..()
|
||||
alarm_handlers = list(atmosphere_alarm, camera_alarm, fire_alarm, power_alarm)
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/security
|
||||
filename = "alarmmonitorsec"
|
||||
filedesc = "Alarm Monitoring (Security)"
|
||||
required_access_download = access_security
|
||||
required_access_run = access_security
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/security/New()
|
||||
..()
|
||||
alarm_handlers = list(camera_alarm, motion_alarm)
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/proc/register_alarm(var/object, var/procName)
|
||||
for(var/datum/alarm_handler/AH in alarm_handlers)
|
||||
AH.register_alarm(object, procName)
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/proc/unregister_alarm(var/object)
|
||||
for(var/datum/alarm_handler/AH in alarm_handlers)
|
||||
AH.unregister_alarm(object)
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/proc/all_alarms()
|
||||
var/list/all_alarms = new()
|
||||
for(var/datum/alarm_handler/AH in alarm_handlers)
|
||||
all_alarms += AH.alarms
|
||||
|
||||
return all_alarms
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/proc/major_alarms()
|
||||
var/list/all_alarms = new()
|
||||
for(var/datum/alarm_handler/AH in alarm_handlers)
|
||||
all_alarms += AH.major_alarms()
|
||||
|
||||
return all_alarms
|
||||
|
||||
// Modified version of above proc that uses slightly less resources, returns 1 if there is a major alarm, 0 otherwise.
|
||||
/datum/computer_file/program/alarm_monitor/proc/has_major_alarms()
|
||||
for(var/datum/alarm_handler/AH in alarm_handlers)
|
||||
if(AH.has_major_alarms())
|
||||
return TRUE
|
||||
|
||||
return FALSE
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/proc/minor_alarms()
|
||||
var/list/all_alarms = new()
|
||||
for(var/datum/alarm_handler/AH in alarm_handlers)
|
||||
all_alarms += AH.minor_alarms()
|
||||
|
||||
return all_alarms
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(action == "switchTo")
|
||||
var/obj/machinery/camera/C = locate(params["switchTo"]) in cameranet.cameras
|
||||
if(!C)
|
||||
return
|
||||
|
||||
usr.switch_to_camera(C)
|
||||
return 1
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/ui_data(mob/user)
|
||||
. = ..()
|
||||
var/list/data = initial_data()
|
||||
|
||||
var/list/categories = list()
|
||||
for(var/datum/alarm_handler/AH in alarm_handlers)
|
||||
categories += list(list("category" = AH.category, "alarms" = list()))
|
||||
for(var/datum/alarm/A in AH.major_alarms())
|
||||
var/list/cameras = list()
|
||||
var/list/lost_sources = list()
|
||||
|
||||
if(isAI(user))
|
||||
for(var/obj/machinery/camera/C in A.cameras())
|
||||
cameras += list(C.nano_structure())
|
||||
for(var/datum/alarm_source/AS in A.sources)
|
||||
if(!AS.source)
|
||||
lost_sources += list(AS.source_name)
|
||||
|
||||
categories[categories.len]["alarms"] += list(list(
|
||||
"name" = sanitize(A.alarm_name()),
|
||||
"origin_lost" = A.origin == null,
|
||||
"has_cameras" = cameras.len,
|
||||
"cameras" = cameras,
|
||||
"lost_sources" = lost_sources.len ? sanitize(english_list(lost_sources, nothing_text = "", and_text = ", ")) : ""))
|
||||
data["categories"] = categories
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/alarm_monitor/process_tick()
|
||||
..()
|
||||
var/datum/nano_module/alarm_monitor/NMA = NM
|
||||
if(istype(NMA) && NMA.has_major_alarms())
|
||||
if(has_major_alarms())
|
||||
if(!has_alert)
|
||||
program_icon_state = "alert:2"
|
||||
ui_header = "alarm_red.gif"
|
||||
@@ -65,51 +141,3 @@
|
||||
has_alert = FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/atmos_control
|
||||
filename = "atmoscontrol"
|
||||
filedesc = "Atmosphere Control"
|
||||
nanomodule_path = /datum/nano_module/atmos_control
|
||||
program_icon_state = "atmos_control"
|
||||
program_key_icon_state = "cyan_key"
|
||||
extended_desc = "This program allows remote control of air alarms around the station. This program can not be run on tablet computers."
|
||||
required_access_run = access_atmospherics
|
||||
required_access_download = access_ce
|
||||
requires_ntnet = TRUE
|
||||
network_destination = "atmospheric control system"
|
||||
requires_ntnet_feature = NTNET_SYSTEMCONTROL
|
||||
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP | PROGRAM_STATIONBOUND
|
||||
size = 17
|
||||
color = LIGHT_COLOR_CYAN
|
||||
|
||||
/datum/computer_file/program/rcon_console
|
||||
filename = "rcon"
|
||||
filedesc = "RCON Remote Control"
|
||||
nanomodule_path = /datum/nano_module/rcon
|
||||
program_icon_state = "power_monitor"
|
||||
program_key_icon_state = "yellow_key"
|
||||
extended_desc = "This program allows remote control of power distribution systems around the station. This program can not be run on tablet computers."
|
||||
required_access_run = access_engine
|
||||
required_access_download = access_ce
|
||||
requires_ntnet = TRUE
|
||||
network_destination = "RCON remote control system"
|
||||
requires_ntnet_feature = NTNET_SYSTEMCONTROL
|
||||
usage_flags = PROGRAM_CONSOLE | PROGRAM_STATIONBOUND
|
||||
size = 19
|
||||
color = LIGHT_COLOR_YELLOW
|
||||
|
||||
// Night-Mode Toggle for CE
|
||||
/datum/computer_file/program/lighting_control
|
||||
filename = "lightctrl"
|
||||
filedesc = "Lighting Controller"
|
||||
nanomodule_path = /datum/nano_module/lighting_ctrl
|
||||
program_icon_state = "power_monitor"
|
||||
program_key_icon_state = "yellow_key"
|
||||
extended_desc = "This program allows mass-control of the station's lighting systems. This program cannot be run on tablet computers."
|
||||
required_access_run = access_heads
|
||||
required_access_download = access_ce
|
||||
requires_ntnet = TRUE
|
||||
network_destination = "APC Coordinator"
|
||||
requires_ntnet_feature = NTNET_SYSTEMCONTROL
|
||||
usage_flags = PROGRAM_CONSOLE | PROGRAM_STATIONBOUND
|
||||
size = 9
|
||||
color = LIGHT_COLOR_GREEN
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/datum/computer_file/program/atmos_control
|
||||
filename = "atmoscontrol"
|
||||
filedesc = "Atmosphere Control"
|
||||
program_icon_state = "atmos_control"
|
||||
program_key_icon_state = "cyan_key"
|
||||
extended_desc = "This program allows remote control of air alarms around the station. This program can not be run on tablet computers."
|
||||
requires_access_to_run = PROGRAM_ACCESS_LIST_ONE
|
||||
required_access_run = list(access_atmospherics)
|
||||
required_access_download = list(access_atmospherics)
|
||||
requires_ntnet = TRUE
|
||||
network_destination = "atmospheric control system"
|
||||
requires_ntnet_feature = NTNET_SYSTEMCONTROL
|
||||
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP | PROGRAM_STATIONBOUND
|
||||
size = 17
|
||||
color = LIGHT_COLOR_CYAN
|
||||
tgui_id = "AtmosAlarmControl"
|
||||
tgui_theme = "hephaestus"
|
||||
|
||||
var/list/monitored_alarms = list()
|
||||
|
||||
/datum/computer_file/program/atmos_control/New(obj/item/modular_computer/comp, var/list/new_access, var/list/monitored_alarm_ids)
|
||||
..()
|
||||
|
||||
if(islist(new_access) && length(new_access))
|
||||
required_access_run = new_access
|
||||
|
||||
get_alarms(monitored_alarm_ids)
|
||||
// machines may not yet be ordered at this point
|
||||
sortTim(monitored_alarms, GLOBAL_PROC_REF(cmp_name_asc), FALSE)
|
||||
|
||||
/datum/computer_file/program/atmos_control/proc/get_alarms(var/list/monitored_alarm_ids)
|
||||
if(computer)
|
||||
if(monitored_alarm_ids)
|
||||
for(var/obj/machinery/alarm/alarm in SSmachinery.processing)
|
||||
if(alarm.alarm_id && (alarm.alarm_id in monitored_alarm_ids) && AreConnectedZLevels(computer.z, alarm.z))
|
||||
monitored_alarms += alarm
|
||||
else
|
||||
for(var/obj/machinery/alarm/alarm in SSmachinery.processing)
|
||||
var/turf/T = get_turf(computer) /// The computer of a silicon has null Z, so...
|
||||
if(AreConnectedZLevels(T.z, alarm.z))
|
||||
monitored_alarms += alarm
|
||||
|
||||
/datum/computer_file/program/atmos_control/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(action == "alarm")
|
||||
var/obj/machinery/alarm/alarm = locate(params["alarm"]) in (monitored_alarms.len ? monitored_alarms : SSmachinery.processing)
|
||||
if(alarm)
|
||||
var/datum/ui_state/TS = generate_state(alarm)
|
||||
alarm.ui_interact(usr, state = TS) //what the fuck?
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/atmos_control/ui_data(mob/user)
|
||||
var/list/data = initial_data()
|
||||
|
||||
/// It is possible that a program may have a null computer at roundstart... somehow.
|
||||
if(!length(monitored_alarms))
|
||||
get_alarms()
|
||||
|
||||
var/alarms = list()
|
||||
for(var/obj/machinery/alarm/alarm in monitored_alarms)
|
||||
alarms += list(list(
|
||||
"name" = sanitize(alarm.name),
|
||||
"ref"= "\ref[alarm]",
|
||||
"danger" = max(alarm.danger_level, alarm.alarm_area.atmosalm)
|
||||
))
|
||||
data["alarms"] = alarms
|
||||
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/atmos_control/proc/generate_state(air_alarm)
|
||||
var/datum/ui_state/air_alarm/state = new()
|
||||
state.atmos_control = src
|
||||
state.air_alarm = air_alarm
|
||||
return state
|
||||
|
||||
/datum/ui_state/air_alarm
|
||||
var/datum/computer_file/program/atmos_control/atmos_control
|
||||
var/obj/machinery/alarm/air_alarm
|
||||
|
||||
/datum/ui_state/air_alarm/can_use_topic(var/src_object, var/mob/user)
|
||||
var/obj/item/card/id/I = user.GetIdCard()
|
||||
if(has_access(req_one_access = atmos_control.required_access_run, accesses = I.GetAccess()))
|
||||
return STATUS_INTERACTIVE
|
||||
return STATUS_UPDATE
|
||||
|
||||
/datum/ui_state/air_alarm/href_list(var/mob/user)
|
||||
var/list/extra_href = list()
|
||||
extra_href["remote_connection"] = TRUE
|
||||
extra_href["remote_access"] = can_access(user)
|
||||
|
||||
return extra_href
|
||||
|
||||
/datum/ui_state/air_alarm/proc/can_access(var/mob/user)
|
||||
var/obj/item/card/id/I = user.GetIdCard()
|
||||
return user && (isAI(user) || has_access(req_one_access = atmos_control.required_access_run, accesses = I.GetAccess()) || atmos_control.computer_emagged || air_alarm.rcon_setting == RCON_YES || (air_alarm.alarm_area.atmosalm && air_alarm.rcon_setting == RCON_AUTO))
|
||||
@@ -0,0 +1,60 @@
|
||||
/datum/computer_file/program/lighting_control
|
||||
filename = "lightctrl"
|
||||
filedesc = "Lighting Controller"
|
||||
program_icon_state = "power_monitor"
|
||||
program_key_icon_state = "yellow_key"
|
||||
extended_desc = "This program allows mass-control of the station's lighting systems. This program cannot be run on tablet computers."
|
||||
required_access_run = access_heads
|
||||
required_access_download = access_ce
|
||||
requires_ntnet = TRUE
|
||||
network_destination = "APC Coordinator"
|
||||
requires_ntnet_feature = NTNET_SYSTEMCONTROL
|
||||
usage_flags = PROGRAM_CONSOLE | PROGRAM_STATIONBOUND
|
||||
size = 9
|
||||
color = LIGHT_COLOR_GREEN
|
||||
tgui_id = "LightingControl"
|
||||
tgui_theme = "hephaestus"
|
||||
|
||||
var/context = "pub"
|
||||
var/lstate = "full"
|
||||
var/datum/weakref/lusr
|
||||
|
||||
/datum/computer_file/program/lighting_control/New()
|
||||
..()
|
||||
lstate = SSnightlight.is_active() ? "dark" : "full"
|
||||
|
||||
/datum/computer_file/program/lighting_control/proc/update_lighting()
|
||||
|
||||
// whether to only select areas explicitly marked for nightlighting
|
||||
var/wl_only = context == "all" ? 0 : 1
|
||||
|
||||
SSnightlight.suspend()
|
||||
|
||||
if (lstate == "dark")
|
||||
log_and_message_admins("enabled night-mode [wl_only ? "in public areas" : "globally"].", lusr.resolve())
|
||||
SSnightlight.activate(wl_only)
|
||||
else if (lstate == "full")
|
||||
log_and_message_admins("disabled night-mode [wl_only ? "in public areas" : "globally"].", lusr.resolve())
|
||||
SSnightlight.deactivate(wl_only)
|
||||
|
||||
/datum/computer_file/program/lighting_control/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if ("context")
|
||||
context = params["context"]
|
||||
. = TRUE
|
||||
if ("mode")
|
||||
lstate = params["mode"]
|
||||
. = TRUE
|
||||
if ("set")
|
||||
update_lighting()
|
||||
|
||||
/datum/computer_file/program/lighting_control/ui_data(mob/user)
|
||||
var/list/data = initial_data()
|
||||
|
||||
lusr = WEAKREF(user)
|
||||
data["context"] = context
|
||||
data["status"] = lstate
|
||||
|
||||
return data
|
||||
@@ -0,0 +1,89 @@
|
||||
/datum/computer_file/program/power_monitor
|
||||
filename = "powermonitor"
|
||||
filedesc = "Power Monitoring"
|
||||
program_icon_state = "power_monitor"
|
||||
program_key_icon_state = "yellow_key"
|
||||
extended_desc = "This program connects to sensors around the station to provide information about electrical systems"
|
||||
ui_header = "power_norm.gif"
|
||||
required_access_run = access_engine
|
||||
required_access_download = access_ce
|
||||
requires_ntnet = TRUE
|
||||
network_destination = "power monitoring system"
|
||||
usage_flags = PROGRAM_ALL
|
||||
size = 9
|
||||
color = LIGHT_COLOR_ORANGE
|
||||
tgui_id = "PowerMonitor"
|
||||
tgui_theme = "hephaestus"
|
||||
var/has_alert = FALSE
|
||||
var/list/grid_sensors
|
||||
var/active_sensor //name_tag of the currently selected sensor
|
||||
|
||||
/datum/computer_file/program/power_monitor/ui_data(mob/user)
|
||||
var/list/data = initial_data()
|
||||
|
||||
var/list/sensors = list()
|
||||
// Focus: If it remains null if no sensor is selected and UI will display sensor list, otherwise it will display sensor reading.
|
||||
var/obj/machinery/power/sensor/focus
|
||||
|
||||
// Build list of data from sensor readings.
|
||||
for(var/obj/machinery/power/sensor/S in grid_sensors)
|
||||
sensors.Add(list(list(
|
||||
"name" = S.name_tag,
|
||||
"alarm" = S.check_grid_warning()
|
||||
)))
|
||||
if(S.name_tag == active_sensor)
|
||||
focus = S
|
||||
|
||||
data["all_sensors"] = sensors
|
||||
if(focus)
|
||||
data["focus"] = focus.return_reading_data()
|
||||
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/power_monitor/proc/has_alarm()
|
||||
for(var/obj/machinery/power/sensor/S in grid_sensors)
|
||||
if(S.check_grid_warning())
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
// Refreshes list of active sensors kept on this computer.
|
||||
/datum/computer_file/program/power_monitor/proc/refresh_sensors()
|
||||
grid_sensors = list()
|
||||
var/turf/T = get_turf(ui_host())
|
||||
if(!T) // Safety check
|
||||
return
|
||||
for(var/obj/machinery/power/sensor/S in SSmachinery.all_sensors)
|
||||
if(AreConnectedZLevels(S.z, computer.z) || (S.long_range))
|
||||
if(S.name_tag == "#UNKN#") // Default name. Shouldn't happen!
|
||||
warning("Powernet sensor with unset ID Tag! [S.x]X [S.y]Y [S.z]Z")
|
||||
else
|
||||
grid_sensors += S
|
||||
|
||||
// Allows us to process UI clicks, which are relayed in form of hrefs.
|
||||
/datum/computer_file/program/power_monitor/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
if(..())
|
||||
return
|
||||
if(action == "clear")
|
||||
active_sensor = null
|
||||
. = TRUE
|
||||
if(action == "refresh")
|
||||
refresh_sensors()
|
||||
. = TRUE
|
||||
if(action == "setsensor")
|
||||
active_sensor = params["setsensor"]
|
||||
. = TRUE
|
||||
|
||||
/datum/computer_file/program/power_monitor/process_tick()
|
||||
..()
|
||||
if(has_alarm())
|
||||
if(!has_alert)
|
||||
program_icon_state = "power_monitor_warn"
|
||||
ui_header = "power_warn.gif"
|
||||
update_computer_icon()
|
||||
has_alert = TRUE
|
||||
else
|
||||
if(has_alert)
|
||||
program_icon_state = "power_monitor"
|
||||
ui_header = "power_norm.gif"
|
||||
update_computer_icon()
|
||||
has_alert = FALSE
|
||||
@@ -0,0 +1,110 @@
|
||||
/datum/computer_file/program/rcon_console
|
||||
filename = "rcon"
|
||||
filedesc = "RCON Remote Control"
|
||||
program_icon_state = "power_monitor"
|
||||
program_key_icon_state = "yellow_key"
|
||||
extended_desc = "This program allows remote control of power distribution systems around the station. This program can not be run on tablet computers."
|
||||
required_access_run = access_engine
|
||||
required_access_download = access_ce
|
||||
requires_ntnet = TRUE
|
||||
network_destination = "RCON remote control system"
|
||||
requires_ntnet_feature = NTNET_SYSTEMCONTROL
|
||||
usage_flags = PROGRAM_CONSOLE | PROGRAM_STATIONBOUND
|
||||
size = 19
|
||||
color = LIGHT_COLOR_YELLOW
|
||||
tgui_id = "RCON"
|
||||
tgui_theme = "hephaestus"
|
||||
ui_auto_update = FALSE
|
||||
|
||||
/datum/computer_file/program/rcon_console/ui_static_data(mob/user)
|
||||
var/list/data = initial_data()
|
||||
|
||||
var/list/smeslist = list()
|
||||
for(var/obj/machinery/power/smes/buildable/SMES in SSmachinery.rcon_smes_units)
|
||||
smeslist.Add(list(list(
|
||||
"charge" = round(SMES.Percentage()),
|
||||
"input_set" = SMES.input_attempt,
|
||||
"input_val" = round(SMES.input_level),
|
||||
"output_set" = SMES.output_attempt,
|
||||
"output_val" = round(SMES.output_level),
|
||||
"input_level_max" = SMES.input_level_max,
|
||||
"output_level_max" = SMES.output_level_max,
|
||||
"output_load" = round(SMES.output_used),
|
||||
"RCON_tag" = SMES.RCon_tag
|
||||
)))
|
||||
|
||||
data["smes_info"] = smeslist
|
||||
// BREAKER DATA (simplified view)
|
||||
var/list/breakerlist = list()
|
||||
for(var/obj/machinery/power/breakerbox/BR in SSmachinery.rcon_breaker_units)
|
||||
breakerlist.Add(list(list(
|
||||
"RCON_tag" = BR.RCon_tag,
|
||||
"enabled" = BR.on,
|
||||
"update_locked" = BR.update_locked,
|
||||
)))
|
||||
data["breaker_info"] = breakerlist
|
||||
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/rcon_console/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("smes_in_toggle")
|
||||
var/obj/machinery/power/smes/buildable/SMES = GetSMESByTag(params["smes_in_toggle"])
|
||||
if(SMES)
|
||||
SMES.toggle_input()
|
||||
computer.update_static_data_for_all_viewers()
|
||||
. = TRUE
|
||||
|
||||
if("smes_out_toggle")
|
||||
var/obj/machinery/power/smes/buildable/SMES = GetSMESByTag(params["smes_out_toggle"])
|
||||
if(SMES)
|
||||
SMES.toggle_output()
|
||||
computer.update_static_data_for_all_viewers()
|
||||
. = TRUE
|
||||
|
||||
if("smes_in_set")
|
||||
var/obj/machinery/power/smes/buildable/SMES = GetSMESByTag(params["smes_in_set"])
|
||||
if(SMES)
|
||||
SMES.set_input(params["value"])
|
||||
computer.update_static_data_for_all_viewers()
|
||||
. = TRUE
|
||||
|
||||
if("smes_out_set")
|
||||
var/obj/machinery/power/smes/buildable/SMES = GetSMESByTag(params["smes_out_set"])
|
||||
if(SMES)
|
||||
SMES.set_output(params["value"])
|
||||
computer.update_static_data_for_all_viewers()
|
||||
. = TRUE
|
||||
|
||||
if("smes_in_max")
|
||||
var/obj/machinery/power/smes/buildable/SMES = GetSMESByTag(params["smes_in_max"])
|
||||
if(SMES)
|
||||
SMES.set_input(SMES.input_level_max)
|
||||
computer.update_static_data_for_all_viewers()
|
||||
. = TRUE
|
||||
|
||||
if("smes_out_max")
|
||||
var/obj/machinery/power/smes/buildable/SMES = GetSMESByTag(params["smes_out_max"])
|
||||
if(SMES)
|
||||
SMES.set_output(SMES.output_level_max)
|
||||
computer.update_static_data_for_all_viewers()
|
||||
. = TRUE
|
||||
|
||||
if("toggle_breaker")
|
||||
var/obj/machinery/power/breakerbox/toggle = SSmachinery.rcon_breaker_units_by_tag[params["toggle_breaker"]]
|
||||
if(toggle)
|
||||
if(toggle.update_locked)
|
||||
to_chat(usr, SPAN_WARNING("The breaker box was recently toggled. Please wait before toggling it again."))
|
||||
else
|
||||
toggle.auto_toggle()
|
||||
computer.update_static_data_for_all_viewers()
|
||||
. = TRUE
|
||||
|
||||
/datum/computer_file/program/rcon_console/proc/GetSMESByTag(var/tag)
|
||||
if(!tag)
|
||||
return
|
||||
|
||||
return SSmachinery.rcon_smes_units_by_tag[tag]
|
||||
Reference in New Issue
Block a user