From 636d6bf32feee7713929336a56fe3db9d1a07e2d Mon Sep 17 00:00:00 2001 From: Letter N <24603524+LetterN@users.noreply.github.com> Date: Fri, 19 Feb 2021 10:39:06 +0800 Subject: [PATCH] grr atmos --- code/modules/atmospherics/gasmixtures/gas_mixture.dm | 11 ++++++----- .../components/binary_devices/passive_gate.dm | 2 +- .../atmospherics/machinery/portable/canister.dm | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm index 0e1f4ae065..f310f17b04 100644 --- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm +++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm @@ -361,9 +361,10 @@ get_true_breath_pressure(pp) --> gas_pp = pp/breath_pp*total_moles() */ /// Releases gas from src to output air. This means that it can not transfer air to gas mixture with higher pressure. -/datum/gas_mixture/proc/release_gas_to(datum/gas_mixture/output_air, target_pressure) +/// a global proc due to rustmos +/proc/release_gas_to(datum/gas_mixture/input_air, datum/gas_mixture/output_air, target_pressure) var/output_starting_pressure = output_air.return_pressure() - var/input_starting_pressure = return_pressure() + var/input_starting_pressure = input_air.return_pressure() if(output_starting_pressure >= min(target_pressure,input_starting_pressure-10)) //No need to pump gas if target is already reached or input pressure is too low @@ -371,14 +372,14 @@ get_true_breath_pressure(pp) --> gas_pp = pp/breath_pp*total_moles() return FALSE //Calculate necessary moles to transfer using PV = nRT - if((total_moles() > 0) && (return_temperature()>0)) + if((input_air.total_moles() > 0) && (input_air.return_temperature()>0)) var/pressure_delta = min(target_pressure - output_starting_pressure, (input_starting_pressure - output_starting_pressure)/2) //Can not have a pressure delta that would cause output_pressure > input_pressure - var/transfer_moles = pressure_delta*output_air.return_volume()/(return_temperature() * R_IDEAL_GAS_EQUATION) + var/transfer_moles = pressure_delta*output_air.return_volume()/(input_air.return_temperature() * R_IDEAL_GAS_EQUATION) //Actually transfer the gas - var/datum/gas_mixture/removed = remove(transfer_moles) + var/datum/gas_mixture/removed = input_air.remove(transfer_moles) output_air.merge(removed) return TRUE diff --git a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm index 07573fb2b7..56a7d78288 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm @@ -55,7 +55,7 @@ Passive gate is similar to the regular pump except: var/datum/gas_mixture/air1 = airs[1] var/datum/gas_mixture/air2 = airs[2] - if(air1.release_gas_to(air2, target_pressure)) + if(release_gas_to(air1, air2, target_pressure)) update_parents() diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index 03119d050c..b1fe4e15f4 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -323,7 +323,7 @@ var/turf/T = get_turf(src) var/datum/gas_mixture/target_air = holding ? holding.air_contents : T.return_air() - if(air_contents.release_gas_to(target_air, release_pressure) && !holding) + if(release_gas_to(air_contents, target_air, release_pressure) && !holding) air_update_turf() // var/our_pressure = air_contents.return_pressure()