mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-21 03:55:05 +01:00
Tank control console improvements(and migrates multitool to new attack chain) (#28252)
* Allows multiple inlets and outlets * Starts adding range to multimeter and fixes some stuff * Migrates multitool to new attack chain and increases the scanning range * adds vent scrubbers * Fixes scrubber control * moves uplink multitool to new attack chain as well * oops * reverts putting injectors and vents into their own component due to numbered input stuttering * Allows vent pressure reference to be changed * Fix bugs when adding or removing devices * tgui rebuild * Makes the UI look nicer * Update tgui.bundle.js * add range to sensor multitool interaction as well * Update tgui.bundle.js * Update tgui.bundle.js * Update tgui.bundle.js * Update tgui.bundle.js * review changes * reeee * Update tgui.bundle.js
This commit is contained in:
committed by
GitHub
parent
a12792f17e
commit
00573a16fd
@@ -57,49 +57,45 @@ GLOBAL_LIST_EMPTY(gas_sensors)
|
||||
|
||||
#define ONOFF_TOGGLE(flag) "\[[(output & flag) ? "YES" : "NO"]]"
|
||||
/obj/machinery/atmospherics/air_sensor/multitool_act(mob/living/user, obj/item/I)
|
||||
while(Adjacent(user))
|
||||
var/list/options = list(
|
||||
"Pressure: [ONOFF_TOGGLE(SENSOR_PRESSURE)]" = SENSOR_PRESSURE,
|
||||
"Temperature: [ONOFF_TOGGLE(SENSOR_TEMPERATURE)]" = SENSOR_TEMPERATURE,
|
||||
"Oxygen: [ONOFF_TOGGLE(SENSOR_O2)]" = SENSOR_O2,
|
||||
"Toxins: [ONOFF_TOGGLE(SENSOR_PLASMA)]" = SENSOR_PLASMA,
|
||||
"Nitrogen: [ONOFF_TOGGLE(SENSOR_N2)]" = SENSOR_N2,
|
||||
"Carbon Dioxide: [ONOFF_TOGGLE(SENSOR_CO2)]" = SENSOR_CO2,
|
||||
"Nitrous Oxide: [ONOFF_TOGGLE(SENSOR_N2O)]" = SENSOR_N2O,
|
||||
"-SAVE TO BUFFER-" = "multitool"
|
||||
)
|
||||
|
||||
var/list/options = list(
|
||||
"Pressure: [ONOFF_TOGGLE(SENSOR_PRESSURE)]" = SENSOR_PRESSURE,
|
||||
"Temperature: [ONOFF_TOGGLE(SENSOR_TEMPERATURE)]" = SENSOR_TEMPERATURE,
|
||||
"Oxygen: [ONOFF_TOGGLE(SENSOR_O2)]" = SENSOR_O2,
|
||||
"Toxins: [ONOFF_TOGGLE(SENSOR_PLASMA)]" = SENSOR_PLASMA,
|
||||
"Nitrogen: [ONOFF_TOGGLE(SENSOR_N2)]" = SENSOR_N2,
|
||||
"Carbon Dioxide: [ONOFF_TOGGLE(SENSOR_CO2)]" = SENSOR_CO2,
|
||||
"Nitrous Oxide: [ONOFF_TOGGLE(SENSOR_N2O)]" = SENSOR_N2O,
|
||||
"-SAVE TO BUFFER-" = "multitool"
|
||||
)
|
||||
var/temp_answer = tgui_input_list(user, "Select an option to adjust", "Options!", options)
|
||||
|
||||
var/temp_answer = tgui_input_list(user, "Select an option to adjust", "Options!", options)
|
||||
if(!(src in view(5, user)))
|
||||
return TRUE
|
||||
|
||||
if(!Adjacent(user))
|
||||
break
|
||||
if(temp_answer in options) // Null will break us out
|
||||
switch(options[temp_answer])
|
||||
if(SENSOR_PRESSURE)
|
||||
output ^= SENSOR_PRESSURE
|
||||
if(SENSOR_TEMPERATURE)
|
||||
output ^= SENSOR_TEMPERATURE
|
||||
if(SENSOR_O2)
|
||||
output ^= SENSOR_O2
|
||||
if(SENSOR_PLASMA)
|
||||
output ^= SENSOR_PLASMA
|
||||
if(SENSOR_N2)
|
||||
output ^= SENSOR_N2
|
||||
if(SENSOR_CO2)
|
||||
output ^= SENSOR_CO2
|
||||
if(SENSOR_N2O)
|
||||
output ^= SENSOR_N2O
|
||||
if("multitool")
|
||||
if(!ismultitool(I)) // Should never happen
|
||||
return
|
||||
|
||||
if(temp_answer in options) // Null will break us out
|
||||
switch(options[temp_answer])
|
||||
if(SENSOR_PRESSURE)
|
||||
output ^= SENSOR_PRESSURE
|
||||
if(SENSOR_TEMPERATURE)
|
||||
output ^= SENSOR_TEMPERATURE
|
||||
if(SENSOR_O2)
|
||||
output ^= SENSOR_O2
|
||||
if(SENSOR_PLASMA)
|
||||
output ^= SENSOR_PLASMA
|
||||
if(SENSOR_N2)
|
||||
output ^= SENSOR_N2
|
||||
if(SENSOR_CO2)
|
||||
output ^= SENSOR_CO2
|
||||
if(SENSOR_N2O)
|
||||
output ^= SENSOR_N2O
|
||||
if("multitool")
|
||||
if(!ismultitool(I)) // Should never happen
|
||||
return
|
||||
|
||||
var/obj/item/multitool/M = I
|
||||
M.buffer_uid = UID()
|
||||
to_chat(user, "<span class='notice'>You save [src] into [M]'s buffer</span>")
|
||||
else
|
||||
break
|
||||
var/obj/item/multitool/M = I
|
||||
M.buffer_uid = UID()
|
||||
to_chat(user, "<span class='notice'>You save [src] into [M]'s buffer</span>")
|
||||
|
||||
return TRUE
|
||||
#undef ONOFF_TOGGLE
|
||||
@@ -295,14 +291,16 @@ GLOBAL_LIST_EMPTY(gas_sensors)
|
||||
|
||||
// Instanced vars. These are /tmp/ to avoid mappers trying to set them
|
||||
/// The runtime UID of the inlet injector
|
||||
var/tmp/inlet_injector_uid
|
||||
var/tmp/list/inlet_uids = list()
|
||||
/// The runtime UID of the outlet vent
|
||||
var/tmp/outlet_vent_uid
|
||||
var/tmp/list/outlet_uids = list()
|
||||
|
||||
/// UI holder list of the inlet data
|
||||
var/tmp/list/inlet_data = list()
|
||||
/// UI holder list of the outlet data
|
||||
var/tmp/list/outlet_data = list()
|
||||
/// UI holder list of the outlet vent data
|
||||
var/tmp/list/outlet_vent_data = list()
|
||||
/// UI holder list of the outlet scrubber data
|
||||
var/tmp/list/outlet_scrubber_data = list()
|
||||
|
||||
/// Default outlet vent setting (About 4559.6)
|
||||
var/outlet_setting = ONE_ATMOSPHERE * 45
|
||||
@@ -314,27 +312,47 @@ GLOBAL_LIST_EMPTY(gas_sensors)
|
||||
|
||||
// Setup inlet
|
||||
if(inlet_injector_autolink_id)
|
||||
for(var/obj/machinery/atmospherics/unary/outlet_injector/OI as anything in GLOB.air_injectors)
|
||||
if(OI.autolink_id == inlet_injector_autolink_id)
|
||||
inlet_injector_uid = OI.UID() // OI!
|
||||
for(var/obj/machinery/atmospherics/unary/outlet_injector/inlet_injector as anything in GLOB.air_injectors)
|
||||
if(inlet_injector.autolink_id == inlet_injector_autolink_id)
|
||||
inlet_uids += inlet_injector.UID() // inlet_injector!
|
||||
// Setup some defaults
|
||||
OI.on = TRUE
|
||||
OI.volume_rate = inlet_setting
|
||||
OI.update_icon()
|
||||
inlet_injector.on = TRUE
|
||||
inlet_injector.volume_rate = inlet_setting
|
||||
inlet_injector.update_icon()
|
||||
inlet_data += list("[inlet_injector.UID()]" = list("name"= inlet_injector.name, "on" = inlet_injector.on, "rate" = inlet_injector.volume_rate, "uid" = inlet_injector.UID()))
|
||||
refresh_inlets()
|
||||
break
|
||||
|
||||
// Setup outlet
|
||||
if(outlet_vent_autolink_id)
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/VP as anything in GLOB.all_vent_pumps)
|
||||
if(VP.autolink_id == outlet_vent_autolink_id)
|
||||
outlet_vent_uid = VP.UID()
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/outlet_vent as anything in GLOB.all_vent_pumps)
|
||||
if(outlet_vent.autolink_id == outlet_vent_autolink_id)
|
||||
outlet_uids += outlet_vent.UID()
|
||||
var/area/our_area = get_area(src)
|
||||
our_area.vents -= VP
|
||||
VP.on = TRUE
|
||||
VP.releasing = FALSE
|
||||
VP.internal_pressure_bound = outlet_setting
|
||||
VP.update_icon()
|
||||
break
|
||||
our_area.vents -= outlet_vent
|
||||
outlet_vent.on = TRUE
|
||||
outlet_vent.releasing = FALSE
|
||||
outlet_vent.internal_pressure_bound = outlet_setting
|
||||
outlet_vent.update_icon()
|
||||
outlet_vent_data += list("[outlet_vent.UID()]" = list("name" =outlet_vent.name, "on" = outlet_vent.on, "checks" = outlet_vent.pressure_checks, "rate" = outlet_vent.pressure_checks == 1 ? outlet_vent.external_pressure_bound : outlet_vent.internal_pressure_bound, "uid" = outlet_vent.UID()))
|
||||
refresh_outlets()
|
||||
return
|
||||
var/obj/machinery/atmospherics/unary/vent_scrubber/scrubber = locateUID(outlet_vent_autolink_id)
|
||||
if(!QDELETED(scrubber))
|
||||
scrubber.on = TRUE
|
||||
scrubber.scrubbing = FALSE
|
||||
|
||||
outlet_scrubber_data += list("[scrubber.UID()]" = list(
|
||||
"id_tag" = scrubber.UID(),
|
||||
"name" = scrubber.name,
|
||||
"power" = scrubber.on,
|
||||
"scrubbing" = scrubber.scrubbing,
|
||||
"widenet" = scrubber.widenet,
|
||||
"filter_o2" = scrubber.scrub_O2,
|
||||
"filter_n2" = scrubber.scrub_N2,
|
||||
"filter_co2" = scrubber.scrub_CO2,
|
||||
"filter_toxins" = scrubber.scrub_Toxins,
|
||||
"filter_n2o" = scrubber.scrub_N2O))
|
||||
|
||||
/obj/machinery/computer/general_air_control/large_tank_control/multitool_act(mob/living/user, obj/item/I)
|
||||
if(!ismultitool(I)) // Should never happen
|
||||
@@ -355,144 +373,290 @@ GLOBAL_LIST_EMPTY(gas_sensors)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/computer/general_air_control/large_tank_control/proc/configure_inlet(mob/living/user, obj/item/multitool/M)
|
||||
var/choice = tgui_alert(user, "Would you like to add/replace the existing inlet or clear it?", "Configuration", list("Add/Replace", "Clear", "Cancel"))
|
||||
var/choice = tgui_alert(user, "Would you like to add an inlet, remove the existing inlet or clear it?", "Configuration", list("Add", "Remove", "Clear", "Cancel"))
|
||||
if(!choice || (choice == "Cancel") || !Adjacent(user))
|
||||
return
|
||||
|
||||
switch(choice)
|
||||
if("Add/Replace")
|
||||
if("Add")
|
||||
if(M.buffer_uid in inlet_uids)
|
||||
to_chat(user, "<span class='warning'>Error: This device is already connected to the console.</span>")
|
||||
return
|
||||
// First see if they have a scrubber in their buffer
|
||||
var/datum/linked_datum = locateUID(M.buffer_uid)
|
||||
if(!linked_datum || !istype(linked_datum, /obj/machinery/atmospherics/unary/outlet_injector))
|
||||
to_chat(user, "<span class='warning'>Error: No device in multitool buffer, or device is not an injector.</span>")
|
||||
return
|
||||
|
||||
inlet_injector_uid = linked_datum.UID() // Make sure the multitool ref didnt change while they had the menu open
|
||||
var/obj/machinery/atmospherics/unary/outlet_injector/OI = linked_datum
|
||||
inlet_uids += linked_datum.UID() // Make sure the multitool ref didnt change while they had the menu open
|
||||
var/obj/machinery/atmospherics/unary/outlet_injector/inlet_injector = linked_datum
|
||||
// Setup some defaults
|
||||
OI.on = TRUE
|
||||
OI.volume_rate = inlet_setting
|
||||
OI.update_icon()
|
||||
refresh_inlet()
|
||||
to_chat(user, "<span class='notice'>Successfully set the inlet injector.</span>")
|
||||
inlet_injector.on = TRUE
|
||||
inlet_injector.volume_rate = inlet_setting
|
||||
inlet_injector.update_icon()
|
||||
inlet_data += list("[linked_datum.UID()]" = list("name" = inlet_injector.name, "on" = inlet_injector.on, "rate" = inlet_injector.volume_rate, "uid" = inlet_injector.UID()))
|
||||
refresh_inlets()
|
||||
to_chat(user, "<span class='notice'>Successfully added an inlet injector.</span>")
|
||||
|
||||
if("Remove")
|
||||
var/list/namelist = list()
|
||||
for(var/uid in inlet_data)
|
||||
namelist += inlet_data[uid]["name"]
|
||||
choice = tgui_input_list(user, "Select an inlet to remove", "Inlet Selection", namelist)
|
||||
for(var/uid in inlet_data)
|
||||
if(choice == inlet_data[uid]["name"])
|
||||
var/obj/machinery/atmospherics/unary/outlet_injector/inlet_injector
|
||||
if(!QDELETED(inlet_injector))
|
||||
inlet_injector.on = FALSE
|
||||
inlet_injector.update_icon()
|
||||
inlet_data -= uid
|
||||
inlet_uids -= uid
|
||||
break
|
||||
|
||||
if("Clear")
|
||||
if(inlet_injector_uid)
|
||||
// Lets be kind and turn it off first so its unwrenchable
|
||||
var/obj/machinery/atmospherics/unary/outlet_injector/OI = locateUID(inlet_injector_uid)
|
||||
if(!QDELETED(OI))
|
||||
OI.on = FALSE
|
||||
OI.update_icon()
|
||||
inlet_injector_uid = null
|
||||
refresh_inlet()
|
||||
if(inlet_uids)
|
||||
var/obj/machinery/atmospherics/unary/outlet_injector/inlet_injector
|
||||
for(var/uid in inlet_uids)
|
||||
inlet_injector = locateUID(uid)
|
||||
if(!QDELETED(inlet_injector))
|
||||
inlet_injector.on = FALSE
|
||||
inlet_injector.update_icon()
|
||||
|
||||
inlet_uids = list()
|
||||
inlet_data = list()
|
||||
refresh_inlets()
|
||||
to_chat(user, "<span class='notice'>Successfully unlinked inlet injector.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Error - No injector linked!</span>")
|
||||
|
||||
|
||||
/obj/machinery/computer/general_air_control/large_tank_control/proc/configure_outlet(mob/living/user, obj/item/multitool/M)
|
||||
var/choice = tgui_alert(user, "Would you like to add/replace the existing outlet or clear it?", "Configuration", list("Add/Replace", "Clear", "Cancel"))
|
||||
var/choice = tgui_alert(user, "Would you like to add an outlet, remove the existing outlet or clear it?", "Configuration", list("Add", "Remove", "Clear", "Cancel"))
|
||||
if(!choice || (choice == "Cancel") || !Adjacent(user))
|
||||
return
|
||||
|
||||
switch(choice)
|
||||
if("Add/Replace")
|
||||
if("Add")
|
||||
if(M.buffer_uid in outlet_uids)
|
||||
to_chat(user, "<span class='warning'>Error: This device is already connected to the console.</span>")
|
||||
return
|
||||
// First see if they have a scrubber in their buffer
|
||||
var/datum/linked_datum = locateUID(M.buffer_uid)
|
||||
if(!linked_datum || !istype(linked_datum, /obj/machinery/atmospherics/unary/vent_pump))
|
||||
to_chat(user, "<span class='warning'>Error: No device in multitool buffer, or device is not a vent pump.</span>")
|
||||
if(!linked_datum)
|
||||
to_chat(user, "<span class='warning'>Error: No compatible device in multitool buffer</span>")
|
||||
return
|
||||
if(istype(linked_datum, /obj/machinery/atmospherics/unary/vent_pump))
|
||||
outlet_uids += linked_datum.UID() // Make sure the multitool ref didnt change while they had the menu open
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/outlet_vent = linked_datum
|
||||
// Setup some defaults
|
||||
var/area/our_area = get_area(src)
|
||||
our_area.vents -= outlet_vent
|
||||
outlet_vent.on = TRUE
|
||||
outlet_vent.releasing = FALSE
|
||||
outlet_vent.internal_pressure_bound = outlet_setting
|
||||
outlet_vent.update_icon()
|
||||
outlet_vent_data += list("[linked_datum.UID()]" = list("name" = outlet_vent.name, "on" = outlet_vent.on, "checks" = outlet_vent.pressure_checks, "rate" = outlet_vent.internal_pressure_bound, "uid" = outlet_vent.UID()))
|
||||
refresh_outlets()
|
||||
to_chat(user, "<span class='notice'>Successfully added an outlet vent</span>")
|
||||
return
|
||||
if(istype(linked_datum, /obj/machinery/atmospherics/unary/vent_scrubber))
|
||||
outlet_uids += linked_datum.UID() // Make sure the multitool ref didnt change while they had the menu open
|
||||
var/obj/machinery/atmospherics/unary/vent_scrubber/scrubber = linked_datum
|
||||
// Setup some defaults
|
||||
var/area/our_area = get_area(src)
|
||||
our_area.scrubbers -= scrubber
|
||||
scrubber.on = TRUE
|
||||
scrubber.scrubbing = FALSE
|
||||
scrubber.update_icon()
|
||||
outlet_scrubber_data += list("[scrubber.UID()]" = list(
|
||||
"id_tag" = scrubber.UID(),
|
||||
"name" = scrubber.name,
|
||||
"power" = scrubber.on,
|
||||
"scrubbing" = scrubber.scrubbing,
|
||||
"widenet" = scrubber.widenet,
|
||||
"filter_o2" = scrubber.scrub_O2,
|
||||
"filter_n2" = scrubber.scrub_N2,
|
||||
"filter_co2" = scrubber.scrub_CO2,
|
||||
"filter_toxins" = scrubber.scrub_Toxins,
|
||||
"filter_n2o" = scrubber.scrub_N2O))
|
||||
refresh_outlets()
|
||||
to_chat(user, "<span class='notice'>Successfully added an outlet scrubber</span>")
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Error: No compatible device in multitool buffer</span>")
|
||||
return
|
||||
|
||||
outlet_vent_uid = linked_datum.UID() // Make sure the multitool ref didnt change while they had the menu open
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/VP = linked_datum
|
||||
// Setup some defaults
|
||||
var/area/our_area = get_area(src)
|
||||
our_area.vents -= VP
|
||||
VP.on = TRUE
|
||||
VP.releasing = FALSE
|
||||
VP.internal_pressure_bound = outlet_setting
|
||||
VP.update_icon()
|
||||
refresh_outlet()
|
||||
to_chat(user, "<span class='notice'>Successfully set the outlet vent</span>")
|
||||
if("Remove")
|
||||
var/list/namelist = list()
|
||||
|
||||
for(var/uid in outlet_vent_data)
|
||||
namelist += outlet_vent_data[uid]["name"]
|
||||
for(var/uid in outlet_scrubber_data)
|
||||
namelist += outlet_scrubber_data[uid]["name"]
|
||||
|
||||
choice = tgui_input_list(user, "Select an outlet to remove", "outlet Selection", namelist)
|
||||
for(var/uid in outlet_uids)
|
||||
if((outlet_vent_data[uid] && choice == outlet_vent_data[uid]["name"]) || (outlet_scrubber_data[uid] && choice == outlet_scrubber_data[uid]["name"]))
|
||||
var/obj/machinery/atmospherics/unary/outlet = locateUID(uid)
|
||||
if(!QDELETED(outlet))
|
||||
outlet.on = FALSE
|
||||
outlet.update_icon()
|
||||
outlet_scrubber_data -= uid
|
||||
outlet_vent_data -= uid
|
||||
outlet_uids -= uid
|
||||
break
|
||||
|
||||
if("Clear")
|
||||
if(outlet_vent_uid)
|
||||
// Lets be kind and turn it off first so its unwrenchable
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/VP = locateUID(outlet_vent_uid)
|
||||
if(!QDELETED(VP))
|
||||
VP.on = FALSE
|
||||
VP.update_icon()
|
||||
outlet_vent_uid = null
|
||||
refresh_outlet()
|
||||
if(length(outlet_uids))
|
||||
var/obj/machinery/atmospherics/unary/outlet
|
||||
for(var/uid in outlet_uids)
|
||||
outlet = locateUID(uid)
|
||||
if(!QDELETED(outlet))
|
||||
outlet.on = FALSE
|
||||
outlet.update_icon()
|
||||
outlet_uids = list()
|
||||
outlet_scrubber_data = list()
|
||||
outlet_vent_data = list()
|
||||
refresh_outlets()
|
||||
to_chat(user, "<span class='notice'>Successfully unlinked outlet vent.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Error - No vent linked!</span>")
|
||||
to_chat(user, "<span class='warning'>Error - No outlets linked!</span>")
|
||||
|
||||
|
||||
/obj/machinery/computer/general_air_control/large_tank_control/proc/refresh_inlet()
|
||||
var/obj/machinery/atmospherics/unary/outlet_injector/OI = locateUID(inlet_injector_uid)
|
||||
if(QDELETED(OI))
|
||||
inlet_data = list()
|
||||
return
|
||||
/obj/machinery/computer/general_air_control/large_tank_control/proc/refresh_inlets()
|
||||
for(var/uid in inlet_uids)
|
||||
var/obj/machinery/atmospherics/unary/outlet_injector/inlet_injector = locateUID(uid)
|
||||
if(QDELETED(inlet_injector))
|
||||
inlet_data -= uid
|
||||
inlet_uids -= uid
|
||||
return
|
||||
inlet_data[uid]["name"] = inlet_injector.name
|
||||
inlet_data[uid]["on"] = inlet_injector.on
|
||||
inlet_data[uid]["rate"] = inlet_injector.volume_rate
|
||||
|
||||
inlet_data["on"] = OI.on
|
||||
inlet_data["rate"] = OI.volume_rate
|
||||
|
||||
/obj/machinery/computer/general_air_control/large_tank_control/proc/refresh_outlet()
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/VP = locateUID(outlet_vent_uid)
|
||||
if(QDELETED(VP))
|
||||
outlet_data = list()
|
||||
return
|
||||
|
||||
outlet_data["on"] = VP.on
|
||||
outlet_data["rate"] = VP.internal_pressure_bound
|
||||
/obj/machinery/computer/general_air_control/large_tank_control/proc/refresh_outlets()
|
||||
var/obj/machinery/atmospherics/unary/outlet
|
||||
for(var/uid in outlet_uids)
|
||||
outlet = locateUID(uid)
|
||||
if(istype(outlet, /obj/machinery/atmospherics/unary/vent_pump))
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/vent = outlet
|
||||
if(QDELETED(vent))
|
||||
outlet_scrubber_data -= uid
|
||||
outlet_vent_data -= uid
|
||||
outlet_uids -= uid
|
||||
return
|
||||
outlet_vent_data[uid]["name"] = vent.name
|
||||
outlet_vent_data[uid]["on"] = vent.on
|
||||
outlet_vent_data[uid]["checks"] = vent.pressure_checks
|
||||
outlet_vent_data[uid]["rate"] = vent.pressure_checks == 1 ? vent.external_pressure_bound : vent.internal_pressure_bound
|
||||
if(istype(outlet, /obj/machinery/atmospherics/unary/vent_scrubber))
|
||||
var/obj/machinery/atmospherics/unary/vent_scrubber/scrubber = outlet
|
||||
if(QDELETED(scrubber))
|
||||
outlet_scrubber_data -= uid
|
||||
outlet_vent_data -= uid
|
||||
outlet_uids -= uid
|
||||
return
|
||||
outlet_scrubber_data[uid]["id_tag"] = scrubber.UID()
|
||||
outlet_scrubber_data[uid]["name"] = scrubber.name
|
||||
outlet_scrubber_data[uid]["power"] = scrubber.on
|
||||
outlet_scrubber_data[uid]["scrubbing"] = scrubber.scrubbing
|
||||
outlet_scrubber_data[uid]["widenet"] = scrubber.widenet
|
||||
outlet_scrubber_data[uid]["filter_o2"] = scrubber.scrub_O2
|
||||
outlet_scrubber_data[uid]["filter_n2"] = scrubber.scrub_N2
|
||||
outlet_scrubber_data[uid]["filter_co2"] = scrubber.scrub_CO2
|
||||
outlet_scrubber_data[uid]["filter_toxins"] = scrubber.scrub_Toxins
|
||||
outlet_scrubber_data[uid]["filter_n2o"] = scrubber.scrub_N2O
|
||||
|
||||
/obj/machinery/computer/general_air_control/large_tank_control/refresh_all()
|
||||
..()
|
||||
refresh_inlet()
|
||||
refresh_outlet()
|
||||
refresh_inlets()
|
||||
refresh_outlets()
|
||||
|
||||
/obj/machinery/computer/general_air_control/large_tank_control/ui_data(mob/user)
|
||||
. = ..()
|
||||
.["inlet"] = inlet_data
|
||||
.["outlet"] = outlet_data
|
||||
// This is done so we can use map() in tgui.
|
||||
var/list/ui_inlet_data = list()
|
||||
var/list/ui_outlet_vent_data = list()
|
||||
var/list/ui_outlet_scrubber_data = list()
|
||||
for(var/id in inlet_data)
|
||||
ui_inlet_data.Add(list(inlet_data[id]))
|
||||
for(var/id in outlet_vent_data)
|
||||
ui_outlet_vent_data.Add(list(outlet_vent_data[id]))
|
||||
for(var/id in outlet_scrubber_data)
|
||||
ui_outlet_scrubber_data.Add(list(outlet_scrubber_data[id]))
|
||||
|
||||
.["inlets"] = ui_inlet_data
|
||||
.["vent_outlets"] = ui_outlet_vent_data
|
||||
.["scrubber_outlets"] = ui_outlet_scrubber_data
|
||||
|
||||
/obj/machinery/computer/general_air_control/large_tank_control/ui_act(action, list/params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("toggle_active")
|
||||
switch(params["dev"])
|
||||
if("inlet")
|
||||
var/obj/machinery/atmospherics/unary/outlet_injector/OI = locateUID(inlet_injector_uid)
|
||||
if(!QDELETED(OI))
|
||||
OI.on = !OI.on
|
||||
OI.update_icon()
|
||||
refresh_inlet()
|
||||
if("outlet")
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/VP = locateUID(outlet_vent_uid)
|
||||
if(!QDELETED(VP))
|
||||
VP.on = !VP.on
|
||||
VP.update_icon()
|
||||
refresh_outlet()
|
||||
if("toggle_inlet_active")
|
||||
var/obj/machinery/atmospherics/unary/outlet_injector/inlet_injector = locateUID(params["dev"])
|
||||
if(!QDELETED(inlet_injector))
|
||||
inlet_injector.on = !inlet_injector.on
|
||||
inlet_injector.update_icon()
|
||||
refresh_inlets()
|
||||
if("toggle_outlet_active")
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/outlet_vent = locateUID(params["dev"])
|
||||
if(!QDELETED(outlet_vent))
|
||||
outlet_vent.on = !outlet_vent.on
|
||||
outlet_vent.update_icon()
|
||||
refresh_outlets()
|
||||
|
||||
if("set_pressure")
|
||||
switch(params["dev"])
|
||||
if("inlet")
|
||||
var/obj/machinery/atmospherics/unary/outlet_injector/OI = locateUID(inlet_injector_uid)
|
||||
if(!QDELETED(OI))
|
||||
var/new_value = clamp(text2num(params["val"]), 0, 50)
|
||||
if(new_value)
|
||||
OI.volume_rate = new_value
|
||||
refresh_inlet()
|
||||
if("outlet")
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/VP = locateUID(outlet_vent_uid)
|
||||
if(!QDELETED(VP))
|
||||
var/new_value = clamp(text2num(params["val"]), 0, (50 * ONE_ATMOSPHERE))
|
||||
if(new_value)
|
||||
VP.internal_pressure_bound = new_value
|
||||
refresh_outlet()
|
||||
if("set_inlet_volume_rate")
|
||||
var/obj/machinery/atmospherics/unary/outlet_injector/inlet_injector = locateUID(params["dev"])
|
||||
if(!QDELETED(inlet_injector))
|
||||
var/new_value = clamp(text2num(params["val"]), 0, 50)
|
||||
if(new_value)
|
||||
inlet_injector.volume_rate = new_value
|
||||
refresh_inlets()
|
||||
|
||||
if("set_outlet_reference")
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/outlet_vent = locateUID(params["dev"])
|
||||
if(!QDELETED(outlet_vent))
|
||||
outlet_vent.pressure_checks = text2num(params["val"])
|
||||
refresh_outlets()
|
||||
|
||||
if("set_outlet_pressure")
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/outlet_vent = locateUID(params["dev"])
|
||||
if(!QDELETED(outlet_vent))
|
||||
if(outlet_vent.pressure_checks == 1)
|
||||
outlet_vent.external_pressure_bound = text2num(params["val"])
|
||||
refresh_outlets()
|
||||
else
|
||||
outlet_vent.internal_pressure_bound = text2num(params["val"])
|
||||
refresh_outlets()
|
||||
if("command")
|
||||
var/device_id = params["id_tag"]
|
||||
var/cmd = params["cmd"]
|
||||
var/obj/machinery/atmospherics/unary/vent_scrubber/scrubber = locateUID(device_id)
|
||||
|
||||
if(scrubber.stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
|
||||
switch(cmd)
|
||||
if("power")
|
||||
scrubber.on = !scrubber.on
|
||||
if("co2_scrub")
|
||||
scrubber.scrub_CO2 = !scrubber.scrub_CO2
|
||||
if("tox_scrub")
|
||||
scrubber.scrub_Toxins = !scrubber.scrub_Toxins
|
||||
if("n2o_scrub")
|
||||
scrubber.scrub_N2O = !scrubber.scrub_N2O
|
||||
if("n2_scrub")
|
||||
scrubber.scrub_N2 = !scrubber.scrub_N2
|
||||
if("o2_scrub")
|
||||
scrubber.scrub_O2 = !scrubber.scrub_O2
|
||||
if("widenet")
|
||||
scrubber.widenet = !scrubber.widenet
|
||||
if("scrubbing")
|
||||
scrubber.scrubbing = !scrubber.scrubbing
|
||||
refresh_outlets()
|
||||
scrubber.update_icon(UPDATE_ICON_STATE)
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -456,7 +456,8 @@ GLOBAL_LIST_EMPTY(world_uplinks)
|
||||
..()
|
||||
hidden_uplink = new(src)
|
||||
|
||||
/obj/item/multitool/uplink/attack_self__legacy__attackchain(mob/user as mob)
|
||||
/obj/item/multitool/uplink/activate_self(mob/user as mob)
|
||||
. = ..()
|
||||
if(hidden_uplink)
|
||||
hidden_uplink.trigger(user)
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
toolspeed = 1
|
||||
tool_behaviour = TOOL_MULTITOOL
|
||||
hitsound = 'sound/weapons/tap.ogg'
|
||||
new_attack_chain = TRUE
|
||||
/// Reference to whatever machine is held in the buffer
|
||||
var/obj/machinery/buffer // TODO - Make this a soft ref to tie into whats below
|
||||
/// Soft-ref for linked stuff. This should be used over the above var.
|
||||
@@ -47,7 +48,8 @@
|
||||
buffer = null
|
||||
return ..()
|
||||
|
||||
/obj/item/multitool/attack_self__legacy__attackchain(mob/user)
|
||||
/obj/item/multitool/activate_self(mob/user)
|
||||
. = ..()
|
||||
if(!COOLDOWN_FINISHED(src, cd_apc_scan))
|
||||
return
|
||||
COOLDOWN_START(src, cd_apc_scan, 1.5 SECONDS)
|
||||
@@ -61,6 +63,15 @@
|
||||
return
|
||||
to_chat(user, "<span class='notice'>APC detected [get_dist(src, apc)] meter\s [dir2text(get_dir(src, apc))].</span>")
|
||||
|
||||
/obj/item/multitool/ranged_interact_with_atom(atom/target, mob/living/user, list/modifiers)
|
||||
. = ..()
|
||||
if(!(istype(target, /obj/machinery/atmospherics/unary) || istype(target, /obj/machinery/atmospherics/air_sensor)))
|
||||
return
|
||||
if(!(target in view(5, user)))
|
||||
to_chat(user,"<span class='warning'>[target] out of multitool range. Please get within 5 meters and try again.<span>")
|
||||
return
|
||||
return target.multitool_act(user, src)
|
||||
|
||||
// Syndicate device disguised as a multitool; it will turn red when an AI camera is nearby.
|
||||
/obj/item/multitool/ai_detect
|
||||
var/track_cooldown = 0
|
||||
|
||||
@@ -262,3 +262,11 @@
|
||||
user.visible_message("<span class='notice'>[user] unwelds [src]!</span>",\
|
||||
"<span class='notice'>You unweld [src]!</span>")
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/multitool_act(mob/living/user, obj/item/I)
|
||||
if(!ismultitool(I))
|
||||
return
|
||||
|
||||
var/obj/item/multitool/M = I
|
||||
M.buffer_uid = UID()
|
||||
to_chat(user, "<span class='notice'>You save [src] into [M]'s buffer.</span>")
|
||||
|
||||
@@ -10,7 +10,10 @@ export const AtmosTankControl = (props, context) => {
|
||||
let sensors_list = data.sensors || {};
|
||||
|
||||
return (
|
||||
<Window width={400} height={400}>
|
||||
<Window
|
||||
width={400}
|
||||
height={120 + 100 * data.inlets.length + 126 * data.vent_outlets.length + 150 * data.scrubber_outlets.length}
|
||||
>
|
||||
<Window.Content scrollable>
|
||||
{Object.keys(sensors_list).map((s) => (
|
||||
<Section key={s} title={s}>
|
||||
@@ -40,77 +43,192 @@ export const AtmosTankControl = (props, context) => {
|
||||
</LabeledList>
|
||||
</Section>
|
||||
))}
|
||||
{data.inlet && Object.keys(data.inlet).length > 0 ? (
|
||||
<Section title="Inlet Control">
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Power">
|
||||
<Button
|
||||
icon={data.inlet.on ? 'power-off' : 'power-off'}
|
||||
content={data.inlet.on ? 'On' : 'Off'}
|
||||
color={data.inlet.on ? null : 'red'}
|
||||
selected={data.inlet.on}
|
||||
onClick={() => act('toggle_active', { dev: 'inlet' })}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Rate">
|
||||
<NumberInput
|
||||
animated
|
||||
unit={'L/s'}
|
||||
width={6.1}
|
||||
lineHeight={1.5}
|
||||
step={1}
|
||||
minValue={0}
|
||||
maxValue={50}
|
||||
value={data.inlet.rate}
|
||||
onDrag={(e, value) =>
|
||||
act('set_pressure', {
|
||||
dev: 'inlet',
|
||||
val: value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
) : (
|
||||
''
|
||||
)}
|
||||
{data.outlet && Object.keys(data.outlet).length > 0 ? (
|
||||
<Section title="Outlet Control">
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Power">
|
||||
<Button
|
||||
icon={data.outlet.on ? 'power-off' : 'power-off'}
|
||||
content={data.outlet.on ? 'On' : 'Off'}
|
||||
color={data.outlet.on ? null : 'red'}
|
||||
selected={data.outlet.on}
|
||||
onClick={() => act('toggle_active', { dev: 'outlet' })}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Rate">
|
||||
<NumberInput
|
||||
animated
|
||||
unit={'kPa'}
|
||||
width={6.1}
|
||||
lineHeight={1.5}
|
||||
step={10}
|
||||
minValue={0}
|
||||
maxValue={5066}
|
||||
value={data.outlet.rate}
|
||||
onDrag={(e, value) =>
|
||||
act('set_pressure', {
|
||||
dev: 'outlet',
|
||||
val: value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
) : (
|
||||
''
|
||||
)}
|
||||
<Section title="Inlets">
|
||||
{data.inlets && Object.keys(data.inlets).length > 0
|
||||
? data.inlets.map((inlet) => (
|
||||
<Section title={inlet.name} key={inlet}>
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Power">
|
||||
<Button
|
||||
icon={inlet.on ? 'power-off' : 'power-off'}
|
||||
content={inlet.on ? 'On' : 'Off'}
|
||||
color={inlet.on ? null : 'red'}
|
||||
selected={inlet.on}
|
||||
onClick={() => act('toggle_inlet_active', { dev: inlet.uid })}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Rate">
|
||||
<NumberInput
|
||||
animated
|
||||
unit={'L/s'}
|
||||
width={6.1}
|
||||
lineHeight={1.5}
|
||||
step={1}
|
||||
minValue={0}
|
||||
maxValue={50}
|
||||
value={inlet.rate}
|
||||
onDrag={(e, value) =>
|
||||
act('set_inlet_volume_rate', {
|
||||
dev: inlet.uid,
|
||||
val: value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
))
|
||||
: ''}
|
||||
</Section>
|
||||
<Section title="Outlets">
|
||||
{data.vent_outlets && Object.keys(data.vent_outlets).length > 0
|
||||
? data.vent_outlets.map((outlet) => (
|
||||
<Section title={'Outlet: ' + outlet.name} key={outlet}>
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Status">
|
||||
<Button
|
||||
icon={outlet.on ? 'power-off' : 'power-off'}
|
||||
content={outlet.on ? 'On' : 'Off'}
|
||||
color={outlet.on ? null : 'red'}
|
||||
selected={outlet.on}
|
||||
onClick={() => act('toggle_outlet_active', { dev: outlet.uid })}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Pressure Checks">
|
||||
<Button
|
||||
content="External"
|
||||
selected={outlet.checks === 1}
|
||||
onClick={() => act('set_outlet_reference', { dev: outlet.uid, val: 1 })}
|
||||
/>
|
||||
<Button
|
||||
content="Internal"
|
||||
selected={outlet.checks === 2}
|
||||
onClick={() => act('set_outlet_reference', { dev: outlet.uid, val: 2 })}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Rate">
|
||||
<NumberInput
|
||||
animated
|
||||
unit={'kPa'}
|
||||
width={6.1}
|
||||
lineHeight={1.5}
|
||||
step={10}
|
||||
minValue={0}
|
||||
maxValue={5066}
|
||||
value={outlet.rate}
|
||||
onDrag={(e, value) =>
|
||||
act('set_outlet_pressure', {
|
||||
dev: outlet.uid,
|
||||
val: value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
))
|
||||
: ''}
|
||||
{data.scrubber_outlets && Object.keys(data.scrubber_outlets).length > 0 ? <TankControlScrubbersView /> : ''}
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
|
||||
const TankControlScrubbersView = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
return data.scrubber_outlets.map((s) => (
|
||||
<Section title={'Outlet: ' + s.name} key={s.name}>
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Status">
|
||||
<Button
|
||||
content={s.power ? 'On' : 'Off'}
|
||||
selected={s.power}
|
||||
icon="power-off"
|
||||
onClick={() =>
|
||||
act('command', {
|
||||
cmd: 'power',
|
||||
id_tag: s.id_tag,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Button
|
||||
content={s.scrubbing ? 'Scrubbing' : 'Siphoning'}
|
||||
icon={s.scrubbing ? 'filter' : 'sign-in-alt'}
|
||||
onClick={() =>
|
||||
act('command', {
|
||||
cmd: 'scrubbing',
|
||||
id_tag: s.id_tag,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Range">
|
||||
<Button
|
||||
content={s.widenet ? 'Extended' : 'Normal'}
|
||||
selected={s.widenet}
|
||||
icon="expand-arrows-alt"
|
||||
onClick={() =>
|
||||
act('command', {
|
||||
cmd: 'widenet',
|
||||
id_tag: s.id_tag,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Filtering">
|
||||
<Button
|
||||
content="Carbon Dioxide"
|
||||
selected={s.filter_co2}
|
||||
onClick={() =>
|
||||
act('command', {
|
||||
cmd: 'co2_scrub',
|
||||
id_tag: s.id_tag,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Button
|
||||
content="Plasma"
|
||||
selected={s.filter_toxins}
|
||||
onClick={() =>
|
||||
act('command', {
|
||||
cmd: 'tox_scrub',
|
||||
id_tag: s.id_tag,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Button
|
||||
content="Nitrous Oxide"
|
||||
selected={s.filter_n2o}
|
||||
onClick={() =>
|
||||
act('command', {
|
||||
cmd: 'n2o_scrub',
|
||||
id_tag: s.id_tag,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Button
|
||||
content="Oxygen"
|
||||
selected={s.filter_o2}
|
||||
onClick={() =>
|
||||
act('command', {
|
||||
cmd: 'o2_scrub',
|
||||
id_tag: s.id_tag,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Button
|
||||
content="Nitrogen"
|
||||
selected={s.filter_n2}
|
||||
onClick={() =>
|
||||
act('command', {
|
||||
cmd: 'n2_scrub',
|
||||
id_tag: s.id_tag,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
));
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user