TGUI Engineering: Squashed Edition (Commits Below)

TGUI APCs

 TGUI vending machines

 Fix AI default_tgui_interaction

 TGUI Airlocks

 Station & Atmospheric Alert TGUI + Misc NTOS-TGUI Fixes

 TGUI Air Alarms & Central Atmospheric Control

 Airlock TGUI

 TG... got rid of UI for fire alarm. í´·

 TGUI Gas Heating/Cooling System

 TGUI Gas Pump & Passive Gate + Fixes

 TGUI Omni Atmospherics

 TGUI Pipe Dispensers & RPD

 TGUI IntelliCore & Vending Fix

 TGUI Handheld Tanks

 TGUI Portable Pump & Scrubber

 TGUI Tank Dispenser & Canisters

 TGUI Radios

 TGUI SMES & Air Alarm adjustment

 Tweak vending machine interfaces a tad

 TGUI Algae Farm

 TGUI general_air_control

 - Distro & Waste Console
 - Riot Control Console
 - Atmos Intake Console
 - Engine Cooling Console

 TGUI Heavy Scrubber Control (and body scanner fix)

 TGUI trinary devices & shutoff monitor

 TGUI Telecomms Log Browser

 TGUI Telecomms Machine Browser

 TGUI Spaceheater Internal Panel

 TGUI Gravity Generator

 TGUI Id Cards & Fix ID Card Images

 TGUI Id Card Redesign

 TGUI Turbolift

 TGUI Suit Cycler & Suit Storage Unit & Vending Fixes

 TGUI Power Monitor

 TGUI Signalers

 TGUI Employment Records

 TGUI Drone Console

 TGUI RIGSuits

 TGUI PA & PACMAN, and Margin Fix

 TGUI Solar Panels & Fix Power Monitor

 Adjust TGUI modules & their interaction with NTOS

 TGUI RCON

 TGUI Message Monitor

 Bump TGUI line limit to 120 (ParadiseSS13/Paradise#14002)

 TGUI Exonet & NTNet Relay

 TGUI Telecomms Multitool Menu

 TGUI Shield Capacitor & Shield Generator

 TGUI Supermatter-everything & Refactors
This commit is contained in:
ShadowLarkens
2020-08-09 04:46:31 -07:00
parent f1a95c31f8
commit 951f37d2e3
222 changed files with 13749 additions and 9249 deletions
@@ -140,7 +140,7 @@
/obj/machinery/atmospherics/binary/algae_farm/attack_hand(mob/user)
if(..())
return 1
ui_interact(user)
tgui_interact(user)
/obj/machinery/atmospherics/binary/algae_farm/RefreshParts()
..()
@@ -165,7 +165,13 @@
moles_per_tick = initial(moles_per_tick) + (manip_rating**2 - 1)
/obj/machinery/atmospherics/binary/algae_farm/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/nano_ui/master_ui = null, var/datum/topic_state/state = default_state)
/obj/machinery/atmospherics/binary/algae_farm/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "AlgaeFarm", name)
ui.open()
/obj/machinery/atmospherics/binary/algae_farm/tgui_data(mob/user)
var/data[0]
data["panelOpen"] = panel_open
@@ -198,41 +204,28 @@
"percent" = air2.total_moles ? round((air2.gas[output_gas] / air2.total_moles) * 100) : 0,
"moles" = round(air2.gas[output_gas], 0.01))
// 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)
if (!ui)
ui = new(user, src, ui_key, "algae_farm_vr.tmpl", "Algae Farm Control Panel", 500, 600)
ui.set_initial_data(data)
ui.set_auto_update(TRUE)
ui.open()
return data
/obj/machinery/atmospherics/binary/algae_farm/Topic(href, href_list)
/obj/machinery/atmospherics/binary/algae_farm/tgui_act(action, params)
if(..())
return 1
usr.set_machine(src)
return TRUE
add_fingerprint(usr)
// Queue management can be done even while busy
if(href_list["activate"])
update_use_power(USE_POWER_ACTIVE)
update_icon()
updateUsrDialog()
return
if(href_list["deactivate"])
update_use_power(USE_POWER_IDLE)
update_icon()
updateUsrDialog()
return
if(href_list["ejectMaterial"])
var/matName = href_list["ejectMaterial"]
if(!(matName in stored_material))
return
eject_materials(matName, 0)
updateUsrDialog()
return
switch(action)
if("toggle")
if(use_power == USE_POWER_IDLE)
update_use_power(USE_POWER_ACTIVE)
else
update_use_power(USE_POWER_IDLE)
update_icon()
. = TRUE
if("ejectMaterial")
var/matName = params["mat"]
if(!(matName in stored_material))
return
eject_materials(matName, 0)
. = TRUE
// TODO - These should be replaced with materials datum.
@@ -209,18 +209,21 @@
/obj/machinery/atmospherics/binary/passive_gate/attack_hand(user as mob)
if(..())
return
src.add_fingerprint(usr)
if(!src.allowed(user))
add_fingerprint(usr)
if(!allowed(user))
to_chat(user, "<span class='warning'>Access denied.</span>")
return
usr.set_machine(src)
ui_interact(user)
return
tgui_interact(user)
/obj/machinery/atmospherics/binary/passive_gate/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
/obj/machinery/atmospherics/binary/passive_gate/tgui_interact(mob/user, datum/tgui/ui)
if(stat & (BROKEN|NOPOWER))
return
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "PressureRegulator", name)
ui.open()
/obj/machinery/atmospherics/binary/passive_gate/tgui_data(mob/user)
// this is the data which will be sent to the ui
var/data[0]
@@ -235,51 +238,48 @@
"last_flow_rate" = round(last_flow_rate*10),
)
// 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)
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "pressure_regulator.tmpl", name, 470, 370)
ui.set_initial_data(data) // when the ui is first opened this is the data it will use
ui.open() // open the new ui window
ui.set_auto_update(1) // auto update every Master Controller tick
return data
/obj/machinery/atmospherics/binary/passive_gate/Topic(href,href_list)
if(..()) return 1
/obj/machinery/atmospherics/binary/passive_gate/tgui_act(action, params)
if(..())
return TRUE
if(href_list["toggle_valve"])
unlocked = !unlocked
switch(action)
if("toggle_valve")
. = TRUE
unlocked = !unlocked
if("regulate_mode")
. = TRUE
switch(params["mode"])
if("off") regulate_mode = REGULATE_NONE
if("input") regulate_mode = REGULATE_INPUT
if("output") regulate_mode = REGULATE_OUTPUT
if(href_list["regulate_mode"])
switch(href_list["regulate_mode"])
if ("off") regulate_mode = REGULATE_NONE
if ("input") regulate_mode = REGULATE_INPUT
if ("output") regulate_mode = REGULATE_OUTPUT
if("set_press")
. = TRUE
switch(params["press"])
if("min")
target_pressure = 0
if("max")
target_pressure = max_pressure_setting
if("set")
var/new_pressure = input(usr,"Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure Control",src.target_pressure) as num
src.target_pressure = between(0, new_pressure, max_pressure_setting)
switch(href_list["set_press"])
if ("min")
target_pressure = 0
if ("max")
target_pressure = max_pressure_setting
if ("set")
var/new_pressure = input(usr,"Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure Control",src.target_pressure) as num
src.target_pressure = between(0, new_pressure, max_pressure_setting)
if("set_flow_rate")
. = TRUE
switch(params["press"])
if("min")
set_flow_rate = 0
if("max")
set_flow_rate = air1.volume
if("set")
var/new_flow_rate = input(usr,"Enter new flow rate limit (0-[air1.volume]L/s)","Flow Rate Control",src.set_flow_rate) as num
src.set_flow_rate = between(0, new_flow_rate, air1.volume)
switch(href_list["set_flow_rate"])
if ("min")
set_flow_rate = 0
if ("max")
set_flow_rate = air1.volume
if ("set")
var/new_flow_rate = input(usr,"Enter new flow rate limit (0-[air1.volume]kPa)","Flow Rate Control",src.set_flow_rate) as num
src.set_flow_rate = between(0, new_flow_rate, air1.volume)
usr.set_machine(src) //Is this even needed with NanoUI?
src.update_icon()
src.add_fingerprint(usr)
return
update_icon()
add_fingerprint(usr)
/obj/machinery/atmospherics/binary/passive_gate/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if (!W.is_wrench())
@@ -143,10 +143,15 @@ Thus, the two variables affect pump operation are set in New():
return 1
/obj/machinery/atmospherics/binary/pump/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
/obj/machinery/atmospherics/binary/pump/tgui_interact(mob/user, datum/tgui/ui)
if(stat & (BROKEN|NOPOWER))
return
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "GasPump", name)
ui.open()
/obj/machinery/atmospherics/binary/pump/tgui_data(mob/user)
// this is the data which will be sent to the ui
var/data[0]
@@ -159,15 +164,7 @@ Thus, the two variables affect pump operation are set in New():
"max_power_draw" = power_rating,
)
// 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)
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "gas_pump.tmpl", name, 470, 290)
ui.set_initial_data(data) // when the ui is first opened this is the data it will use
ui.open() // open the new ui window
ui.set_auto_update(1) // auto update every Master Controller tick
return data
/obj/machinery/atmospherics/binary/pump/Initialize()
. = ..()
@@ -204,36 +201,40 @@ Thus, the two variables affect pump operation are set in New():
update_icon()
return
/obj/machinery/atmospherics/binary/pump/attack_hand(user as mob)
/obj/machinery/atmospherics/binary/pump/attack_ghost(mob/user)
tgui_interact(user)
/obj/machinery/atmospherics/binary/pump/attack_hand(mob/user)
if(..())
return
src.add_fingerprint(usr)
if(!src.allowed(user))
add_fingerprint(usr)
if(!allowed(user))
to_chat(user, "<span class='warning'>Access denied.</span>")
return
usr.set_machine(src)
ui_interact(user)
return
tgui_interact(user)
/obj/machinery/atmospherics/binary/pump/Topic(href,href_list)
if(..()) return 1
/obj/machinery/atmospherics/binary/pump/tgui_act(action, params)
if(..())
return TRUE
if(href_list["power"])
update_use_power(!use_power)
switch(action)
if("power")
update_use_power(!use_power)
. = TRUE
if("set_press")
var/press = params["press"]
switch(press)
if("min")
target_pressure = 0
if("max")
target_pressure = max_pressure_setting
if("set")
var/new_pressure = input(usr,"Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure control",src.target_pressure) as num
src.target_pressure = between(0, new_pressure, max_pressure_setting)
. = TRUE
switch(href_list["set_press"])
if ("min")
target_pressure = 0
if ("max")
target_pressure = max_pressure_setting
if ("set")
var/new_pressure = input(usr,"Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure control",src.target_pressure) as num
src.target_pressure = between(0, new_pressure, max_pressure_setting)
usr.set_machine(src)
src.add_fingerprint(usr)
src.update_icon()
add_fingerprint(usr)
update_icon()
/obj/machinery/atmospherics/binary/pump/power_change()
var/old_stat = stat
@@ -87,23 +87,14 @@
return 1
/obj/machinery/atmospherics/omni/atmos_filter/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
user.set_machine(src)
var/list/data = new()
data = build_uidata()
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "omni_filter.tmpl", "Omni Filter Control", 330, 330)
ui.set_initial_data(data)
/obj/machinery/atmospherics/omni/atmos_filter/tgui_interact(mob/user,datum/tgui/ui = null)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "OmniFilter", name)
ui.open()
/obj/machinery/atmospherics/omni/atmos_filter/proc/build_uidata()
var/list/data = new()
/obj/machinery/atmospherics/omni/atmos_filter/tgui_data(mob/user)
var/list/data = list()
data["power"] = use_power
data["config"] = configuring
@@ -156,34 +147,41 @@
else
return null
/obj/machinery/atmospherics/omni/atmos_filter/Topic(href, href_list)
if(..()) return 1
switch(href_list["command"])
/obj/machinery/atmospherics/omni/atmos_filter/tgui_act(action, params)
if(..())
return TRUE
switch(action)
if("power")
if(!configuring)
update_use_power(!use_power)
else
update_use_power(USE_POWER_OFF)
. = TRUE
if("configure")
configuring = !configuring
if(configuring)
update_use_power(USE_POWER_OFF)
//only allows config changes when in configuring mode ~otherwise you'll get weird pressure stuff going on
if(configuring && !use_power)
switch(href_list["command"])
if("set_flow_rate")
var/new_flow_rate = input(usr,"Enter new flow rate limit (0-[max_flow_rate]L/s)","Flow Rate Control",set_flow_rate) as num
set_flow_rate = between(0, new_flow_rate, max_flow_rate)
if("switch_mode")
switch_mode(dir_flag(href_list["dir"]), mode_return_switch(href_list["mode"]))
if("switch_filter")
var/new_filter = input(usr,"Select filter mode:","Change filter",href_list["mode"]) in list("None", "Oxygen", "Nitrogen", "Carbon Dioxide", "Phoron", "Nitrous Oxide")
switch_filter(dir_flag(href_list["dir"]), mode_return_switch(new_filter))
. = TRUE
if("set_flow_rate")
if(!configuring || use_power)
return
var/new_flow_rate = input(usr,"Enter new flow rate limit (0-[max_flow_rate]L/s)","Flow Rate Control",set_flow_rate) as num
set_flow_rate = between(0, new_flow_rate, max_flow_rate)
. = TRUE
if("switch_mode")
if(!configuring || use_power)
return
switch_mode(dir_flag(params["dir"]), mode_return_switch(params["mode"]))
. = TRUE
if("switch_filter")
if(!configuring || use_power)
return
var/new_filter = input(usr,"Select filter mode:","Change filter",params["mode"]) in list("None", "Oxygen", "Nitrogen", "Carbon Dioxide", "Phoron", "Nitrous Oxide")
switch_filter(dir_flag(params["dir"]), mode_return_switch(new_filter))
. = TRUE
update_icon()
SSnanoui.update_uis(src)
return
/obj/machinery/atmospherics/omni/atmos_filter/proc/mode_return_switch(var/mode)
switch(mode)
@@ -124,22 +124,13 @@
return 1
/obj/machinery/atmospherics/omni/mixer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
usr.set_machine(src)
var/list/data = new()
data = build_uidata()
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "omni_mixer.tmpl", "Omni Mixer Control", 360, 330)
ui.set_initial_data(data)
/obj/machinery/atmospherics/omni/mixer/tgui_interact(mob/user,datum/tgui/ui = null)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "OmniMixer", name)
ui.open()
/obj/machinery/atmospherics/omni/mixer/proc/build_uidata()
/obj/machinery/atmospherics/omni/mixer/tgui_data(mob/user)
var/list/data = new()
data["power"] = use_power
@@ -172,36 +163,45 @@
return data
/obj/machinery/atmospherics/omni/mixer/Topic(href, href_list)
if(..()) return 1
/obj/machinery/atmospherics/omni/mixer/tgui_act(action, params)
if(..())
return TRUE
switch(href_list["command"])
switch(action)
if("power")
. = TRUE
if(!configuring)
update_use_power(!use_power)
else
update_use_power(USE_POWER_OFF)
if("configure")
. = TRUE
configuring = !configuring
if(configuring)
update_use_power(USE_POWER_OFF)
//only allows config changes when in configuring mode ~otherwise you'll get weird pressure stuff going on
if(configuring && !use_power)
switch(href_list["command"])
if("set_flow_rate")
var/new_flow_rate = input(usr,"Enter new flow rate limit (0-[max_flow_rate]L/s)","Flow Rate Control",set_flow_rate) as num
set_flow_rate = between(0, new_flow_rate, max_flow_rate)
if("switch_mode")
switch_mode(dir_flag(href_list["dir"]), href_list["mode"])
if("switch_con")
change_concentration(dir_flag(href_list["dir"]))
if("switch_conlock")
con_lock(dir_flag(href_list["dir"]))
if("set_flow_rate")
. = TRUE
if(!configuring || use_power)
return
var/new_flow_rate = input(usr,"Enter new flow rate limit (0-[max_flow_rate]L/s)","Flow Rate Control",set_flow_rate) as num
set_flow_rate = between(0, new_flow_rate, max_flow_rate)
if("switch_mode")
. = TRUE
if(!configuring || use_power)
return
switch_mode(dir_flag(params["dir"]), params["mode"])
if("switch_con")
. = TRUE
if(!configuring || use_power)
return
change_concentration(dir_flag(params["dir"]))
if("switch_conlock")
. = TRUE
if(!configuring || use_power)
return
con_lock(dir_flag(params["dir"]))
update_icon()
SSnanoui.update_uis(src)
return
/obj/machinery/atmospherics/omni/mixer/proc/switch_mode(var/port = NORTH, var/mode = ATM_NONE)
if(mode != ATM_INPUT && mode != ATM_OUTPUT)
@@ -110,7 +110,7 @@
return
src.add_fingerprint(usr)
ui_interact(user)
tgui_interact(user)
return
/obj/machinery/atmospherics/omni/proc/build_icons()
@@ -111,7 +111,7 @@
if(frequency)
set_frequency(frequency)
/obj/machinery/atmospherics/trinary/atmos_filter/attack_hand(user as mob) // -- TLE
/obj/machinery/atmospherics/trinary/atmos_filter/attack_hand(user) // -- TLE
if(..())
return
@@ -119,81 +119,106 @@
to_chat(user, "<span class='warning'>Access denied.</span>")
return
var/dat
var/current_filter_type
switch(filter_type)
if(0)
current_filter_type = "Phoron"
if(1)
current_filter_type = "Oxygen"
if(2)
current_filter_type = "Nitrogen"
if(3)
current_filter_type = "Carbon Dioxide"
if(4)
current_filter_type = "Nitrous Oxide"
if(-1)
current_filter_type = "Nothing"
else
current_filter_type = "ERROR - Report this bug to the admin, please!"
tgui_interact(user)
dat += {"
<b>Power: </b><a href='?src=\ref[src];power=1'>[use_power?"On":"Off"]</a><br>
<b>Filtering: </b>[current_filter_type]<br><HR>
<h4>Set Filter Type:</h4>
<A href='?src=\ref[src];filterset=0'>Phoron</A><BR>
<A href='?src=\ref[src];filterset=1'>Oxygen</A><BR>
<A href='?src=\ref[src];filterset=2'>Nitrogen</A><BR>
<A href='?src=\ref[src];filterset=3'>Carbon Dioxide</A><BR>
<A href='?src=\ref[src];filterset=4'>Nitrous Oxide</A><BR>
<A href='?src=\ref[src];filterset=-1'>Nothing</A><BR>
<HR>
<B>Set Flow Rate Limit:</B>
[src.set_flow_rate]L/s | <a href='?src=\ref[src];set_flow_rate=1'>Change</a><BR>
<B>Flow rate: </B>[round(last_flow_rate, 0.1)]L/s
"}
// var/dat
// var/current_filter_type
// switch(filter_type)
// if(0)
// current_filter_type = "Phoron"
// if(1)
// current_filter_type = "Oxygen"
// if(2)
// current_filter_type = "Nitrogen"
// if(3)
// current_filter_type = "Carbon Dioxide"
// if(4)
// current_filter_type = "Nitrous Oxide"
// if(-1)
// current_filter_type = "Nothing"
// else
// current_filter_type = "ERROR - Report this bug to the admin, please!"
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmos_filter")
onclose(user, "atmos_filter")
return
// dat += {"
// <b>Power: </b><a href='?src=\ref[src];power=1'>[use_power?"On":"Off"]</a><br>
// <b>Filtering: </b>[current_filter_type]<br><HR>
// <h4>Set Filter Type:</h4>
// <A href='?src=\ref[src];filterset=0'>Phoron</A><BR>
// <A href='?src=\ref[src];filterset=1'>Oxygen</A><BR>
// <A href='?src=\ref[src];filterset=2'>Nitrogen</A><BR>
// <A href='?src=\ref[src];filterset=3'>Carbon Dioxide</A><BR>
// <A href='?src=\ref[src];filterset=4'>Nitrous Oxide</A><BR>
// <A href='?src=\ref[src];filterset=-1'>Nothing</A><BR>
// <HR>
// <B>Set Flow Rate Limit:</B>
// [src.set_flow_rate]L/s | <a href='?src=\ref[src];set_flow_rate=1'>Change</a><BR>
// <B>Flow rate: </B>[round(last_flow_rate, 0.1)]L/s
// "}
/obj/machinery/atmospherics/trinary/atmos_filter/Topic(href, href_list) // -- TLE
// user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmos_filter")
// onclose(user, "atmos_filter")
/obj/machinery/atmospherics/trinary/atmos_filter/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "AtmosFilter", name)
ui.open()
/obj/machinery/atmospherics/trinary/atmos_filter/tgui_data(mob/user)
var/list/data = list()
data["on"] = use_power
data["rate"] = set_flow_rate
data["max_rate"] = air1.volume
data["filter_types"] = list()
data["filter_types"] += list(list("name" = "Nothing", "f_type" = -1, "selected" = filter_type == -1))
data["filter_types"] += list(list("name" = "Phoron", "f_type" = 0, "selected" = filter_type == 0))
data["filter_types"] += list(list("name" = "Oxygen", "f_type" = 1, "selected" = filter_type == 1))
data["filter_types"] += list(list("name" = "Nitrogen", "f_type" = 2, "selected" = filter_type == 2))
data["filter_types"] += list(list("name" = "Carbon Dioxide", "f_type" = 3, "selected" = filter_type == 3))
data["filter_types"] += list(list("name" = "Nitrous Oxide", "f_type" = 4, "selected" = filter_type == 4))
return data
/obj/machinery/atmospherics/trinary/atmos_filter/tgui_act(action, params)
if(..())
return 1
usr.set_machine(src)
src.add_fingerprint(usr)
if(href_list["filterset"])
filter_type = text2num(href_list["filterset"])
return TRUE
filtered_out.Cut() //no need to create new lists unnecessarily
switch(filter_type)
if(0) //removing hydrocarbons
filtered_out += "phoron"
filtered_out += "oxygen_agent_b"
if(1) //removing O2
filtered_out += "oxygen"
if(2) //removing N2
filtered_out += "nitrogen"
if(3) //removing CO2
filtered_out += "carbon_dioxide"
if(4)//removing N2O
filtered_out += "sleeping_agent"
switch(action)
if("power")
update_use_power(!use_power)
if("rate")
var/rate = params["rate"]
if(rate == "max")
rate = air1.volume
. = TRUE
else if(text2num(rate) != null)
rate = text2num(rate)
. = TRUE
if(.)
set_flow_rate = clamp(rate, 0, air1.volume)
if("filter")
. = TRUE
filter_type = text2num(params["filterset"])
filtered_out.Cut() //no need to create new lists unnecessarily
switch(filter_type)
if(0) //removing hydrocarbons
filtered_out += "phoron"
filtered_out += "oxygen_agent_b"
if(1) //removing O2
filtered_out += "oxygen"
if(2) //removing N2
filtered_out += "nitrogen"
if(3) //removing CO2
filtered_out += "carbon_dioxide"
if(4)//removing N2O
filtered_out += "sleeping_agent"
if (href_list["temp"])
src.temp = null
if(href_list["set_flow_rate"])
var/new_flow_rate = input(usr,"Enter new flow rate (0-[air1.volume]L/s)","Flow Rate Control",src.set_flow_rate) as num
src.set_flow_rate = max(0, min(air1.volume, new_flow_rate))
if(href_list["power"])
update_use_power(!use_power)
src.update_icon()
src.updateUsrDialog()
/*
for(var/mob/M in viewers(1, src))
if ((M.client && M.machine == src))
src.attack_hand(M)
*/
return
add_fingerprint(usr)
update_icon()
//
// Mirrored Orientation - Flips the output dir to opposite side from normal.
@@ -77,59 +77,88 @@
return 1
/obj/machinery/atmospherics/trinary/mixer/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "AtmosMixer", name)
ui.open()
/obj/machinery/atmospherics/trinary/mixer/tgui_data(mob/user)
var/list/data = list()
data["on"] = use_power
data["set_pressure"] = round(set_flow_rate)
data["max_pressure"] = min(air1.volume, air2.volume)
data["node1_concentration"] = round(mixing_inputs[air1]*100, 1)
data["node2_concentration"] = round(mixing_inputs[air2]*100, 1)
var/list/node_connects = get_node_connect_dirs()
data["node1_dir"] = dir_name(node_connects[1],TRUE)
data["node2_dir"] = dir_name(node_connects[2],TRUE)
return data
/obj/machinery/atmospherics/trinary/mixer/attack_hand(user as mob)
if(..())
return
src.add_fingerprint(usr)
if(!src.allowed(user))
to_chat(user, "<span class='warning'>Access denied.</span>")
return
usr.set_machine(src)
var/list/node_connects = get_node_connect_dirs()
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[use_power?"On":"Off"]</a><br>
<b>Set Flow Rate Limit: </b>
[set_flow_rate]L/s | <a href='?src=\ref[src];set_press=1'>Change</a>
<br>
<b>Flow Rate: </b>[round(last_flow_rate, 0.1)]L/s
<br><hr>
<b>Node 1 ([dir_name(node_connects[1],TRUE)]) Concentration:</b>
<a href='?src=\ref[src];node1_c=-0.1'><b>-</b></a>
<a href='?src=\ref[src];node1_c=-0.01'>-</a>
[mixing_inputs[air1]]([mixing_inputs[air1]*100]%)
<a href='?src=\ref[src];node1_c=0.01'><b>+</b></a>
<a href='?src=\ref[src];node1_c=0.1'>+</a>
<br>
<b>Node 2 ([dir_name(node_connects[2],TRUE)]) Concentration:</b>
<a href='?src=\ref[src];node2_c=-0.1'><b>-</b></a>
<a href='?src=\ref[src];node2_c=-0.01'>-</a>
[mixing_inputs[air2]]([mixing_inputs[air2]*100]%)
<a href='?src=\ref[src];node2_c=0.01'><b>+</b></a>
<a href='?src=\ref[src];node2_c=0.1'>+</a>
"}
tgui_interact(user)
// src.add_fingerprint(usr)
// if(!src.allowed(user))
// to_chat(user, "<span class='warning'>Access denied.</span>")
// return
// usr.set_machine(src)
// var/list/node_connects = get_node_connect_dirs()
// var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[use_power?"On":"Off"]</a><br>
// <b>Set Flow Rate Limit: </b>
// [set_flow_rate]L/s | <a href='?src=\ref[src];set_press=1'>Change</a>
// <br>
// <b>Flow Rate: </b>[round(last_flow_rate, 0.1)]L/s
// <br><hr>
// <b>Node 1 ([dir_name(node_connects[1],TRUE)]) Concentration:</b>
// <a href='?src=\ref[src];node1_c=-0.1'><b>-</b></a>
// <a href='?src=\ref[src];node1_c=-0.01'>-</a>
// [mixing_inputs[air1]]([mixing_inputs[air1]*100]%)
// <a href='?src=\ref[src];node1_c=0.01'><b>+</b></a>
// <a href='?src=\ref[src];node1_c=0.1'>+</a>
// <br>
// <b>Node 2 ([dir_name(node_connects[2],TRUE)]) Concentration:</b>
// <a href='?src=\ref[src];node2_c=-0.1'><b>-</b></a>
// <a href='?src=\ref[src];node2_c=-0.01'>-</a>
// [mixing_inputs[air2]]([mixing_inputs[air2]*100]%)
// <a href='?src=\ref[src];node2_c=0.01'><b>+</b></a>
// <a href='?src=\ref[src];node2_c=0.1'>+</a>
// "}
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_mixer")
onclose(user, "atmo_mixer")
return
// user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_mixer")
// onclose(user, "atmo_mixer")
// return
/obj/machinery/atmospherics/trinary/mixer/Topic(href,href_list)
if(..()) return 1
if(href_list["power"])
update_use_power(!use_power)
if(href_list["set_press"])
var/max_flow_rate = min(air1.volume, air2.volume)
var/new_flow_rate = input(usr,"Enter new flow rate limit (0-[max_flow_rate]L/s)","Flow Rate Control",src.set_flow_rate) as num
src.set_flow_rate = max(0, min(max_flow_rate, new_flow_rate))
if(href_list["node1_c"])
var/value = text2num(href_list["node1_c"])
src.mixing_inputs[air1] = max(0, min(1, src.mixing_inputs[air1] + value))
src.mixing_inputs[air2] = 1.0 - mixing_inputs[air1]
if(href_list["node2_c"])
var/value = text2num(href_list["node2_c"])
src.mixing_inputs[air2] = max(0, min(1, src.mixing_inputs[air2] + value))
src.mixing_inputs[air1] = 1.0 - mixing_inputs[air2]
src.update_icon()
src.updateUsrDialog()
return
/obj/machinery/atmospherics/trinary/mixer/tgui_act(action, params)
if(..())
return TRUE
switch(action)
if("power")
update_use_power(!use_power)
. = TRUE
if("pressure")
var/pressure = params["pressure"]
if(pressure == "max")
pressure = min(air1.volume, air2.volume)
. = TRUE
else if(text2num(pressure) != null)
pressure = text2num(pressure)
. = TRUE
if(.)
set_flow_rate = clamp(pressure, 0, min(air1.volume, air2.volume))
if("node1")
var/value = text2num(params["concentration"])
mixing_inputs[air1] = max(0, min(1, value / 100))
mixing_inputs[air2] = 1.0 - mixing_inputs[air1]
. = TRUE
if("node2")
var/value = text2num(params["concentration"])
mixing_inputs[air2] = max(0, min(1, value / 100))
mixing_inputs[air1] = 1.0 - mixing_inputs[air2]
. = TRUE
update_icon()
//
// "T" Orientation - Inputs are on oposite sides instead of adjacent
+27 -29
View File
@@ -53,12 +53,18 @@
return
/obj/machinery/atmospherics/unary/freezer/attack_ai(mob/user as mob)
ui_interact(user)
tgui_interact(user)
/obj/machinery/atmospherics/unary/freezer/attack_hand(mob/user as mob)
ui_interact(user)
tgui_interact(user)
/obj/machinery/atmospherics/unary/freezer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
/obj/machinery/atmospherics/unary/freezer/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "GasTemperatureSystem", name)
ui.open()
/obj/machinery/atmospherics/unary/freezer/tgui_data(mob/user)
// this is the data which will be sent to the ui
var/data[0]
data["on"] = use_power ? 1 : 0
@@ -76,34 +82,26 @@
temp_class = "average"
data["gasTemperatureClass"] = temp_class
// 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)
if(!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "freezer.tmpl", "Gas Cooling System", 440, 300)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
ui.open()
// auto update every Master Controller tick
ui.set_auto_update(1)
return data
/obj/machinery/atmospherics/unary/freezer/Topic(href, href_list)
/obj/machinery/atmospherics/unary/freezer/tgui_act(action, params)
if(..())
return 1
if(href_list["toggleStatus"])
update_use_power(!use_power)
update_icon()
if(href_list["temp"])
var/amount = text2num(href_list["temp"])
if(amount > 0)
set_temperature = min(set_temperature + amount, 1000)
else
set_temperature = max(set_temperature + amount, 0)
if(href_list["setPower"]) //setting power to 0 is redundant anyways
var/new_setting = between(0, text2num(href_list["setPower"]), 100)
set_power_level(new_setting)
return TRUE
. = TRUE
switch(action)
if("toggleStatus")
update_use_power(!use_power)
update_icon()
if("setGasTemperature")
var/amount = text2num(params["temp"])
if(amount > 0)
set_temperature = min(amount, 1000)
else
set_temperature = max(amount, 0)
if("setPower") //setting power to 0 is redundant anyways
var/new_setting = between(0, text2num(params["value"]), 100)
set_power_level(new_setting)
add_fingerprint(usr)
@@ -75,12 +75,18 @@
update_icon()
/obj/machinery/atmospherics/unary/heater/attack_ai(mob/user as mob)
ui_interact(user)
tgui_interact(user)
/obj/machinery/atmospherics/unary/heater/attack_hand(mob/user as mob)
ui_interact(user)
tgui_interact(user)
/obj/machinery/atmospherics/unary/heater/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
/obj/machinery/atmospherics/unary/heater/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "GasTemperatureSystem", name)
ui.open()
/obj/machinery/atmospherics/unary/heater/tgui_data(mob/user)
// this is the data which will be sent to the ui
var/data[0]
data["on"] = use_power ? 1 : 0
@@ -91,39 +97,31 @@
data["targetGasTemperature"] = round(set_temperature)
data["powerSetting"] = power_setting
var/temp_class = "normal"
var/temp_class = "average"
if(air_contents.temperature > (T20C+40))
temp_class = "bad"
data["gasTemperatureClass"] = temp_class
// 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)
if(!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "freezer.tmpl", "Gas Heating System", 440, 300)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
ui.open()
// auto update every Master Controller tick
ui.set_auto_update(1)
return data
/obj/machinery/atmospherics/unary/heater/Topic(href, href_list)
/obj/machinery/atmospherics/unary/heater/tgui_act(action, params)
if(..())
return 1
if(href_list["toggleStatus"])
update_use_power(!use_power)
update_icon()
if(href_list["temp"])
var/amount = text2num(href_list["temp"])
if(amount > 0)
set_temperature = min(set_temperature + amount, max_temperature)
else
set_temperature = max(set_temperature + amount, 0)
if(href_list["setPower"]) //setting power to 0 is redundant anyways
var/new_setting = between(0, text2num(href_list["setPower"]), 100)
set_power_level(new_setting)
return TRUE
. = TRUE
switch(action)
if("toggleStatus")
update_use_power(!use_power)
update_icon()
if("setGasTemperature")
var/amount = text2num(params["temp"])
if(amount > 0)
set_temperature = min(amount, max_temperature)
else
set_temperature = max(amount, 0)
if("setPower") //setting power to 0 is redundant anyways
var/new_setting = between(0, text2num(params["value"]), 100)
set_power_level(new_setting)
add_fingerprint(usr)
@@ -374,6 +374,12 @@
ONE_ATMOSPHERE*50
)
if("reset_external_pressure" in signal.data)
external_pressure_bound = ONE_ATMOSPHERE
if("reset_internal_pressure" in signal.data)
internal_pressure_bound = 0
if(signal.data["init"] != null)
name = signal.data["init"]
return