Moves assert_gas() into a define it should always have been, speeding up atmos slightly

This commit is contained in:
Jordan Brown
2017-10-07 14:36:28 -04:00
committed by CitadelStationBot
parent 5f4b3594d0
commit 4f32b7a0d4
17 changed files with 266 additions and 63 deletions

View File

@@ -176,3 +176,11 @@
#define LAVALAND_DEFAULT_ATMOS "o2=14;n2=23;TEMP=300"
#define THERMAL_ENERGY(gas) (gas.temperature * gas.heat_capacity())
#define ADD_GAS(gas_id, out_list)\
var/list/tmp_gaslist = GLOB.gaslist_cache[gas_id];\
out_list[gas_id] = tmp_gaslist.Copy();
//ASSERT_GAS(gas_id, gas_mixture) - used to guarantee that the gas list for this id exists in gas_mixture.gases.
//Must be used before adding to a gas. May be used before reading from a gas.
#define ASSERT_GAS(gas_id, gas_mixture) if (!gas_mixture.gases[gas_id]) { ADD_GAS(gas_id, gas_mixture.gases) };

View File

@@ -426,7 +426,7 @@
if(!istype(T))
return
var/datum/gas_mixture/GM = new
GM.assert_gas("plasma")
ASSERT_GAS("plasma", GM)
if(prob(10))
GM.gases["plasma"][MOLES] += 100
GM.temperature = 1500+T0C //should be enough to start a fire

View File

@@ -169,7 +169,7 @@
qdel(H)
var/list/G_gases = G.gases
if(G_gases["plasma"])
G.assert_gas("n2")
ASSERT_GAS("n2", G)
G_gases["n2"][MOLES] += (G_gases["plasma"][MOLES])
G_gases["plasma"][MOLES] = 0
G.garbage_collect()

View File

@@ -1,3 +1,4 @@
<<<<<<< HEAD
/obj/item/tank/jetpack
name = "jetpack (empty)"
desc = "A tank of compressed gas for use as propulsion in zero-gravity areas. Use with caution."
@@ -209,3 +210,216 @@
var/obj/item/clothing/suit/space/hardsuit/C = wear_suit
J = C.jetpack
return J
=======
/obj/item/tank/jetpack
name = "jetpack (empty)"
desc = "A tank of compressed gas for use as propulsion in zero-gravity areas. Use with caution."
icon_state = "jetpack"
item_state = "jetpack"
lefthand_file = 'icons/mob/inhands/equipment/jetpacks_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/jetpacks_righthand.dmi'
w_class = WEIGHT_CLASS_BULKY
distribute_pressure = ONE_ATMOSPHERE * O2STANDARD
actions_types = list(/datum/action/item_action/set_internals, /datum/action/item_action/toggle_jetpack, /datum/action/item_action/jetpack_stabilization)
var/gas_type = "o2"
var/on = FALSE
var/stabilizers = FALSE
var/full_speed = TRUE // If the jetpack will have a speedboost in space/nograv or not
var/datum/effect_system/trail_follow/ion/ion_trail
/obj/item/tank/jetpack/New()
..()
if(gas_type)
ASSERT_GAS(gas_type,air_contents)
air_contents.gases[gas_type][MOLES] = (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C)
ion_trail = new
ion_trail.set_up(src)
/obj/item/tank/jetpack/ui_action_click(mob/user, action)
if(istype(action, /datum/action/item_action/toggle_jetpack))
cycle(user)
else if(istype(action, /datum/action/item_action/jetpack_stabilization))
if(on)
stabilizers = !stabilizers
to_chat(user, "<span class='notice'>You turn the jetpack stabilization [stabilizers ? "on" : "off"].</span>")
else
toggle_internals(user)
/obj/item/tank/jetpack/proc/cycle(mob/user)
if(user.incapacitated())
return
if(!on)
turn_on()
to_chat(user, "<span class='notice'>You turn the jetpack on.</span>")
else
turn_off()
to_chat(user, "<span class='notice'>You turn the jetpack off.</span>")
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/tank/jetpack/proc/turn_on()
on = TRUE
icon_state = "[initial(icon_state)]-on"
ion_trail.start()
/obj/item/tank/jetpack/proc/turn_off()
on = FALSE
stabilizers = FALSE
icon_state = initial(icon_state)
ion_trail.stop()
/obj/item/tank/jetpack/proc/allow_thrust(num, mob/living/user)
if(!on)
return
if((num < 0.005 || air_contents.total_moles() < num))
turn_off()
return
var/datum/gas_mixture/removed = air_contents.remove(num)
if(removed.total_moles() < 0.005)
turn_off()
return
var/turf/T = get_turf(user)
T.assume_air(removed)
return 1
/obj/item/tank/jetpack/suicide_act(mob/user)
if (istype(user, /mob/living/carbon/human/))
var/mob/living/carbon/human/H = user
H.forcesay("WHAT THE FUCK IS CARBON DIOXIDE?")
H.visible_message("<span class='suicide'>[user] is suffocating [user.p_them()]self with [src]! It looks like [user.p_they()] didn't read what that jetpack says!</span>")
return (OXYLOSS)
else
..()
/obj/item/tank/jetpack/void
name = "void jetpack (oxygen)"
desc = "It works well in a void."
icon_state = "jetpack-void"
item_state = "jetpack-void"
/obj/item/tank/jetpack/oxygen
name = "jetpack (oxygen)"
desc = "A tank of compressed oxygen for use as propulsion in zero-gravity areas. Use with caution."
icon_state = "jetpack"
item_state = "jetpack"
/obj/item/tank/jetpack/oxygen/harness
name = "jet harness (oxygen)"
desc = "A lightweight tactical harness, used by those who don't want to be weighed down by traditional jetpacks."
icon_state = "jetpack-mini"
item_state = "jetpack-mini"
volume = 40
throw_range = 7
w_class = WEIGHT_CLASS_NORMAL
/obj/item/tank/jetpack/oxygen/captain
name = "\improper Captain's jetpack"
desc = "A compact, lightweight jetpack containing a high amount of compressed oxygen."
icon_state = "jetpack-captain"
item_state = "jetpack-captain"
w_class = WEIGHT_CLASS_NORMAL
volume = 90
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF //steal objective items are hard to destroy.
/obj/item/tank/jetpack/oxygen/security
name = "security jetpack (oxygen)"
desc = "A tank of compressed oxygen for use as propulsion in zero-gravity areas by security forces."
icon_state = "jetpack-sec"
item_state = "jetpack-sec"
/obj/item/tank/jetpack/carbondioxide
name = "jetpack (carbon dioxide)"
desc = "A tank of compressed carbon dioxide for use as propulsion in zero-gravity areas. Painted black to indicate that it should not be used as a source for internals."
icon_state = "jetpack-black"
item_state = "jetpack-black"
distribute_pressure = 0
gas_type = "co2"
/obj/item/tank/jetpack/suit
name = "hardsuit jetpack upgrade"
desc = "A modular, compact set of thrusters designed to integrate with a hardsuit. It is fueled by a tank inserted into the suit's storage compartment."
origin_tech = "materials=4;magnets=4;engineering=5"
icon_state = "jetpack-mining"
item_state = "jetpack-black"
w_class = WEIGHT_CLASS_NORMAL
actions_types = list(/datum/action/item_action/toggle_jetpack, /datum/action/item_action/jetpack_stabilization)
volume = 1
slot_flags = null
gas_type = null
full_speed = FALSE
var/datum/gas_mixture/temp_air_contents
var/obj/item/tank/internals/tank = null
/obj/item/tank/jetpack/suit/New()
..()
STOP_PROCESSING(SSobj, src)
temp_air_contents = air_contents
/obj/item/tank/jetpack/suit/attack_self()
return
/obj/item/tank/jetpack/suit/cycle(mob/user)
if(!istype(loc, /obj/item/clothing/suit/space/hardsuit))
to_chat(user, "<span class='warning'>\The [src] must be connected to a hardsuit!</span>")
return
var/mob/living/carbon/human/H = user
if(!istype(H.s_store, /obj/item/tank/internals))
to_chat(user, "<span class='warning'>You need a tank in your suit storage!</span>")
return
..()
/obj/item/tank/jetpack/suit/turn_on()
if(!istype(loc, /obj/item/clothing/suit/space/hardsuit) || !ishuman(loc.loc))
return
var/mob/living/carbon/human/H = loc.loc
tank = H.s_store
air_contents = tank.air_contents
START_PROCESSING(SSobj, src)
..()
/obj/item/tank/jetpack/suit/turn_off()
tank = null
air_contents = temp_air_contents
STOP_PROCESSING(SSobj, src)
..()
/obj/item/tank/jetpack/suit/process()
if(!istype(loc, /obj/item/clothing/suit/space/hardsuit) || !ishuman(loc.loc))
turn_off()
return
var/mob/living/carbon/human/H = loc.loc
if(!tank || tank != H.s_store)
turn_off()
return
..()
//Return a jetpack that the mob can use
//Back worn jetpacks, hardsuit internal packs, and so on.
//Used in Process_Spacemove() and wherever you want to check for/get a jetpack
/mob/proc/get_jetpack()
return
/mob/living/carbon/get_jetpack()
var/obj/item/tank/jetpack/J = back
if(istype(J))
return J
/mob/living/carbon/human/get_jetpack()
var/obj/item/tank/jetpack/J = ..()
if(!istype(J) && istype(wear_suit, /obj/item/clothing/suit/space/hardsuit))
var/obj/item/clothing/suit/space/hardsuit/C = wear_suit
J = C.jetpack
return J
>>>>>>> 6b9832d... Merge pull request #31388 from vuonojenmustaturska/atmoscherrypicking

View File

@@ -21,7 +21,7 @@
/obj/item/tank/internals/oxygen/New()
..()
air_contents.assert_gas("o2")
ASSERT_GAS("o2", air_contents)
air_contents.gases["o2"][MOLES] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return
@@ -87,7 +87,7 @@
/obj/item/tank/internals/plasma/New()
..()
air_contents.assert_gas("plasma")
ASSERT_GAS("plasma", air_contents)
air_contents.gases["plasma"][MOLES] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return
@@ -105,8 +105,7 @@
return ..()
/obj/item/tank/internals/plasma/full/New()
..()
air_contents.assert_gas("plasma")
..() // Plasma asserted in parent
air_contents.gases["plasma"][MOLES] = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return
@@ -125,13 +124,12 @@
/obj/item/tank/internals/plasmaman/New()
..()
air_contents.assert_gas("plasma")
ASSERT_GAS("plasma", air_contents)
air_contents.gases["plasma"][MOLES] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return
/obj/item/tank/internals/plasmaman/full/New()
..()
air_contents.assert_gas("plasma")
..() // Plasma asserted in parent
air_contents.gases["plasma"][MOLES] = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return
@@ -145,8 +143,7 @@
w_class = WEIGHT_CLASS_SMALL //thanks i forgot this
/obj/item/tank/internals/plasmaman/belt/full/New()
..()
air_contents.assert_gas("plasma")
..() // Plasma asserted in parent
air_contents.gases["plasma"][MOLES] = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return
@@ -169,7 +166,7 @@
/obj/item/tank/internals/emergency_oxygen/New()
..()
air_contents.assert_gas("o2")
ASSERT_GAS("o2", air_contents)
air_contents.gases["o2"][MOLES] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return

View File

@@ -289,7 +289,7 @@
continue
var/list/S_gases = S.air.gases
for(var/id in S_gases)
total.assert_gas(id)
ASSERT_GAS(id, total)
total_gases[id][MOLES] += S_gases[id][MOLES]
total.temperature += S.air.temperature

View File

@@ -715,7 +715,7 @@ GLOBAL_PROTECT(LastAdminCalledProc)
if(Rad.anchored)
if(!Rad.loaded_tank)
var/obj/item/tank/internals/plasma/Plasma = new/obj/item/tank/internals/plasma(Rad)
Plasma.air_contents.assert_gas("plasma")
ASSERT_GAS("plasma", Plasma.air_contents)
Plasma.air_contents.gases["plasma"][MOLES] = 70
Rad.drainratio = 0
Rad.loaded_tank = Plasma

View File

@@ -21,10 +21,6 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
cached_gas[ARCHIVE] = 0
cached_gas[GAS_META] = GLOB.meta_gas_info[id]
#define GASLIST(id, out_list)\
var/list/tmp_gaslist = GLOB.gaslist_cache[id];\
out_list = tmp_gaslist.Copy();
/datum/gas_mixture
var/list/gases
var/temperature //kelvins
@@ -43,30 +39,18 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
//listmos procs
//assert_gas(gas_id) - used to guarantee that the gas list for this id exists.
//Must be used before adding to a gas. May be used before reading from a gas.
/datum/gas_mixture/proc/assert_gas(gas_id)
var/cached_gases = gases
if(cached_gases[gas_id])
return
GASLIST(gas_id, cached_gases[gas_id])
// The following procs used to live here: thermal_energy(), assert_gas() and add_gas(). They have been moved into defines in code/__DEFINES/atmospherics.dm
//assert_gases(args) - shorthand for calling assert_gas() once for each gas type.
//assert_gases(args) - shorthand for calling ASSERT_GAS() once for each gas type.
/datum/gas_mixture/proc/assert_gases()
for(var/id in args)
assert_gas(id)
//add_gas(gas_id) - similar to assert_gas(), but does not check for an existing
//gas list for this id. This can clobber existing gases.
//Used instead of assert_gas() when you know the gas does not exist. Faster than assert_gas().
/datum/gas_mixture/proc/add_gas(gas_id)
GASLIST(gas_id, gases[gas_id])
ASSERT_GAS(id, src)
//add_gases(args) - shorthand for calling add_gas() once for each gas_type.
/datum/gas_mixture/proc/add_gases()
var/cached_gases = gases
for(var/id in args)
GASLIST(id, cached_gases[id])
ADD_GAS(id, cached_gases)
//garbage_collect() - removes any gas list which is empty.
//If called with a list as an argument, only removes gas lists with IDs from that list.
@@ -80,6 +64,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
cached_gases -= id
//PV = nRT
/datum/gas_mixture/proc/heat_capacity() //joules per kelvin
var/list/cached_gases = gases
. = 0
@@ -195,7 +180,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
var/list/giver_gases = giver.gases
//gas transfer
for(var/giver_id in giver_gases)
assert_gas(giver_id)
ASSERT_GAS(giver_id, src)
cached_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES]
return 1
@@ -212,7 +197,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
removed.temperature = temperature
for(var/id in cached_gases)
removed.add_gas(id)
ADD_GAS(id, removed.gases)
removed_gases[id][MOLES] = QUANTIZE((cached_gases[id][MOLES] / sum) * amount)
cached_gases[id][MOLES] -= removed_gases[id][MOLES]
garbage_collect()
@@ -230,7 +215,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
removed.temperature = temperature
for(var/id in cached_gases)
removed.add_gas(id)
ADD_GAS(id, removed.gases)
removed_gases[id][MOLES] = QUANTIZE(cached_gases[id][MOLES] * ratio)
cached_gases[id][MOLES] -= removed_gases[id][MOLES]
@@ -245,18 +230,19 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
copy.temperature = temperature
for(var/id in cached_gases)
copy.add_gas(id)
ADD_GAS(id, copy.gases)
copy_gases[id][MOLES] = cached_gases[id][MOLES]
return copy
/datum/gas_mixture/copy_from(datum/gas_mixture/sample)
var/list/cached_gases = gases //accessing datum vars is slower than proc vars
var/list/sample_gases = sample.gases
temperature = sample.temperature
for(var/id in sample_gases)
assert_gas(id)
ASSERT_GAS(id,src)
cached_gases[id][MOLES] = sample_gases[id][MOLES]
//remove all gases not in the sample
@@ -282,7 +268,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
gas -= "TEMP"
gases.Cut()
for(var/id in gas)
add_gas(id)
ADD_GAS(id, gases)
gases[id][MOLES] = text2num(gas[id])
return 1
@@ -310,10 +296,9 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
//GAS TRANSFER
for(var/id in sharer_gases - cached_gases) // create gases not in our cache
add_gas(id)
ADD_GAS(id, gases)
for(var/id in cached_gases) // transfer gases
if(!sharer_gases[id]) //checking here prevents an uneeded proc call if the check fails.
sharer.add_gas(id)
ASSERT_GAS(id, sharer)
var/gas = cached_gases[id]
var/sharergas = sharer_gases[id]

View File

@@ -69,7 +69,7 @@
/datum/gas_mixture/immutable/cloner/garbage_collect()
..()
add_gas("n2")
ADD_GAS("n2", gases)
gases["n2"][MOLES] = MOLES_O2STANDARD + MOLES_N2STANDARD
/datum/gas_mixture/immutable/cloner/heat_capacity()

View File

@@ -57,7 +57,7 @@
cached_gases["co2"][MOLES] -= reaction_rate
cached_gases["agent_b"][MOLES] -= reaction_rate*0.05
air.assert_gas("o2") //only need to assert oxygen, as this reaction doesn't occur without the other gases existing
ASSERT_GAS("o2", air) //only need to assert oxygen, as this reaction doesn't occur without the other gases existing
cached_gases["o2"][MOLES] += reaction_rate
air.temperature -= (reaction_rate*20000)/air.heat_capacity()
@@ -126,7 +126,7 @@
if(burned_fuel)
energy_released += FIRE_CARBON_ENERGY_RELEASED * burned_fuel
air.assert_gas("co2")
ASSERT_GAS("co2", air)
cached_gases["co2"][MOLES] += burned_fuel
cached_results[id] += burned_fuel
@@ -142,14 +142,14 @@
else
temperature_scale = (temperature-PLASMA_MINIMUM_BURN_TEMPERATURE)/(PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE)
if(temperature_scale > 0)
air.assert_gas("o2")
ASSERT_GAS("o2", air)
oxygen_burn_rate = OXYGEN_BURN_RATE_BASE - temperature_scale
if(cached_gases["o2"][MOLES] > cached_gases["plasma"][MOLES]*PLASMA_OXYGEN_FULLBURN)
plasma_burn_rate = (cached_gases["plasma"][MOLES]*temperature_scale)/PLASMA_BURN_RATE_DELTA
else
plasma_burn_rate = (temperature_scale*(cached_gases["o2"][MOLES]/PLASMA_OXYGEN_FULLBURN))/PLASMA_BURN_RATE_DELTA
if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY)
air.assert_gas("co2")
ASSERT_GAS("co2", air)
cached_gases["plasma"][MOLES] = QUANTIZE(cached_gases["plasma"][MOLES] - plasma_burn_rate)
cached_gases["o2"][MOLES] = QUANTIZE(cached_gases["o2"][MOLES] - (plasma_burn_rate * oxygen_burn_rate))
cached_gases["co2"][MOLES] += plasma_burn_rate

View File

@@ -96,7 +96,7 @@
var/datum/gas_mixture/filtered_out = new
filtered_out.temperature = removed.temperature
filtered_out.assert_gas(filter_type)
ASSERT_GAS(filter_type, filtered_out)
filtered_out.gases[filter_type][MOLES] = removed.gases[filter_type][MOLES]
removed.gases[filter_type][MOLES] = 0
@@ -166,4 +166,3 @@
if(. && on && is_operational())
to_chat(user, "<span class='warning'>You cannot unwrench [src], turn it off first!</span>")
return FALSE

View File

@@ -47,7 +47,7 @@
var/added_oxygen = oxygen_content - total_moles
air_contents.temperature = (current_heat_capacity*air_contents.temperature + 20*added_oxygen*T0C)/(current_heat_capacity+20*added_oxygen)
air_contents.assert_gas("o2")
ASSERT_GAS("o2", air_contents)
air_contents.gases["o2"][MOLES] += added_oxygen
update_parents()

View File

@@ -16,7 +16,7 @@
air_contents.volume = volume
air_contents.temperature = T20C
if(gas_type)
air_contents.assert_gas(gas_type)
ASSERT_GAS(gas_type, air_contents)
air_contents.gases[gas_type][MOLES] = AIR_CONTENTS
name = "[name] ([air_contents.gases[gas_type][GAS_META][META_GAS_NAME]])"

View File

@@ -196,37 +196,37 @@
filtered_out.temperature = removed.temperature
if(scrub_Toxins && removed_gases["plasma"])
filtered_out.add_gas("plasma")
ADD_GAS("plasma", filtered_out.gases)
filtered_gases["plasma"][MOLES] = removed_gases["plasma"][MOLES]
removed.gases["plasma"][MOLES] = 0
if(scrub_CO2 && removed_gases["co2"])
filtered_out.add_gas("co2")
ADD_GAS("co2", filtered_out.gases)
filtered_gases["co2"][MOLES] = removed_gases["co2"][MOLES]
removed_gases["co2"][MOLES] = 0
if(removed_gases["agent_b"])
filtered_out.add_gas("agent_b")
ADD_GAS("agent_b", filtered_out.gases)
filtered_gases["agent_b"][MOLES] = removed_gases["agent_b"][MOLES]
removed_gases["agent_b"][MOLES] = 0
if(scrub_N2O && removed_gases["n2o"])
filtered_out.add_gas("n2o")
ADD_GAS("n2o", filtered_out.gases)
filtered_gases["n2o"][MOLES] = removed_gases["n2o"][MOLES]
removed_gases["n2o"][MOLES] = 0
if(scrub_BZ && removed_gases["bz"])
filtered_out.add_gas("bz")
ADD_GAS("bz", filtered_out.gases)
filtered_gases["bz"][MOLES] = removed_gases["bz"][MOLES]
removed_gases["bz"][MOLES] = 0
if(scrub_Freon && removed_gases["freon"])
filtered_out.add_gas("freon")
ADD_GAS("freon", filtered_out.gases)
filtered_gases["freon"][MOLES] = removed_gases["freon"][MOLES]
removed_gases["freon"][MOLES] = 0
if(scrub_WaterVapor && removed_gases["water_vapor"])
filtered_out.add_gas("water_vapor")
ADD_GAS("water_vapor", filtered_out.gases)
filtered_gases["water_vapor"][MOLES] = removed_gases["water_vapor"][MOLES]
removed_gases["water_vapor"][MOLES] = 0

View File

@@ -132,7 +132,7 @@
if(!isopenturf(O))
return FALSE
var/datum/gas_mixture/merger = new
merger.assert_gas(spawn_id)
ASSERT_GAS(spawn_id, merger)
merger.gases[spawn_id][MOLES] = (spawn_mol)
merger.temperature = spawn_temp
O.assume_air(merger)

View File

@@ -174,7 +174,7 @@
/obj/machinery/portable_atmospherics/canister/proc/create_gas()
if(gas_type)
air_contents.add_gas(gas_type)
ADD_GAS(gas_type, air_contents.gases)
if(starter_temp)
air_contents.temperature = starter_temp
air_contents.gases[gas_type][MOLES] = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)

View File

@@ -45,7 +45,7 @@
filtered.temperature = filtering.temperature
for(var/gas in filtering.gases & scrubbing)
filtered.add_gas(gas)
ADD_GAS(gas, filtered.gases)
filtered.gases[gas][MOLES] = filtering.gases[gas][MOLES] // Shuffle the "bad" gasses to the filtered mixture.
filtering.gases[gas][MOLES] = 0
filtering.garbage_collect() // Now that the gasses are set to 0, clean up the mixture.