mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Add commands for digital valves.
This commit is contained in:
@@ -755,6 +755,7 @@
|
||||
#include "code\modules\assembly\voice.dm"
|
||||
#include "code\modules\atmos_automation\console.dm"
|
||||
#include "code\modules\atmos_automation\statements.dm"
|
||||
#include "code\modules\atmos_automation\implementation\digital_valves.dm"
|
||||
#include "code\modules\atmos_automation\implementation\injectors.dm"
|
||||
#include "code\modules\atmos_automation\implementation\sensors.dm"
|
||||
#include "code\modules\atmos_automation\implementation\vent_pump.dm"
|
||||
|
||||
@@ -298,6 +298,7 @@
|
||||
update_icon()
|
||||
|
||||
interact(mob/user as mob)
|
||||
update_multitool_menu()
|
||||
|
||||
multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
|
||||
@@ -261,6 +261,59 @@ obj/machinery/atmospherics/valve
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
|
||||
|
||||
multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
|
||||
<li><b>ID Tag:</b> <a href="?src=\ref[src];set_tag=1">[id]</a></li>
|
||||
</ul>
|
||||
"}
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(!issilicon(usr))
|
||||
if(!istype(usr.get_active_hand(), /obj/item/device/multitool))
|
||||
return
|
||||
|
||||
var/obj/item/device/multitool/P = get_multitool(usr)
|
||||
|
||||
if("set_id" in href_list)
|
||||
var/newid = copytext(reject_bad_text(input(usr, "Specify the new ID tag for this machine", src, id) as null|text),1,MAX_MESSAGE_LEN)
|
||||
if(newid)
|
||||
id = newid
|
||||
initialize()
|
||||
if("set_freq" in href_list)
|
||||
var/newfreq=frequency
|
||||
if(href_list["set_freq"]!="-1")
|
||||
newfreq=text2num(href_list["set_freq"])
|
||||
else
|
||||
newfreq = input(usr, "Specify a new frequency (GHz). Decimals assigned automatically.", src, frequency) as null|num
|
||||
if(newfreq)
|
||||
if(findtext(num2text(newfreq), "."))
|
||||
newfreq *= 10 // shift the decimal one place
|
||||
if(newfreq < 10000)
|
||||
frequency = newfreq
|
||||
initialize()
|
||||
|
||||
if(href_list["unlink"])
|
||||
P.visible_message("\The [P] buzzes in an annoying tone.","You hear a buzz.")
|
||||
|
||||
if(href_list["link"])
|
||||
P.visible_message("\The [P] buzzes in an annoying tone.","You hear a buzz.")
|
||||
|
||||
if(href_list["buffer"])
|
||||
P.buffer = src
|
||||
|
||||
if(href_list["flush"])
|
||||
P.buffer = null
|
||||
|
||||
usr.set_machine(src)
|
||||
updateUsrDialog()
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id))
|
||||
return 0
|
||||
@@ -274,6 +327,14 @@ obj/machinery/atmospherics/valve
|
||||
if(open)
|
||||
close()
|
||||
|
||||
if("valve_set")
|
||||
if(signal.data["state"])
|
||||
if(!open)
|
||||
open()
|
||||
else
|
||||
if(open)
|
||||
close()
|
||||
|
||||
if("valve_toggle")
|
||||
if(open)
|
||||
close()
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
/datum/automation/set_valve_state
|
||||
name = "Digital Valve: Set Open/Closed"
|
||||
var/valve=null
|
||||
var/state=0
|
||||
|
||||
process()
|
||||
if(valve)
|
||||
parent.send_signal(list ("tag" = valve, "command"="valve_set","state"=state))
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "Set digital valve <a href=\"?src=\ref[src];set_subject=1\">[fmtString(valve)]</a> to <a href=\"?src=\ref[src];set_state=1\">[state?"open":"closed"]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(href_list["set_state"])
|
||||
state=!state
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_subject"])
|
||||
var/list/valves=list()
|
||||
for(var/obj/machinery/atmospherics/valve/digital/V in machines)
|
||||
if(!isnull(V.id) && V.frequency == parent.frequency)
|
||||
valves|=V.id
|
||||
valve = input("Select a valve:", "Sensor Data", valve) as null|anything in valves
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
@@ -7,11 +7,6 @@
|
||||
var/injector=null
|
||||
var/state=0
|
||||
|
||||
valid_child_returntypes=list(AUTOM_RT_NUM)
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
|
||||
process()
|
||||
if(injector)
|
||||
parent.send_signal(list ("tag" = injector, "power"=state))
|
||||
@@ -33,3 +28,30 @@
|
||||
injector = input("Select an injector:", "Sensor Data", injector) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
/datum/automation/set_injector_rate
|
||||
name = "Injector: Rate"
|
||||
var/injector=null
|
||||
var/rate=0
|
||||
|
||||
process()
|
||||
if(injector)
|
||||
parent.send_signal(list ("tag" = injector, "set_volume_rate"=rate))
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "Set injector <a href=\"?src=\ref[src];set_injector=1\">[fmtString(injector)]</a> transfer rate to <a href=\"?src=\ref[src];set_rate=1\">[rate]</a> L/s."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(href_list["set_rate"])
|
||||
rate = input("Set rate in L/s.", "Rate", rate) as num
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_injector"])
|
||||
var/list/injector_names=list()
|
||||
for(var/obj/machinery/atmospherics/unary/outlet_injector/I in machines)
|
||||
if(!isnull(I.id) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id
|
||||
injector = input("Select an injector:", "Sensor Data", injector) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
Reference in New Issue
Block a user