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 <Arrow768@users.noreply.github.com>
This commit is contained in:
Arrow768
2026-03-29 02:08:38 +00:00
committed by GitHub
co-authored by Werner
parent 4181b1137f
commit 13fa715edd
10 changed files with 128 additions and 2 deletions
@@ -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)
@@ -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()
@@ -112,6 +112,7 @@
broadcast_status_next_process = FALSE
last_flow_rate = 0
last_mole_transfer = 0
if(!unlocked)
return 0
@@ -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()
@@ -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)
@@ -59,6 +59,7 @@
last_power_draw = 0
last_flow_rate = 0
last_mole_transfer = 0
if (broadcast_status_next_process)
broadcast_status()