From 13fa715edd7a79662b69dbf3187f5da213d05135 Mon Sep 17 00:00:00 2001 From: Arrow768 <1331699+Arrow768@users.noreply.github.com> Date: Sun, 29 Mar 2026 04:08:38 +0200 Subject: [PATCH] Pump GUI Update (#22100) Updates the GUI of the Atmos Pumps to include a normalized flow rate (normalized to 1ATM and 20C) and measurement functionality. --------- Co-authored-by: Werner --- code/game/machinery/atmoalter/pump.dm | 1 + code/game/machinery/atmoalter/scrubber.dm | 3 + .../atmospherics/_atmospherics_helpers.dm | 15 ++++- code/modules/atmospherics/atmospherics.dm | 1 + .../components/binary_devices/passive_gate.dm | 1 + .../components/binary_devices/pump.dm | 18 ++++++ .../components/omni_devices/omni_base.dm | 1 + .../components/unary/outlet_injector.dm | 1 + html/changelogs/arrow768.yml | 58 +++++++++++++++++++ tgui/packages/tgui/interfaces/AtmosPump.tsx | 31 +++++++++- 10 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 html/changelogs/arrow768.yml diff --git a/code/game/machinery/atmoalter/pump.dm b/code/game/machinery/atmoalter/pump.dm index 5415c15348b..72c144821d6 100644 --- a/code/game/machinery/atmoalter/pump.dm +++ b/code/game/machinery/atmoalter/pump.dm @@ -102,6 +102,7 @@ if (power_draw < 0) last_flow_rate = 0 last_power_draw = 0 + last_mole_transfer = 0 else power_draw = max(power_draw, power_losses) cell.use(power_draw * CELLRATE) diff --git a/code/game/machinery/atmoalter/scrubber.dm b/code/game/machinery/atmoalter/scrubber.dm index fe9b2cf3de1..cf1443b4840 100644 --- a/code/game/machinery/atmoalter/scrubber.dm +++ b/code/game/machinery/atmoalter/scrubber.dm @@ -76,6 +76,7 @@ if (power_draw < 0) last_flow_rate = 0 last_power_draw = 0 + last_mole_transfer = 0 else power_draw = max(power_draw, power_losses) cell.use(power_draw * CELLRATE) @@ -197,6 +198,7 @@ update_use_power(POWER_USE_OFF) last_flow_rate = 0 last_power_draw = 0 + last_mole_transfer = 0 return 0 var/power_draw = -1 @@ -212,6 +214,7 @@ if (power_draw < 0) last_flow_rate = 0 last_power_draw = 0 + last_mole_transfer = 0 else use_power_oneoff(power_draw) update_connected_network() diff --git a/code/modules/atmospherics/_atmospherics_helpers.dm b/code/modules/atmospherics/_atmospherics_helpers.dm index 4f396f1016a..a69931c6d53 100644 --- a/code/modules/atmospherics/_atmospherics_helpers.dm +++ b/code/modules/atmospherics/_atmospherics_helpers.dm @@ -10,8 +10,9 @@ /obj/machinery/atmospherics/var/last_flow_rate = 0 /obj/machinery/atmospherics/var/last_power_draw = 0 +/obj/machinery/atmospherics/var/last_mole_transfer = 0 /obj/machinery/portable_atmospherics/var/last_flow_rate = 0 - +/obj/machinery/portable_atmospherics/var/last_mole_transfer = 0 /obj/machinery/atmospherics/var/debug = 0 @@ -46,6 +47,7 @@ if (istype(M, /obj/machinery/atmospherics)) var/obj/machinery/atmospherics/A = M A.last_flow_rate = (transfer_moles/source.total_moles)*source.volume //group_multiplier gets divided out here + A.last_mole_transfer = transfer_moles if (A.debug) A.visible_message("[A]: source entropy: [round(source.specific_entropy(), 0.01)] J/Kmol --> sink entropy: [round(sink.specific_entropy(), 0.01)] J/Kmol") @@ -56,6 +58,7 @@ if (istype(M, /obj/machinery/portable_atmospherics)) var/obj/machinery/portable_atmospherics/P = M P.last_flow_rate = (transfer_moles/source.total_moles)*source.volume //group_multiplier gets divided out here + P.last_mole_transfer = transfer_moles var/datum/gas_mixture/removed = source.remove(transfer_moles) if (!removed) //Just in case @@ -87,12 +90,14 @@ if (istype(M, /obj/machinery/atmospherics)) var/obj/machinery/atmospherics/A = M A.last_flow_rate = (transfer_moles/source.total_moles)*source.volume //group_multiplier gets divided out here + A.last_mole_transfer = transfer_moles if (A.debug) A.visible_message("[A]: moles transferred = [transfer_moles] mol") if (istype(M, /obj/machinery/portable_atmospherics)) var/obj/machinery/portable_atmospherics/P = M P.last_flow_rate = (transfer_moles/source.total_moles)*source.volume //group_multiplier gets divided out here + P.last_mole_transfer = transfer_moles var/datum/gas_mixture/removed = source.remove(transfer_moles) if(!removed) //Just in case @@ -149,9 +154,11 @@ if (istype(M, /obj/machinery/atmospherics)) var/obj/machinery/atmospherics/A = M A.last_flow_rate = (total_transfer_moles/source.total_moles)*source.volume //group_multiplier gets divided out here + A.last_mole_transfer = total_transfer_moles if (istype(M, /obj/machinery/portable_atmospherics)) var/obj/machinery/portable_atmospherics/P = M P.last_flow_rate = (total_transfer_moles/source.total_moles)*source.volume //group_multiplier gets divided out here + P.last_mole_transfer = total_transfer_moles var/power_draw = 0 for (var/g in filtering) @@ -218,9 +225,11 @@ if (istype(M, /obj/machinery/atmospherics)) var/obj/machinery/atmospherics/A = M A.last_flow_rate = (total_transfer_moles/source.total_moles)*source.volume //group_multiplier gets divided out here + A.last_mole_transfer = total_transfer_moles if (istype(M, /obj/machinery/portable_atmospherics)) var/obj/machinery/portable_atmospherics/P = M P.last_flow_rate = (total_transfer_moles/source.total_moles)*source.volume //group_multiplier gets divided out here + P.last_mole_transfer = total_transfer_moles var/datum/gas_mixture/removed = source.remove(total_transfer_moles) if (!removed) //Just in case @@ -291,9 +300,11 @@ if (istype(M, /obj/machinery/atmospherics)) var/obj/machinery/atmospherics/A = M A.last_flow_rate = (total_transfer_moles/source.total_moles)*source.volume //group_multiplier gets divided out here + A.last_mole_transfer = total_transfer_moles if (istype(M, /obj/machinery/portable_atmospherics)) var/obj/machinery/portable_atmospherics/P = M P.last_flow_rate = (total_transfer_moles/source.total_moles)*source.volume //group_multiplier gets divided out here + P.last_mole_transfer = total_transfer_moles var/datum/gas_mixture/removed = source.remove(total_transfer_moles) if (!removed) //Just in case @@ -372,9 +383,11 @@ if (istype(M, /obj/machinery/atmospherics)) var/obj/machinery/atmospherics/A = M A.last_flow_rate = (total_transfer_moles/total_input_moles)*total_input_volume //group_multiplier gets divided out here + A.last_mole_transfer = total_transfer_moles if (istype(M, /obj/machinery/portable_atmospherics)) var/obj/machinery/portable_atmospherics/P = M P.last_flow_rate = (total_transfer_moles/total_input_moles)*total_input_volume //group_multiplier gets divided out here + P.last_mole_transfer = total_transfer_moles var/total_power_draw = 0 for (var/datum/gas_mixture/source in mix_sources) diff --git a/code/modules/atmospherics/atmospherics.dm b/code/modules/atmospherics/atmospherics.dm index ba316f2a229..6cfda76c3f1 100644 --- a/code/modules/atmospherics/atmospherics.dm +++ b/code/modules/atmospherics/atmospherics.dm @@ -103,6 +103,7 @@ Pipelines + Other Objects -> Pipe network /obj/machinery/atmospherics/process(seconds_per_tick) last_flow_rate = 0 last_power_draw = 0 + last_mole_transfer = 0 build_network() diff --git a/code/modules/atmospherics/components/binary_devices/passive_gate.dm b/code/modules/atmospherics/components/binary_devices/passive_gate.dm index 677b8a7bdd3..e52394bf0c1 100644 --- a/code/modules/atmospherics/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/components/binary_devices/passive_gate.dm @@ -112,6 +112,7 @@ broadcast_status_next_process = FALSE last_flow_rate = 0 + last_mole_transfer = 0 if(!unlocked) return 0 diff --git a/code/modules/atmospherics/components/binary_devices/pump.dm b/code/modules/atmospherics/components/binary_devices/pump.dm index e407eeb6a66..36b184da4db 100644 --- a/code/modules/atmospherics/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/components/binary_devices/pump.dm @@ -36,10 +36,16 @@ Thus, the two variables affect pump operation are set in New(): var/broadcast_status_next_process = FALSE + // Measure amount of gas pumped through + var/measure_enabled = FALSE + var/moles_pumped = 0 + /obj/machinery/atmospherics/binary/pump/mechanics_hints(mob/user, distance, is_adjacent) . += ..() . += "This moves gas from one pipe to another. A higher target pressure demands more energy." . += "The side with the colored end is the output." + . += "The normalized flow rate is the flow rate in L based on the moles transferred normalized to a preassure 1ATM and temperature of 20C." + . += "The same applies to the measurement section." /obj/machinery/atmospherics/binary/pump/Initialize() . = ..() @@ -112,6 +118,7 @@ Thus, the two variables affect pump operation are set in New(): /obj/machinery/atmospherics/binary/pump/process() last_power_draw = 0 last_flow_rate = 0 + last_mole_transfer = 0 if((stat & (NOPOWER|BROKEN)) || !use_power) return @@ -138,6 +145,9 @@ Thus, the two variables affect pump operation are set in New(): if(network2) network2.update = 1 + if (measure_enabled) + moles_pumped += last_mole_transfer + return 1 //Radio remote control @@ -182,6 +192,10 @@ Thus, the two variables affect pump operation are set in New(): data["power_draw"] = round(last_power_draw) data["max_power_draw"] = power_rating data["flow_rate"] = round(last_flow_rate) + data["flow_rate_normal"] = round((last_mole_transfer * R_IDEAL_GAS_EQUATION * T20C) / ONE_ATMOSPHERE) + data["measure_enabled"] = measure_enabled + data["moles_pumped"] = round(moles_pumped) + data["liters_pumped"] = round((moles_pumped * R_IDEAL_GAS_EQUATION * T20C) / ONE_ATMOSPHERE) return data /obj/machinery/atmospherics/binary/pump/ui_act(action, params) @@ -202,6 +216,10 @@ Thus, the two variables affect pump operation are set in New(): . = TRUE if(.) target_pressure = clamp(pressure, 0, ATMOS_PUMP_MAX_PRESSURE) + if("toggle_measure") + measure_enabled = !measure_enabled + if("reset_measure") + moles_pumped = 0 update_icon() /obj/machinery/atmospherics/binary/pump/atmos_init() diff --git a/code/modules/atmospherics/components/omni_devices/omni_base.dm b/code/modules/atmospherics/components/omni_devices/omni_base.dm index e848f807247..60212c04272 100644 --- a/code/modules/atmospherics/components/omni_devices/omni_base.dm +++ b/code/modules/atmospherics/components/omni_devices/omni_base.dm @@ -68,6 +68,7 @@ /obj/machinery/atmospherics/omni/process() last_power_draw = 0 last_flow_rate = 0 + last_mole_transfer = 0 if(error_check()) update_use_power(POWER_USE_OFF) diff --git a/code/modules/atmospherics/components/unary/outlet_injector.dm b/code/modules/atmospherics/components/unary/outlet_injector.dm index d7dbf3c923c..7adbd50d296 100644 --- a/code/modules/atmospherics/components/unary/outlet_injector.dm +++ b/code/modules/atmospherics/components/unary/outlet_injector.dm @@ -59,6 +59,7 @@ last_power_draw = 0 last_flow_rate = 0 + last_mole_transfer = 0 if (broadcast_status_next_process) broadcast_status() diff --git a/html/changelogs/arrow768.yml b/html/changelogs/arrow768.yml new file mode 100644 index 00000000000..144f605fa3d --- /dev/null +++ b/html/changelogs/arrow768.yml @@ -0,0 +1,58 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: arrow768 + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Added a indicator for the normalized flow rate to atmos pumps, as well as a measurement functionality." diff --git a/tgui/packages/tgui/interfaces/AtmosPump.tsx b/tgui/packages/tgui/interfaces/AtmosPump.tsx index c412bb244a7..7a56027c6b8 100644 --- a/tgui/packages/tgui/interfaces/AtmosPump.tsx +++ b/tgui/packages/tgui/interfaces/AtmosPump.tsx @@ -18,6 +18,9 @@ type Data = { power_draw: number; max_power_draw: number; flow_rate: number; + flow_rate_normal: number; + liters_pumped: number; + measure_enabled: BooleanLike; }; export const AtmosPump = (props, context) => { @@ -31,10 +34,13 @@ export const AtmosPump = (props, context) => { pressure, power_draw, flow_rate, + flow_rate_normal, + liters_pumped, + measure_enabled, } = data; return ( - +
@@ -126,6 +132,29 @@ export const AtmosPump = (props, context) => { '' )} {flow_rate} L/s + + {flow_rate_normal} L/s + + +
+
+ + + {liters_pumped} L +