mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Merge pull request #6562 from VOREStation/upstream-merge-6687
[MIRROR] Shutoff monitoring console remotely controls valves
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
var/data[0]
|
||||
data["valves"] = list()
|
||||
for(var/obj/machinery/atmospherics/valve/shutoff/S in GLOB.shutoff_valves)
|
||||
data["valves"][++data["valves"].len] = list("name" = S.name, "enable" = S.close_on_leaks, "open" = S.open, "x" = S.x, "y" = S.y, "z" = S.z)
|
||||
data["valves"][++data["valves"].len] = list("name" = S.name, "enable" = S.close_on_leaks, "open" = S.open, "x" = S.x, "y" = S.y, "z" = S.z, "ref" = "\ref[S]")
|
||||
|
||||
// update the ui if it exists, returns null if no ui is passed/found
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
@@ -36,6 +36,34 @@
|
||||
// auto update every 20 Master Controller tick
|
||||
ui.set_auto_update(20) // Longer term to reduce the rate of data collection and processing
|
||||
|
||||
/obj/machinery/computer/shutoff_monitor/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if(href_list["toggle_enable"])
|
||||
var/obj/machinery/atmospherics/valve/shutoff/S = locate(href_list["toggle_enable"])
|
||||
|
||||
// Invalid ref
|
||||
if(!istype(S))
|
||||
return 0
|
||||
|
||||
S.close_on_leaks = !S.close_on_leaks
|
||||
|
||||
if(href_list["toggle_open"])
|
||||
var/obj/machinery/atmospherics/valve/shutoff/S = locate(href_list["toggle_open"])
|
||||
|
||||
// Invalid ref
|
||||
if(!istype(S))
|
||||
return 0
|
||||
|
||||
if(S.open)
|
||||
S.close()
|
||||
else
|
||||
S.open()
|
||||
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/computer/shutoff_monitor/update_icon()
|
||||
..()
|
||||
if(!(stat & (NOPOWER|BROKEN)))
|
||||
|
||||
4
html/changelogs/Atermonera - Shutoff_monitor.yml
Normal file
4
html/changelogs/Atermonera - Shutoff_monitor.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
author: Atermonera
|
||||
delete-after: True
|
||||
changes:
|
||||
- rscadd: "Shutoff valve monitoring console can now remotely control shutoff valves."
|
||||
@@ -7,8 +7,8 @@
|
||||
</div>
|
||||
<div class="itemContent" style="width:55%;">
|
||||
<span style="display:inline-block;width:45%;min-width:150px;">
|
||||
{{:helper.link(value.open ? 'Open' : 'Closed', 'alert', null, 'disabled', value.open ? 'greenButton' : 'redButton')}}
|
||||
{{:helper.link(value.enable ? 'Enabled' : 'Disabled', 'alert', null, 'disabled', value.enable ? 'greenButton' : 'redButton')}}
|
||||
{{:helper.link(value.open ? 'Open' : 'Closed', 'alert', {'toggle_open' : value.ref})}}
|
||||
{{:helper.link(value.enable ? 'Enabled' : 'Disabled', 'alert', {'toggle_enable' : value.ref})}}
|
||||
</span>
|
||||
<span style="display:inline-block;width:55%;min-width:150px;">
|
||||
Coordinates: ({{:value.x}}, {{:value.y}}, {{:value.z}})
|
||||
|
||||
Reference in New Issue
Block a user