mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-26 10:12:17 +00:00
/vg/ Multitool menu port!
With 100% better squashing. I hope.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
|
||||
|
||||
/datum/automation/set_valve_state
|
||||
name = "Digital Valve: Set Open/Closed"
|
||||
var/valve=null
|
||||
var/state=0
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["valve"]=valve
|
||||
json["state"]=state
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
valve = json["valve"]
|
||||
state = text2num(json["state"])
|
||||
|
||||
process()
|
||||
if(valve)
|
||||
parent.send_signal(list ("tag" = valve, "command"="valve_set","valve_set"=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(..())
|
||||
return 1
|
||||
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 world)
|
||||
if(!isnull(V.id_tag) && V.frequency == parent.frequency)
|
||||
valves|=V.id_tag
|
||||
if(valves.len==0)
|
||||
usr << "<span class='warning'>Unable to find any digital valves on this frequency.</span>"
|
||||
return
|
||||
valve = input("Select a valve:", "Sensor Data", valve) as null|anything in valves
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
42
code/modules/atmos_automation/implementation/emitters.dm
Normal file
42
code/modules/atmos_automation/implementation/emitters.dm
Normal file
@@ -0,0 +1,42 @@
|
||||
/datum/automation/set_emitter_power
|
||||
name = "Emitter: Set Power"
|
||||
var/emitter=null
|
||||
var/on=0
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["emitter"]=emitter
|
||||
json["on"]=on
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
emitter = json["emitter"]
|
||||
on = text2num(json["on"])
|
||||
|
||||
process()
|
||||
if(emitter)
|
||||
parent.send_signal(list ("tag" = emitter, "command"="set","state"=on))
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "Set emitter <a href=\"?src=\ref[src];set_subject=1\">[fmtString(emitter)]</a> to <a href=\"?src=\ref[src];set_power=1\">[on?"on":"off"]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if(href_list["set_power"])
|
||||
on=!on
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_subject"])
|
||||
var/list/emitters=list()
|
||||
for(var/obj/machinery/power/emitter/E in machines)
|
||||
if(!isnull(E.id_tag) && E.frequency == parent.frequency)
|
||||
emitters|=E.id_tag
|
||||
if(emitters.len==0)
|
||||
usr << "<span class='warning'>Unable to find any emitters on this frequency.</span>"
|
||||
return
|
||||
emitter = input("Select an emitter:", "Emitter", emitter) as null|anything in emitters
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
83
code/modules/atmos_automation/implementation/injectors.dm
Normal file
83
code/modules/atmos_automation/implementation/injectors.dm
Normal file
@@ -0,0 +1,83 @@
|
||||
|
||||
////////////////////////////////////////////
|
||||
// Injector
|
||||
////////////////////////////////////////////
|
||||
/datum/automation/set_injector_power
|
||||
name = "Injector: Power"
|
||||
var/injector=null
|
||||
var/state=0
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["injector"]=injector
|
||||
json["state"]=state
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
injector = json["injector"]
|
||||
state = text2num(json["state"])
|
||||
|
||||
process()
|
||||
if(injector)
|
||||
parent.send_signal(list ("tag" = injector, "power"=state))
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "Set injector <a href=\"?src=\ref[src];set_injector=1\">[fmtString(injector)]</a> power to <a href=\"?src=\ref[src];toggle_state=1\">[state ? "on" : "off"]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if(href_list["toggle_state"])
|
||||
state = !state
|
||||
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_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
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
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["injector"]=injector
|
||||
json["rate"]=rate
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
injector = json["injector"]
|
||||
rate = text2num(json["rate"])
|
||||
|
||||
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(..())
|
||||
return 1
|
||||
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_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
injector = input("Select an injector:", "Sensor Data", injector) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
153
code/modules/atmos_automation/implementation/scrubbers.dm
Normal file
153
code/modules/atmos_automation/implementation/scrubbers.dm
Normal file
@@ -0,0 +1,153 @@
|
||||
/datum/automation/set_scrubber_mode
|
||||
name="Scrubber: Mode"
|
||||
|
||||
var/scrubber=null
|
||||
var/mode=1
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["scrubber"]=scrubber
|
||||
json["mode"]=mode
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
scrubber = json["scrubber"]
|
||||
mode = text2num(json["mode"])
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
children=list(null)
|
||||
|
||||
process()
|
||||
if(scrubber)
|
||||
parent.send_signal(list ("tag" = scrubber, "sigtype"="command", "scrubbing"=mode),filter = RADIO_FROM_AIRALARM)
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "Set Scrubber <a href=\"?src=\ref[src];set_scrubber=1\">[fmtString(scrubber)]</a> mode to <a href=\"?src=\ref[src];set_mode=1\">[mode?"Scrubbing":"Syphoning"]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["set_mode"])
|
||||
mode=!mode
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_scrubber"])
|
||||
var/list/injector_names=list()
|
||||
for(var/obj/machinery/atmospherics/unary/vent_scrubber/S in machines)
|
||||
if(!isnull(S.id_tag) && S.frequency == parent.frequency)
|
||||
injector_names|=S.id_tag
|
||||
scrubber = input("Select a scrubber:", "Scrubbers", scrubber) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
/datum/automation/set_scrubber_power
|
||||
name="Scrubber: Power"
|
||||
|
||||
var/scrubber=null
|
||||
var/state=0
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["scrubber"]=scrubber
|
||||
json["state"]=state
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
scrubber = json["scrubber"]
|
||||
state = text2num(json["state"])
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
|
||||
process()
|
||||
if(scrubber)
|
||||
parent.send_signal(list ("tag" = scrubber, "sigtype"="command", "power"=state),filter = RADIO_FROM_AIRALARM)
|
||||
|
||||
GetText()
|
||||
return "Set Scrubber <a href=\"?src=\ref[src];set_scrubber=1\">[fmtString(scrubber)]</a> power to <a href=\"?src=\ref[src];set_power=1\">[state ? "on" : "off"]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["set_power"])
|
||||
state = !state
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_scrubber"])
|
||||
var/list/injector_names=list()
|
||||
for(var/obj/machinery/atmospherics/unary/vent_scrubber/S in machines)
|
||||
if(!isnull(S.id_tag) && S.frequency == parent.frequency)
|
||||
injector_names|=S.id_tag
|
||||
scrubber = input("Select a scrubber:", "Scrubbers", scrubber) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
var/global/list/gas_labels=list(
|
||||
"co2" = "CO<sub>2</sub>",
|
||||
"tox" = "Plasma",
|
||||
"n2o" = "N<sub>2</sub>O",
|
||||
"o2" = "O<sub>2</sub>",
|
||||
"n2" = "N<sub>2</sub>"
|
||||
)
|
||||
/datum/automation/set_scrubber_gasses
|
||||
name="Scrubber: Gasses"
|
||||
|
||||
var/scrubber=null
|
||||
var/list/gasses=list(
|
||||
"co2" = 1,
|
||||
"tox" = 0,
|
||||
"n2o" = 0,
|
||||
"o2" = 0,
|
||||
"n2" = 0
|
||||
)
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["scrubber"]=scrubber
|
||||
json["gasses"]=gasses
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
scrubber = json["scrubber"]
|
||||
|
||||
var/list/newgasses=json["gasses"]
|
||||
for(var/key in newgasses)
|
||||
gasses[key]=newgasses[key]
|
||||
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
|
||||
process()
|
||||
if(scrubber)
|
||||
var/list/data = list ("tag" = scrubber, "sigtype"="command")
|
||||
for(var/gas in gasses)
|
||||
data[gas+"_scrub"]=gasses[gas]
|
||||
parent.send_signal(data,filter = RADIO_FROM_AIRALARM)
|
||||
|
||||
GetText()
|
||||
var/txt = "Set Scrubber <a href=\"?src=\ref[src];set_scrubber=1\">[fmtString(scrubber)]</a> to scrub "
|
||||
for(var/gas in gasses)
|
||||
txt += " [gas_labels[gas]] (<a href=\"?src=\ref[src];tog_gas=[gas]\">[gasses[gas] ? "on" : "off"]</a>),"
|
||||
return txt
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["tog_gas"])
|
||||
var/gas = href_list["tog_gas"]
|
||||
if(!(gas in gasses))
|
||||
return
|
||||
gasses[gas] = !gasses[gas]
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_scrubber"])
|
||||
var/list/injector_names=list()
|
||||
for(var/obj/machinery/atmospherics/unary/vent_scrubber/S in machines)
|
||||
if(!isnull(S.id_tag) && S.frequency == parent.frequency)
|
||||
injector_names|=S.id_tag
|
||||
scrubber = input("Select a scrubber:", "Scrubbers", scrubber) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
56
code/modules/atmos_automation/implementation/sensors.dm
Normal file
56
code/modules/atmos_automation/implementation/sensors.dm
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
///////////////////////////////////////////
|
||||
// sensor data
|
||||
///////////////////////////////////////////
|
||||
|
||||
/datum/automation/get_sensor_data
|
||||
name = "Sensor: Get Data"
|
||||
var/field="temperature"
|
||||
var/sensor=null
|
||||
|
||||
returntype=AUTOM_RT_NUM
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["sensor"]=sensor
|
||||
json["field"]=field
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
sensor = json["sensor"]
|
||||
field = json["field"]
|
||||
|
||||
Evaluate()
|
||||
if(sensor && field && sensor in parent.sensor_information)
|
||||
return parent.sensor_information[sensor][field]
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "<a href=\"?src=\ref[src];set_field=1\">[fmtString(field)]</a> from sensor <a href=\"?src=\ref[src];set_sensor=1\">[fmtString(sensor)]</a>"
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if(href_list["set_field"])
|
||||
field = input("Select a sensor output:", "Sensor Data", field) as null|anything in list(
|
||||
"temperature",
|
||||
"pressure",
|
||||
"oxygen",
|
||||
"toxins",
|
||||
"nitrogen",
|
||||
"carbon_dioxide"
|
||||
)
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_sensor"])
|
||||
var/list/sensor_list = list()
|
||||
for(var/obj/machinery/air_sensor/G in machines)
|
||||
if(!isnull(G.id_tag) && G.frequency == parent.frequency)
|
||||
sensor_list|=G.id_tag
|
||||
for(var/obj/machinery/meter/M in machines)
|
||||
if(!isnull(M.id_tag) && M.frequency == parent.frequency)
|
||||
sensor_list|=M.id_tag
|
||||
sensor = input("Select a sensor:", "Sensor Data", field) as null|anything in sensor_list
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
296
code/modules/atmos_automation/implementation/vent_pump.dm
Normal file
296
code/modules/atmos_automation/implementation/vent_pump.dm
Normal file
@@ -0,0 +1,296 @@
|
||||
/datum/automation/set_vent_pump_mode
|
||||
name="Vent Pump: Mode"
|
||||
|
||||
var/vent_pump=null
|
||||
var/mode="stabilize"
|
||||
|
||||
var/list/modes = list("stabilize","purge")
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["vent_pump"]=vent_pump
|
||||
json["mode"]=mode
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
vent_pump = json["vent_pump"]
|
||||
mode = json["mode"]
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
children=list(null)
|
||||
|
||||
process()
|
||||
if(vent_pump)
|
||||
var/dirvalue = (mode == "stabalize" ? 1 : mode == "purge" ? 0 : 1)
|
||||
parent.send_signal(list ("tag" = vent_pump, "direction" = dirvalue),filter = RADIO_FROM_AIRALARM)
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "Set vent pump <a href=\"?src=\ref[src];set_vent_pump=1\">[fmtString(vent_pump)]</a> mode to <a href=\"?src=\ref[src];set_mode=1\">[mode]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if(href_list["set_mode"])
|
||||
mode = input("Select a mode to put this pump into.",mode) in modes
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_vent_pump"])
|
||||
var/list/injector_names=list()
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/I in machines)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in world)
|
||||
//world << "test"
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
vent_pump = input("Select a vent:", "Vent Pumps", vent_pump) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
/datum/automation/set_vent_pump_power
|
||||
name="Vent Pump: Power"
|
||||
|
||||
var/vent_pump=null
|
||||
var/state=0
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["vent_pump"]=vent_pump
|
||||
json["state"]=state
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
vent_pump = json["vent_pump"]
|
||||
state = text2num(json["state"])
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
|
||||
process()
|
||||
if(vent_pump)
|
||||
parent.send_signal(list ("tag" = vent_pump, "power"=state), filter = RADIO_FROM_AIRALARM)
|
||||
|
||||
GetText()
|
||||
return "Set vent pump <a href=\"?src=\ref[src];set_vent_pump=1\">[fmtString(vent_pump)]</a> power to <a href=\"?src=\ref[src];set_power=1\">[state ? "on" : "off"]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if(href_list["set_power"])
|
||||
state = !state
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_vent_pump"])
|
||||
var/list/injector_names=list()
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/I in machines)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in world)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
vent_pump = input("Select a vent:", "Vent Pumps", vent_pump) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
/datum/automation/set_vent_pump_pressure//controls the internal/external pressure bounds of a vent pump.
|
||||
name = "Vent pump: Pressure settings"
|
||||
|
||||
var/vent_pump = null
|
||||
var/intpressureout = 0//these 2 are for DP vents, if it's a unary vent you're sending to it will take intpressureout as var
|
||||
var/intpressurein = 0
|
||||
var/extpressure = 0
|
||||
var/mode = 0//0 for unary vents, 1 for DP vents.
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["vent_pump"] = vent_pump
|
||||
json["intpressureout"] = intpressureout
|
||||
json["intpressurein"] = intpressurein
|
||||
json["extpressure"] = extpressure
|
||||
json["mode"] = mode
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
vent_pump = json["vent_pump"]
|
||||
intpressureout = text2num(json["intpressureout"])
|
||||
intpressurein = text2num(json["intpressurein"])
|
||||
extpressure = text2num(json["extpressure"])
|
||||
mode = text2num(json["mode"])
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
|
||||
process()
|
||||
if(vent_pump)
|
||||
var/list/data = list( \
|
||||
"tag" = vent_pump, \
|
||||
)
|
||||
var/filter = RADIO_ATMOSIA
|
||||
if(mode)//it's a DP vent
|
||||
if(intpressurein)
|
||||
data.Add(list("set_input_pressure" = intpressurein))
|
||||
if(intpressureout)
|
||||
data.Add(list("set_output_pressure" = intpressureout))
|
||||
if(extpressure)
|
||||
data.Add(list("set_external_pressure" = extpressure))
|
||||
|
||||
else
|
||||
if(intpressureout)
|
||||
data.Add(list("set_internal_pressure" = intpressureout))
|
||||
if(extpressure)
|
||||
data.Add(list("set_external_pressure" = extpressure))
|
||||
filter = RADIO_FROM_AIRALARM
|
||||
|
||||
parent.send_signal(data, filter)
|
||||
|
||||
GetText()
|
||||
if(mode)//DP vent
|
||||
return {"Set <a href=\"?src=\ref[src];swap_modes=1\">dual-port</a> vent pump <a href=\"?src=\ref[src];set_vent_pump=1\">[fmtString(vent_pump)]</a>
|
||||
pressure bounds: internal outwards: <a href=\"?src=\ref[src];set_intpressure_out=1">[fmtString(intpressureout)]</a>
|
||||
internal inwards: <a href=\"?src=\ref[src];set_intpressure_in=1">[fmtString(intpressurein)]</a>
|
||||
external: <a href=\"?src=\ref[src];set_external=1">[fmtString(extpressure)]</a>
|
||||
"}//well that was a lot to type
|
||||
else
|
||||
return {"Set <a href=\"?src=\ref[src];swap_modes=1\">unary</a> vent pump <a href=\"?src=\ref[src];set_vent_pump=1\">[fmtString(vent_pump)]</a>
|
||||
pressure bounds: internal: <a href=\"?src=\ref[src];set_intpressure_out=1">[fmtString(intpressureout)]</a>
|
||||
external: <a href=\"?src=\ref[src];set_external=1">[fmtString(extpressure)]</a>
|
||||
"}//copy paste FTW
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if(href_list["set_vent_pump"])
|
||||
var/list/injector_names=list()
|
||||
if(mode)//DP vent selection
|
||||
for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in world)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
else
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/I in machines)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
vent_pump = input("Select a vent:", "Vent Pumps", vent_pump) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["set_intpressure_out"])
|
||||
var/response = input("Set new pressure, in kPa. \[0-[50*ONE_ATMOSPHERE]\]") as num
|
||||
intpressureout = text2num(response)
|
||||
intpressureout = between(0, intpressureout, 50*ONE_ATMOSPHERE)
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["set_intpressure_in"])
|
||||
var/response = input("Set new pressure, in kPa. \[0-[50*ONE_ATMOSPHERE]\]") as num
|
||||
intpressurein = text2num(response)
|
||||
intpressurein = between(0, intpressurein, 50*ONE_ATMOSPHERE)
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["set_external"])
|
||||
var/response = input(usr,"Set new pressure, in kPa. \[0-[50*ONE_ATMOSPHERE]\]") as num
|
||||
extpressure = text2num(response)
|
||||
extpressure = between(0, extpressure, 50*ONE_ATMOSPHERE)
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["swap_modes"])
|
||||
mode = !mode
|
||||
vent_pump = null//if we don't clear this is could get glitchy, by which I mean not at all, whatever, stay clean
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
/datum/automation/set_vent_pressure_checks
|
||||
name = "Vent pump: pressure checks"
|
||||
|
||||
var/vent_pump = null
|
||||
var/checks = 1
|
||||
var/mode = 0//1 for DP vent, 0 for unary vent
|
||||
/*
|
||||
checks bitflags
|
||||
1 = external
|
||||
2 = internal in (regular internal for unaries)
|
||||
4 = internal out (ignored by unaries)
|
||||
*/
|
||||
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["vent_pump"] = vent_pump
|
||||
json["checks"] = checks
|
||||
json["mode"] = mode
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
vent_pump = json["vent_pump"]
|
||||
checks = text2num(json["checks"])
|
||||
mode = text2num(json["mode"])
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
|
||||
process()
|
||||
if(vent_pump)
|
||||
parent.send_signal(list("tag" = vent_pump, "checks" = checks), filter = (mode ? RADIO_ATMOSIA : RADIO_FROM_AIRALARM))//not gonna bother with a sanity check here, there *should* not be any problems
|
||||
|
||||
GetText()
|
||||
if(mode)
|
||||
return {"Set <a href=\"?src=\ref[src];swap_modes=1\">dual-port</a> vent pump <a href=\"?src=\ref[src];set_vent_pump=1\">[fmtString(vent_pump)]</a> pressure checks to:
|
||||
external <a href=\"?src=\ref[src];togglecheck=1\">[checks&1 ? "Enabled" : "Disabled"]</a>
|
||||
internal inwards <a href=\"?src=\ref[src];togglecheck=2\">[checks&2 ? "Enabled" : "Disabled"]</a>
|
||||
internal outwards <a href=\"?src=\ref[src];togglecheck=4\">[checks&4 ? "Enabled" : "Disabled"]</a>
|
||||
"}
|
||||
else
|
||||
return {"Set <a href=\"?src=\ref[src];swap_modes=1\">unary</a> vent pump <a href=\"?src=\ref[src];set_vent_pump=1\">[fmtString(vent_pump)]</a> pressure checks to:
|
||||
external: <a href=\"?src=\ref[src];togglecheck=1\">[checks&1 ? "Enabled" : "Disabled"]</a>,
|
||||
internal: <a href=\"?src=\ref[src];togglecheck=2\">[checks&2 ? "Enabled" : "Disabled"]</a>
|
||||
"}
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if(href_list["set_vent_pump"])
|
||||
var/list/injector_names=list()
|
||||
if(mode)//DP vent selection
|
||||
for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in world)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
else
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/I in machines)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
vent_pump = input("Select a vent:", "Vent Pumps", vent_pump) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["swap_modes"])
|
||||
mode = !mode
|
||||
vent_pump = null//if we don't clear this is could get glitchy, by which I mean not at all, whatever, stay clean
|
||||
if(!mode && checks&4)//disable this bitflag since we're switching to unaries
|
||||
checks &= ~4
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["togglecheck"])
|
||||
var/bitflagvalue = text2num(href_list["togglecheck"])
|
||||
if(mode)
|
||||
if(!(bitflagvalue in list(1, 2, 4)))
|
||||
return 0
|
||||
else if(!(bitflagvalue in list(1, 2)))
|
||||
return 0
|
||||
|
||||
if(checks&bitflagvalue)//the bitflag is on ATM
|
||||
checks &= ~bitflagvalue
|
||||
else//can't not be off
|
||||
checks |= bitflagvalue
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user