/tg/ Station 13 - Modules - TypesVar Details - Proc Details

gas_mixture

Vars

gc_shareWhether to call garbage_collect() on the sharer during shares, used for immutable mixtures
last_shareThe last tick this gas mixture shared on. A counter that turfs use to manage activity
pipeline_cycleWhen this gas mixture was last touched by pipeline processing I am sorry
reaction_resultsTells us what reactions have happened in our gasmix. Assoc list of reaction - moles reacted pair.
temperatureThe temperature of the gas mix in kelvin. Should never be lower then TCMB
temperature_archivedUsed, like all archived variables, to ensure turf sharing is consistent inside a tick, no matter The order of operations
volumeVolume in liters (duh)

Procs

add_gasadd_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().
add_gasesadd_gases(args) - shorthand for calling add_gas() once for each gas_type.
archiveUpdate archived versions of variables. Returns: 1 in all cases
assert_gasassert_gas(gas_id) - 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.
assert_gasesassert_gases(args) - shorthand for calling ASSERT_GAS() once for each gas type.
compareCompares sample to self to see if within acceptable ranges that group processing may be enabled Returns: a string indicating what check failed, or "" if check passes
copyCreates new, identical gas mixture Returns: duplicate gas mixture
copy_fromCopies variables from sample Returns: TRUE if we are mutable, FALSE otherwise
copy_from_ratioCopies variables from sample, moles multiplicated by partial Returns: TRUE if we are mutable, FALSE otherwise
equalizeDistributes the contents of two mixes equally between themselves
garbage_collectgarbage_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. Must be used after subtracting from a gas. Must be used after assert_gas() if assert_gas() was called only to read from the gas. By removing empty gases, processing speed is increased.
gas_pressure_approximateApproximation of the quadratic equation using Newton-Raphson's Method. We use the slope of an approximate value to get closer to the root of a given equation.
gas_pressure_calculate
gas_pressure_minimum_transferCounts how much pressure will there be if we impart MOLAR_ACCURACY amounts of our gas to the output gasmix. We do all of this without actually transferring it so dont worry about it changing the gasmix. Returns: Resulting pressure (number). Args:
gas_pressure_quadraticThe PV/R part in the equation we will use later. Counted early because pv/(r*t) might not be equal to pv/r/t, messing our lower and upper limit. This is the true lower limit, but numbers still can get lower than this due to floats. x^2 in the quadratic x^1 in the quadratic x^0 in the quadratic Actually tries to solve the quadratic equation. Do mind that the numbers can get very big and might hit BYOND's single point float limit.
get_breath_partial_pressureReturns the partial pressure of the gas in the breath based on BREATH_VOLUME eg: Plas_PP = get_breath_partial_pressure(gas_mixture.gases/datum/gas/plasma) O2_PP = get_breath_partial_pressure(gas_mixture.gases/datum/gas/oxygen) get_breath_partial_pressure(gas_mole_count) --> PV = nRT, P = nRT/V
has_gasChecks to see if gas amount exists in mixture. Do NOT use this in code where performance matters! It's better to batch calls to garbage_collect(), especially in places where you're checking many gastypes
heat_capacityjoules per kelvin
mergeMerges all air from giver into self. Deletes giver. Returns: 1 if we are mutable, 0 otherwise
pump_gas_toPumps gas from src to output_air. Amount depends on target_pressure
reactPerforms various reactions such as combustion and fabrication Returns: 1 if any reaction took place; 0 otherwise
release_gas_toReleases gas from src to output air. This means that it can not transfer air to gas mixture with higher pressure.
removeProportionally removes amount of gas from the gas_mixture. Returns: gas_mixture with the gases removed
remove_ratioProportionally removes amount of gas from the gas_mixture. Returns: gas_mixture with the gases removed
remove_specificRemoves an amount of a specific gas from the gas_mixture. Returns: gas_mixture with the gas removed
return_pressureCalculate pressure in kilopascals
return_temperatureCalculate temperature in kelvins
return_visualsGets the gas visuals for everything in this mixture
return_volumeCalculate volume in liters
sharePerforms air sharing calculations between two gas_mixtures share() is communitive, which means A.share(B) needs to be the same as B.share(A) If we don't retain this, we will get negative moles. Don't do it Returns: amount of gas exchanged (+ if sharer received)
temperature_sharePerforms temperature sharing calculations (via conduction) between two gas_mixtures assuming only 1 boundary length Returns: new temperature of the sharer
thermal_energyCalculate thermal energy in joules
total_molesCalculate moles

Var Details

gc_share

Whether to call garbage_collect() on the sharer during shares, used for immutable mixtures

last_share

The last tick this gas mixture shared on. A counter that turfs use to manage activity

pipeline_cycle

When this gas mixture was last touched by pipeline processing I am sorry

reaction_results

Tells us what reactions have happened in our gasmix. Assoc list of reaction - moles reacted pair.

temperature

The temperature of the gas mix in kelvin. Should never be lower then TCMB

temperature_archived

Used, like all archived variables, to ensure turf sharing is consistent inside a tick, no matter The order of operations

volume

Volume in liters (duh)

Proc Details

add_gas

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().

add_gases

add_gases(args) - shorthand for calling add_gas() once for each gas_type.

archive

Update archived versions of variables. Returns: 1 in all cases

assert_gas

assert_gas(gas_id) - 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.

assert_gases

assert_gases(args) - shorthand for calling ASSERT_GAS() once for each gas type.

compare

Compares sample to self to see if within acceptable ranges that group processing may be enabled Returns: a string indicating what check failed, or "" if check passes

copy

Creates new, identical gas mixture Returns: duplicate gas mixture

copy_from

Copies variables from sample Returns: TRUE if we are mutable, FALSE otherwise

copy_from_ratio

Copies variables from sample, moles multiplicated by partial Returns: TRUE if we are mutable, FALSE otherwise

equalize

Distributes the contents of two mixes equally between themselves

garbage_collect

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. Must be used after subtracting from a gas. Must be used after assert_gas() if assert_gas() was called only to read from the gas. By removing empty gases, processing speed is increased.

gas_pressure_approximate

Approximation of the quadratic equation using Newton-Raphson's Method. We use the slope of an approximate value to get closer to the root of a given equation.

gas_pressure_calculate

gas_pressure_minimum_transfer

Counts how much pressure will there be if we impart MOLAR_ACCURACY amounts of our gas to the output gasmix. We do all of this without actually transferring it so dont worry about it changing the gasmix. Returns: Resulting pressure (number). Args:

gas_pressure_quadratic

The PV/R part in the equation we will use later. Counted early because pv/(r*t) might not be equal to pv/r/t, messing our lower and upper limit. This is the true lower limit, but numbers still can get lower than this due to floats. x^2 in the quadratic x^1 in the quadratic x^0 in the quadratic Actually tries to solve the quadratic equation. Do mind that the numbers can get very big and might hit BYOND's single point float limit.

get_breath_partial_pressure

Returns the partial pressure of the gas in the breath based on BREATH_VOLUME eg: Plas_PP = get_breath_partial_pressure(gas_mixture.gases/datum/gas/plasma) O2_PP = get_breath_partial_pressure(gas_mixture.gases/datum/gas/oxygen) get_breath_partial_pressure(gas_mole_count) --> PV = nRT, P = nRT/V

10/205 = 2.5 10 = 2.5/520

has_gas

Checks to see if gas amount exists in mixture. Do NOT use this in code where performance matters! It's better to batch calls to garbage_collect(), especially in places where you're checking many gastypes

heat_capacity

joules per kelvin

merge

Merges all air from giver into self. Deletes giver. Returns: 1 if we are mutable, 0 otherwise

pump_gas_to

Pumps gas from src to output_air. Amount depends on target_pressure

react

Performs various reactions such as combustion and fabrication Returns: 1 if any reaction took place; 0 otherwise

release_gas_to

Releases gas from src to output air. This means that it can not transfer air to gas mixture with higher pressure.

remove

Proportionally removes amount of gas from the gas_mixture. Returns: gas_mixture with the gases removed

remove_ratio

Proportionally removes amount of gas from the gas_mixture. Returns: gas_mixture with the gases removed

remove_specific

Removes an amount of a specific gas from the gas_mixture. Returns: gas_mixture with the gas removed

return_pressure

Calculate pressure in kilopascals

return_temperature

Calculate temperature in kelvins

return_visuals

Gets the gas visuals for everything in this mixture

return_volume

Calculate volume in liters

share

Performs air sharing calculations between two gas_mixtures share() is communitive, which means A.share(B) needs to be the same as B.share(A) If we don't retain this, we will get negative moles. Don't do it Returns: amount of gas exchanged (+ if sharer received)

temperature_share

Performs temperature sharing calculations (via conduction) between two gas_mixtures assuming only 1 boundary length Returns: new temperature of the sharer

thermal_energy

Calculate thermal energy in joules

total_moles

Calculate moles