mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
I assume these were all lazy copy-pasting. We're changing computer icons to another set in a file we'll keep separate, and these completely pointless references are annoying. They should inherit this from the `/computer/` level, which they do. Has no effect on Polaris, but cleans up code that shouldn't exist.
63 lines
1.9 KiB
Plaintext
63 lines
1.9 KiB
Plaintext
// POWERNET SENSOR MONITORING CONSOLE
|
|
// Connects to powernet sensors and loads data from them. Shows this data to the user.
|
|
// Newly supports NanoUI.
|
|
|
|
|
|
/obj/machinery/computer/power_monitor
|
|
name = "Power Monitoring Console"
|
|
desc = "Computer designed to remotely monitor power levels around the station"
|
|
icon_keyboard = "power_key"
|
|
icon_screen = "power:0"
|
|
light_color = "#ffcc33"
|
|
|
|
//computer stuff
|
|
density = 1
|
|
anchored = 1.0
|
|
circuit = /obj/item/weapon/circuitboard/powermonitor
|
|
var/alerting = 0
|
|
use_power = 1
|
|
idle_power_usage = 300
|
|
active_power_usage = 300
|
|
var/datum/nano_module/power_monitor/power_monitor
|
|
|
|
// Checks the sensors for alerts. If change (alerts cleared or detected) occurs, calls for icon update.
|
|
/obj/machinery/computer/power_monitor/process()
|
|
var/alert = check_warnings()
|
|
if(alert != alerting)
|
|
alerting = !alerting
|
|
update_icon()
|
|
|
|
// Updates icon of this computer according to current status.
|
|
/obj/machinery/computer/power_monitor/update_icon()
|
|
if(!(stat & (NOPOWER|BROKEN)))
|
|
if(alerting)
|
|
icon_screen = "power:1"
|
|
else
|
|
icon_screen = "power:0"
|
|
..()
|
|
|
|
// On creation automatically connects to active sensors. This is delayed to ensure sensors already exist.
|
|
/obj/machinery/computer/power_monitor/New()
|
|
..()
|
|
power_monitor = new(src)
|
|
|
|
// On user click opens the UI of this computer.
|
|
/obj/machinery/computer/power_monitor/attack_hand(mob/user)
|
|
add_fingerprint(user)
|
|
|
|
if(stat & (BROKEN|NOPOWER))
|
|
return
|
|
ui_interact(user)
|
|
|
|
// Uses dark magic to operate the NanoUI of this computer.
|
|
/obj/machinery/computer/power_monitor/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
|
power_monitor.ui_interact(user, ui_key, ui, force_open)
|
|
|
|
|
|
// Verifies if any warnings were registered by connected sensors.
|
|
/obj/machinery/computer/power_monitor/proc/check_warnings()
|
|
for(var/obj/machinery/power/sensor/S in power_monitor.grid_sensors)
|
|
if(S.check_grid_warning())
|
|
return 1
|
|
return 0
|