mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-29 11:32:13 +00:00
46 lines
1.0 KiB
Plaintext
46 lines
1.0 KiB
Plaintext
/datum/tgui_module/shutoff_monitor
|
|
name = "Shutoff Valve Monitoring"
|
|
tgui_id = "ShutoffMonitor"
|
|
|
|
/datum/tgui_module/shutoff_monitor/tgui_act(action, params)
|
|
if(..())
|
|
return TRUE
|
|
|
|
switch(action)
|
|
if("toggle_enable")
|
|
var/obj/machinery/atmospherics/valve/shutoff/S = locate(params["valve"])
|
|
if(!istype(S))
|
|
return FALSE
|
|
S.close_on_leaks = !S.close_on_leaks
|
|
return TRUE
|
|
|
|
if("toggle_open")
|
|
var/obj/machinery/atmospherics/valve/shutoff/S = locate(params["valve"])
|
|
if(!istype(S))
|
|
return FALSE
|
|
if(S.open)
|
|
S.close()
|
|
else
|
|
S.open()
|
|
return TRUE
|
|
|
|
/datum/tgui_module/shutoff_monitor/tgui_data(mob/user)
|
|
var/list/data = list()
|
|
var/list/valves = list()
|
|
|
|
for(var/obj/machinery/atmospherics/valve/shutoff/S in GLOB.shutoff_valves)
|
|
valves.Add(list(list(
|
|
"name" = S.name,
|
|
"enabled" = S.close_on_leaks,
|
|
"open" = S.open,
|
|
"x" = S.x,
|
|
"y" = S.y,
|
|
"z" = S.z,
|
|
"ref" = "\ref[S]"
|
|
)))
|
|
|
|
data["valves"] = valves
|
|
return data
|
|
|
|
/datum/tgui_module/shutoff_monitor/ntos
|
|
ntos = TRUE |