grr atmos
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user