diff --git a/code/game/machinery/computer/shutoff_monitor.dm b/code/game/machinery/computer/shutoff_monitor.dm index 4dd79376c9..9bb2146116 100644 --- a/code/game/machinery/computer/shutoff_monitor.dm +++ b/code/game/machinery/computer/shutoff_monitor.dm @@ -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))) diff --git a/html/changelogs/Atermonera - Shutoff_monitor.yml b/html/changelogs/Atermonera - Shutoff_monitor.yml new file mode 100644 index 0000000000..9ac41090ed --- /dev/null +++ b/html/changelogs/Atermonera - Shutoff_monitor.yml @@ -0,0 +1,4 @@ +author: Atermonera +delete-after: True +changes: + - rscadd: "Shutoff valve monitoring console can now remotely control shutoff valves." \ No newline at end of file diff --git a/nano/templates/shutoff_monitor.tmpl b/nano/templates/shutoff_monitor.tmpl index eef6ea4a38..1b6cb6fe15 100644 --- a/nano/templates/shutoff_monitor.tmpl +++ b/nano/templates/shutoff_monitor.tmpl @@ -7,8 +7,8 @@
- {{: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})}} Coordinates: ({{:value.x}}, {{:value.y}}, {{:value.z}})