Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Gas/data: Difference between revisions

From Stationeers Community Wiki
RA2lover (talk | contribs)
Initial revision, contains data about all gases/liquids in beta as of 0.2.6191.26980
 
RA2lover (talk | contribs)
m correct image for liquid nitrogen
 
(7 intermediate revisions by the same user not shown)
Line 24: Line 24:
--Name(string, Required): Lua-indexable name for the gas. Should use the english localization with spaces removed. gases["Liquid Hydrochloric Acid"] is a handful to use compared to gases.LiquidHydrochloricAcid.
--Name(string, Required): Lua-indexable name for the gas. Should use the english localization with spaces removed. gases["Liquid Hydrochloric Acid"] is a handful to use compared to gases.LiquidHydrochloricAcid.
--ID(number, Required): Internal Game-specific ID for the gas.
--ID(number, Required): Internal Game-specific ID for the gas.
--HumanReadableName: (string, default: Autofilled from name by prepending 2nd+ uppercase letters with spaces, NYI): Printable name.
--HumanReadableName: (string, default: Autofilled from name by prepending uppercase letters with spaces when they're followed by a lowercase letter): Printable name.
--HumanReadableSymbol: (string, NYI): Community-defined chemical name for the gas. Aim for simple: X instead of POL, Alc instead of EtOH|MeOH|CH3CH2OH|CH4O.
--HumanReadableSymbol: (string): Community-defined chemical name for the gas. Aim for simple: X instead of POL, Alc instead of EtOH|MeOH|CH3CH2OH|CH4O.
  --Image: (string, NYI): wiki-local URI to an icon of the gas.
  --Image: (string, NYI): wiki-local URI to an icon of the gas.
--MolarMass (number, g/mol, Required): Molar mass of the gas for rocketry.
--MolarMass (number, g/mol, Required): Molar mass of the gas for rocketry.
Line 36: Line 36:
--CondensesInto: (Default: nil): Name of gas it condenses in. nil for things that don't condense.
--CondensesInto: (Default: nil): Name of gas it condenses in. nil for things that don't condense.
--EvaporatesInto: (Default: nil): Name of gas it evaporates in. nil for things that don't evaporate.
--EvaporatesInto: (Default: nil): Name of gas it evaporates in. nil for things that don't evaporate.
    --EvaporationRatio: (Default: 1): Multiplier for evaporate energy on evaporation. Latent heat is still added separately.
--TriplePressure: (number, kPa, Default: nil): Minimum condensation pressure.
--TriplePressure: (number, kPa, Default: nil): Minimum condensation pressure.
--CriticalPressure: (number, kPa, Default: nil): Maximum liquid pressure.
--CriticalPressure: (number, kPa, Default: nil): Maximum liquid pressure.
Line 52: Line 53:
--]]--
--]]--


  local function GetHumanReadableName(gas)
    --attempts to create a human-readable name by adding a space before an uppercase letter if it's preceeded by a lowercase letter.
    return string.gsub(gas.Name, "(%l)(%u)", "%1 %2")
  end


   local function AddGas(gas)
   local function AddGas(gas)
Line 67: Line 72:
    
    
     gas.HeatCapacityRatio = gas.HeatCapacityRatio or 0.03
     gas.HeatCapacityRatio = gas.HeatCapacityRatio or 0.03
 
    gas.HumanReadableName = gas.HumanReadableName or GetHumanReadableName(gas)
    gas.EvaporationRatio = gas.EvaporationRatio or 1
   
    if gas.Image and not string.match(gas.Image, "^[Ff]ile:") then gas.Image = "File:"..gas.Image end
 
     for k,v in pairs(gas) do
     for k,v in pairs(gas) do
       if k ~= "Name" then  
       if k ~= "Name" then  
Line 95: Line 104:
local Oxygen = {
local Oxygen = {
Name = "Oxygen",
Name = "Oxygen",
HumanReadableSymbol = "O2",
Image="Icon-oxygen.png",
ID = 1,
ID = 1,
MolarMass = 16,
MolarMass = 16,
Line 121: Line 132:
}
}
local LiquidOxygen = makeliquidfromgas(Oxygen)
local LiquidOxygen = makeliquidfromgas(Oxygen)
LiquidOxygen.Image = "Icon-liquidoxygen.png"
LiquidOxygen.ID = 256
LiquidOxygen.ID = 256
LiquidOxygen.MolarVolume = 0.03
LiquidOxygen.MolarVolume = 0.03
Line 128: Line 140:
local Nitrogen = {
local Nitrogen = {
Name = "Nitrogen",
Name = "Nitrogen",
HumanReadableSymbol = "N2", --ingame still uses "N"
Image="Icon-nitrogen.png",
ID = 2,
ID = 2,
MolarMass = 64, --recheck after rocketry overhaul.
MolarMass = 64, --recheck after rocketry overhaul.
Line 155: Line 169:


local LiquidNitrogen = makeliquidfromgas(Nitrogen)
local LiquidNitrogen = makeliquidfromgas(Nitrogen)
LiquidNitrogen.Image = "Icon-LiquidNitrogen.png"
LiquidNitrogen.ID = 128
LiquidNitrogen.ID = 128
LiquidNitrogen.MolarVolume = 0.0348
LiquidNitrogen.MolarVolume = 0.0348
Line 162: Line 177:
local CarbonDioxide = {
local CarbonDioxide = {
Name = "CarbonDioxide",
Name = "CarbonDioxide",
HumanReadableSymbol = "CO2",
Image="Icon-carbondioxide.png",
ID = 4,
ID = 4,
MolarMass = 44,
MolarMass = 44,
Line 188: Line 205:
}
}
local LiquidCarbonDioxide = makeliquidfromgas(CarbonDioxide)
local LiquidCarbonDioxide = makeliquidfromgas(CarbonDioxide)
LiquidCarbonDioxide.Image = "Icon-liquidcarbondioxide.png"
LiquidCarbonDioxide.ID = 2048
LiquidCarbonDioxide.ID = 2048
LiquidCarbonDioxide.MolarVolume = 0.04
LiquidCarbonDioxide.MolarVolume = 0.04
Line 195: Line 213:
local Methane = {
local Methane = {
Name = "Methane",
Name = "Methane",
HumanReadableSymbol = "CH4",
Image="Icon-Methane.png",
ID = 8,
ID = 8,
MolarMass = 16,  
MolarMass = 16,  
Line 221: Line 241:
}
}
local LiquidMethane = makeliquidfromgas(Methane)
local LiquidMethane = makeliquidfromgas(Methane)
LiquidMethane.Image = "Icon-LiquidMethane.png"
LiquidMethane.MolarVolume = 0.04
LiquidMethane.MolarVolume = 0.04
LiquidMethane.ID = 512
LiquidMethane.ID = 512
Line 228: Line 249:
local Pollutant = {
local Pollutant = {
Name = "Pollutant",
Name = "Pollutant",
HumanReadableSymbol = "X",
Image="Icon-pollutant.png",
ID = 16,
ID = 16,
MolarMass = 28,  
MolarMass = 28,  
Line 254: Line 277:
}
}
local LiquidPollutant = makeliquidfromgas(Pollutant)
local LiquidPollutant = makeliquidfromgas(Pollutant)
LiquidPollutant.Image = "Icon-liquidpollutant.png"
LiquidPollutant.MolarVolume = 0.04
LiquidPollutant.MolarVolume = 0.04
LiquidPollutant.ID = 4096
LiquidPollutant.ID = 4096
Line 262: Line 286:
local Steam = {
local Steam = {
Name = "Steam",
Name = "Steam",
HumanReadableSymbol = "H2O",
Image="Icon-water.png",
ID = 1024,
ID = 1024,
MolarMass = 48, --higher than IRL water. recheck after rocketry overhaul.
MolarMass = 108, --higher than IRL water. recheck after rocketry overhaul.
HeatCapacityRatio = p.TriatomicHeatCapacityRatio,
HeatCapacityRatio = p.TriatomicHeatCapacityRatio,
State = "Gas",
State = "Gas",
Line 288: Line 314:
}
}
local Water = makeliquidfromgas(Steam)
local Water = makeliquidfromgas(Steam)
Water.Image = "Icon-LiquidWater.png"
Water.MolarVolume = 0.018
Water.MolarVolume = 0.018
Water.ID = 32
Water.ID = 32
Line 295: Line 322:
local NitrousOxide = {
local NitrousOxide = {
Name = "NitrousOxide",
Name = "NitrousOxide",
HumanReadableSymbol = "N2O", --Chemistry.GasSymbols uses "NOS" which is a trademark?
Image="Icon-nitrousoxide.png",
ID = 64,
ID = 64,
MolarMass = 46,  
MolarMass = 46,  
Line 321: Line 350:
}
}
local LiquidNitrousOxide = makeliquidfromgas(NitrousOxide)
local LiquidNitrousOxide = makeliquidfromgas(NitrousOxide)
LiquidNitrousOxide.Image = "Icon-LiquidNitrousoxide.png"
LiquidNitrousOxide.MolarVolume = 0.026
LiquidNitrousOxide.MolarVolume = 0.026
LiquidNitrousOxide.ID = 8192
LiquidNitrousOxide.ID = 8192
Line 330: Line 360:
local Hydrogen = {
local Hydrogen = {
Name = "Hydrogen",
Name = "Hydrogen",
HumanReadableSymbol = "H2",
Image="Icon-Hydrogen.png",
ID = 16384,
ID = 16384,
MolarMass = 2,  
MolarMass = 2,  
Line 356: Line 388:
}
}
local LiquidHydrogen = makeliquidfromgas(Hydrogen)
local LiquidHydrogen = makeliquidfromgas(Hydrogen)
LiquidHydrogen.Image = "Icon-LiquidHydrogen.png"
LiquidHydrogen.MolarVolume = 0.028
LiquidHydrogen.MolarVolume = 0.028
LiquidHydrogen.ID = 32768
LiquidHydrogen.ID = 32768
Line 364: Line 397:
local PollutedWater = {
local PollutedWater = {
Name = "PollutedWater",
Name = "PollutedWater",
HumanReadableSymbol = "XH2O", --can't think of a commonly adopted community symbol. ingame icon uses PW but also XH2O in Chemistry._gasSymbols.
Image="Icon-pollutedwater.png",
ID = 65536,
ID = 65536,
MolarMass = 48,
MolarMass = 108,
HeatCapacityRatio = p.TriatomicHeatCapacityRatio,
HeatCapacityRatio = p.TriatomicHeatCapacityRatio,
State = "Liquid", --NOT a gas.
State = "Liquid", --NOT a gas.
Line 394: Line 429:
local Hydrazine = {
local Hydrazine = {
Name = "Hydrazine",
Name = "Hydrazine",
HumanReadableSymbol = "N2H4", --Chemistry.GasSymbols uses "HZ"
Image="Icon-Hydrazine.png",
ID = 131072,
ID = 131072,
MolarMass = 32,  
MolarMass = 32,  
Line 411: Line 448:
CriticalTemperature = nil, --will be calculated later on AddGas
CriticalTemperature = nil, --will be calculated later on AddGas
Enthalpy = 204000,
Enthalpy = 306000,
AutoignitionTemperature = (6000/8e-22)^(1/9.15642808045339), -- = evaporation temperature at critical pressure
AutoignitionTemperature = (6000/8e-22)^(1/9.15642808045339), -- = evaporation temperature at critical pressure
IsHypergol = true, --Only hypergol in the game as of now (along with liquid hydrazine)
IsHypergol = true, --Only hypergol in the game as of now (along with liquid hydrazine)
Line 420: Line 457:
}
}
local LiquidHydrazine = makeliquidfromgas(Hydrazine)
local LiquidHydrazine = makeliquidfromgas(Hydrazine)
LiquidHydrogen.MolarVolume = 0.03
LiquidHydrazine.Image = "Icon-LiquidHydrazine.png"
LiquidHydrogen.ID = 262144
LiquidHydrazine.MolarVolume = 0.03
LiquidHydrazine.ID = 262144
AddGas(Hydrazine)
AddGas(Hydrazine)
AddGas(LiquidHydrazine)
AddGas(LiquidHydrazine)
Line 428: Line 466:
local LiquidAlcohol = {
local LiquidAlcohol = {
Name = "LiquidAlcohol",
Name = "LiquidAlcohol",
HumanReadableSymbol = "Alc", --still listed as "Al" in Chemistry._gasSymbols.
Image="Icon-LiquidAlcohol.png",
ID = 524288,
ID = 524288,
MolarMass = 46, --same as Ethanol
MolarMass = 46, --same as Ethanol
Line 434: Line 474:
MolarVolume = 0.058,
MolarVolume = 0.058,
SpecificHeat = 63,
SpecificHeat = 33,
LatentHeat = 18000,
LatentHeat = 2000,
CondensesInto = nil,
CondensesInto = nil,
EvaporatesInto = "Methane",
EvaporatesInto = "Methane",
EvaporationRatio = 0.6181818181818182,
TriplePressure = 6.3,
TriplePressure = 6.3,
CriticalPressure = 1000,
CriticalPressure = 1000,
Line 445: Line 486:
CriticalTemperature = nil, --will be calculated later on AddGas
CriticalTemperature = nil, --will be calculated later on AddGas
Enthalpy = 418000,
Enthalpy = 566000,
AutoignitionTemperature = 673.15, -- 100°C higher than other fuels
AutoignitionTemperature = 673.15, -- 100°C higher than other fuels
IsHypergol = nil,
IsHypergol = nil,
Line 457: Line 498:
local Helium = {
local Helium = {
Name = "Helium",
Name = "Helium",
HumanReadableSymbol = "He", --listed as "HE" in Chemistry._gasSymbols.
Image="Icon-Helium.png",
ID = 1048576,
ID = 1048576,
MolarMass = 4,  
MolarMass = 4,  
Line 486: Line 529:
local LiquidSodiumChloride = {
local LiquidSodiumChloride = {
Name = "LiquidSodiumChloride",
Name = "LiquidSodiumChloride",
HumanReadableSymbol = "NaCl", --most liquids in Chemistry._gasSymbols are prepended with a "L", but not this one.
Image="Icon-LiquidSodiumChloride.png",
ID = 2097152,
ID = 2097152,
MolarMass = 101,
MolarMass = 101,
Line 493: Line 538:
SpecificHeat = 130,
SpecificHeat = 130,
LatentHeat = 1000,
LatentHeat = 16000,
CondensesInto = nil,
CondensesInto = nil,
EvaporatesInto = "Pollutant",
EvaporatesInto = "Pollutant",
EvaporationRatio = 0.19076923076923077,
TriplePressure = 6.3,
TriplePressure = 6.3,
CriticalPressure = 515,
CriticalPressure = 515,
Line 515: Line 561:
local Silanol = {
local Silanol = {
Name = "Silanol",
Name = "Silanol",
HumanReadableSymbol = "Sil",
Image="Icon-Silanol.png",
ID = 4194304,
ID = 4194304,
MolarMass = 166,  
MolarMass = 166,  
Line 541: Line 589:
}
}
local LiquidSilanol = makeliquidfromgas(Silanol)
local LiquidSilanol = makeliquidfromgas(Silanol)
LiquidPollutant.MolarVolume = 0.16
LiquidSilanol.Image = "Icon-LiquidSilanol.png"
LiquidPollutant.ID = 8388608
LiquidSilanol.MolarVolume = 0.16
LiquidSilanol.ID = 8388608
AddGas(Silanol)
AddGas(Silanol)
AddGas(LiquidSilanol)
AddGas(LiquidSilanol)
Line 548: Line 597:
local HydrochloricAcid = {
local HydrochloricAcid = {
Name = "HydrochloricAcid",
Name = "HydrochloricAcid",
HumanReadableSymbol = "HCl",
Image="Icon-HydrochloricAcid.png",
ID = 16777216,
ID = 16777216,
MolarMass = 36,  
MolarMass = 36,  
Line 574: Line 625:
}
}
local LiquidHydrochloricAcid = makeliquidfromgas(HydrochloricAcid)
local LiquidHydrochloricAcid = makeliquidfromgas(HydrochloricAcid)
LiquidHydrochloricAcid.Image = "Icon-LiquidHydrochloricAcid.png"
LiquidHydrochloricAcid.MolarVolume = 0.028
LiquidHydrochloricAcid.MolarVolume = 0.028
LiquidHydrochloricAcid.ID = 33554432
LiquidHydrochloricAcid.ID = 33554432
Line 581: Line 633:
local Ozone = {
local Ozone = {
Name = "Ozone",
Name = "Ozone",
HumanReadableSymbol = "O3",
Image="Icon-Ozone.png",
ID = 67108864,
ID = 67108864,
MolarMass = 24,
MolarMass = 24,
Line 607: Line 661:
}
}
local LiquidOzone = makeliquidfromgas(Ozone)
local LiquidOzone = makeliquidfromgas(Ozone)
LiquidOxygen.ID = 134217728
LiquidOzone.Image = "Icon-LiquidOzone.png"
LiquidOxygen.MolarVolume = 0.026
LiquidOzone.ID = 134217728
LiquidOzone.MolarVolume = 0.026
AddGas(Ozone)
AddGas(Ozone)
AddGas(LiquidOzone)
AddGas(LiquidOzone)
return p
return p

Latest revision as of 03:22, 17 March 2026

Documentation for this module can be found at Module:Gas/data/doc.

Objects

Gas

A table containing data for a gas.

Fields
Name

An internal name for a given gas, PascalCased. For spaces, use HumanReadableName instead.

ID

The internal mask for a given gas, as an integer value.

HumanReadableName

A human-readable name for a given gas.

HumanReadableSymbol

A community-defined symbol for a given gas. This does not necessarily match the symbol used ingame. Liquids have the same symbol as their matching gas.

MolarMass

The molar mass for a given gas in g/mol.

HeatCapacityRatio

The heat capacity ratio fot a given gas. Adiabatics is only currently used in rocket exhaust velocity calculations.

Image

An URI to an image of the gas on this wiki.

State

The gas's state. Can be either Gas or Liquid.

MolarVolume

Volume taken by 1 mol of gas in liters. Only present in Liquids.

SpecificHeat

The gas's specific heat in J/mol*K.

LatentHeat

The gas's phase change latent heat in J/mol.

CondensesInto

The Name of the liquid the gas condenses into during phase change. Only present on Gases capable of condensing into liquids.

EvaporatesInto

The Name of the gas the liquid condenses into during phase change. Only present on Liquids capable of evaporating into gases.

EvaporationRatio

Multiplier for the energy of the gas the liquid evaporates into. Used for liquids that phase change into gases with different heat capacities (Alcohol / Liquid Sodium Chloride).

TriplePressure

The gas's evaporation pressure at its triple point in kPa.

CriticalPressure

The gas's evaporation pressure at its maximum liquid temperature in kPa.

A

Evaporation Coefficient A for the gas.

B

Evaporation Coefficient B for the gas.

FreezingTemperature

Temperature in kelvin at which the gas freezes.

CriticalTemperature

Temperature in kelvin at which the gas can no longer condense regardless of pressure.


Enthalpy

Enthalpy of combustion for the gas in J/mol. 0 for non-fuels.

AutoignitionTemperature

Temperature at which autoignition occurs in Oxygen for fuels(or spontaneously for Hypergols).

IsHypergol

Boolean on whether autoignition can occur without an oxidizer. Only true in the case of Hydrazine and its liquid counterpart.

AutoignitionOffset

How far the oxidizer reduces autoignition temperatures for fuels that combust with it.

EnthalpyMultiplier

Multiplying factor for the fuel's combustion enthalpy when combusting with a fuel. 2 for Nitrous Oxide and Ozone, 1 for everything else.

ThermalEfficiency

The heat-to-energy conversion efficiency for the gas when it's used in a Stirling Engine.


--[[--
This module is intended to be loaded through mw.loaddata, giving the following restrictions:
	The loaded module is evaluated only once per page, rather than once per {{#invoke:}} call.
	The loaded module is not recorded in package.loaded.
	The value returned from the loaded module must be a table. Other data types are not supported.
	The returned table (and all subtables) may contain only booleans, numbers, strings, and other tables. Other data types, particularly functions, are not allowed.
	The returned table (and all subtables) may not have a metatable.
	All table keys must be booleans, numbers, or strings.
	The table actually returned by mw.loadData() has metamethods that provide read-only access to the table returned by the module. Since it does not contain the data directly, pairs() and ipairs() will work but other methods, including #value, next(), and the functions in the Table library, will not work correctly.
--]]--

local p = {}

-- Gas Constants:
	p.StefanBoltzmannConstant = 5.6703e-8
	p.R = 8.3144 --J/mol*K
	p.PolyatomicHeatCapacityRatio = 1.26
	p.TriatomicHeatCapacityRatio = 1.333333
	p.DiatomicHeatCapacityRatio = 1.4
	p.MonoatomicHeatCapacityRatio = 1.666666

--[[--
	Gas fields:
	--Name(string, Required): Lua-indexable name for the gas. Should use the english localization with spaces removed. gases["Liquid Hydrochloric Acid"] is a handful to use compared to gases.LiquidHydrochloricAcid.
	--ID(number, Required): Internal Game-specific ID for the gas.
	--HumanReadableName: (string, default: Autofilled from name by prepending uppercase letters with spaces when they're followed by a lowercase letter): Printable name.
	--HumanReadableSymbol: (string): Community-defined chemical name for the gas. Aim for simple: X instead of POL, Alc instead of EtOH|MeOH|CH3CH2OH|CH4O.
 	--Image: (string, NYI): wiki-local URI to an icon of the gas.
	--MolarMass (number, g/mol, Required): Molar mass of the gas for rocketry.
	--HeatCapacityRatio (number, Default: p.MonoatomicHeatCapacityRatio): The gas's heat capacity ratio. Used in rocketry to calculate exhaust velocity.
	--State(string, Autofilled as "Gas"): Phase the gas is in. (Internally, liquids are treated as gases)
	--MolarVolume (number, L/mol, Defaults to 0 for gases): Volume taken by a Liquid.

	--SpecificHeat(number, J/mol*K, Default: nil): Heat capacity for the gas.
	--LatentHeat (number, J/mol, Default: nil): latent heat for the gas.
	--CondensesInto: (Default: nil): Name of gas it condenses in. nil for things that don't condense.
	--EvaporatesInto: (Default: nil): Name of gas it evaporates in. nil for things that don't evaporate.
    --EvaporationRatio: (Default: 1): Multiplier for evaporate energy on evaporation. Latent heat is still added separately.
	--TriplePressure: (number, kPa, Default: nil): Minimum condensation pressure.
	--CriticalPressure: (number, kPa, Default: nil): Maximum liquid pressure.
	--A: (number, Default: nil): Coefficient A for the phase change pressure-temperature curve.
	--B: (number, Default: nil): Coefficient B for the phase change pressure-temperature curve.
	--FreezingTemperature: (number, K, Autofilled from TriplePressure, A, B): Temperature at which the gas starts to freeze.
	--CriticalTemperature: (number, K, Autofilled from CriticalPressure, A, B): Temperature at which liquid starts to evaporate regardless of pressure.

	--Enthalpy: (Default: nil) Enthalpy of combustion per mol. Non-0 values indicate it's a fuel or hypergol.
	--AutoignitionTemperature: Temperature at which autoignition occurs under oxygen.
	--IsHypergol: (Default: nil) Whether it autoignites in the presence of an oxidizer regardless of autoignition offset.
	--AutoignitionOffset: (Default: nil) How far it changes autoignition temperatures (relative to oxygen) for fuels that react with it.
	--EnthalpyMultiplier: (Default: nil) How much it multiplies a Fuel's combustion enthalpy when reacting with it. 1 for oxygen, 2 for Ozone/Nitrous Oxide.

	--ThermalEfficiency: (Default: 0.03 for gases, forced to 0 for liquids) The efficiency of a gas inside a stirling engine.
--]]--

  local function GetHumanReadableName(gas)
    --attempts to create a human-readable name by adding a space before an uppercase letter if it's preceeded by a lowercase letter.
    return string.gsub(gas.Name, "(%l)(%u)", "%1 %2")
  end

  local function AddGas(gas)
    if gas.State == "Gas" then
      gas.MolarVolume = gas.MolarVolume or 0
      gas.ThermalEfficiency = gas.ThermalEfficiency or 0.03
    elseif gas.State == "Liquid" then
      gas.ThermalEfficiency = 0  --FIXME: If any liquid gets a non-zero thermal efficiency. Kept this way for the time being as liquid generation copies from gases.
    end

    if gas.CondensesInto or gas.EvaporatesInto then
      gas.FreezingTemperature = gas.FreezingTemperature or (gas.TriplePressure/gas.A)^(1/gas.B)
      gas.CriticalTemperature = gas.CriticalTemperature or (gas.CriticalPressure/gas.A)^(1/gas.B)
    end
   
    gas.HeatCapacityRatio = gas.HeatCapacityRatio or 0.03
    gas.HumanReadableName = gas.HumanReadableName or GetHumanReadableName(gas)
    gas.EvaporationRatio = gas.EvaporationRatio or 1
    
    if gas.Image and not string.match(gas.Image, "^[Ff]ile:") then gas.Image = "File:"..gas.Image end
   
    for k,v in pairs(gas) do
      if k ~= "Name" then 
        --print (k, v)
        if not p[k] then p[k]={} end
        p[k][gas.Name]=v
      end
    end
  p[gas.Name]=gas
  p[gas.ID]=gas --for iterating over all gases, run pairs then filter by type(key)=="number"
  end

local function makeliquidfromgas(gas)
	--creates a deep copy of the original argument with basic changes to make it into a liquid. Some fields still have to be filled in manually.
	local liquid = {}
	for k,v in pairs(gas) do 
		liquid[k] = v
	end
	liquid.EvaporatesInto = gas.Name
	liquid.Name = liquid.CondensesInto
	liquid.CondensesInto = nil
	liquid.State = "Liquid"
	liquid.ThermalEfficiency = 0
	return liquid
end

	local Oxygen = {
		Name = "Oxygen",
		HumanReadableSymbol = "O2",
		Image="Icon-oxygen.png", 
		ID = 1,
		MolarMass = 16,
		HeatCapacityRatio = p.TriatomicHeatCapacityRatio, --Oxygen itself is diatomic, but that's not used on any gas right now. argh. (recheck after rocketry overhaul)
		State = "Gas",
		MolarVolume = nil, --will be defaulted to 0 on AddGas
		
		SpecificHeat =  21.1,
		LatentHeat = 800,
		CondensesInto = "LiquidOxygen",
		EvaporatesInto = nil,
		TriplePressure = 6.3,
		CriticalPressure = 6000,
		A = 2.6854996004e-11,
		B = 6.49214937325,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas

		Enthalpy = nil,
		AutoignitionTemperature = nil,
		IsHypergol = nil,
		AutoignitionOffset = 0,
		EnthalpyMultiplier = 1,

		ThermalEfficiency = 0.12
	}
local LiquidOxygen = makeliquidfromgas(Oxygen)
	LiquidOxygen.Image = "Icon-liquidoxygen.png"
	LiquidOxygen.ID = 256
	LiquidOxygen.MolarVolume = 0.03
AddGas(Oxygen)
AddGas(LiquidOxygen)

	local Nitrogen = {
		Name = "Nitrogen",
		HumanReadableSymbol = "N2", --ingame still uses "N"
		Image="Icon-nitrogen.png", 
		ID = 2,
		MolarMass = 64, --recheck after rocketry overhaul.
		HeatCapacityRatio = p.TriatomicHeatCapacityRatio, --Nitrogen itself is diatomic, but that's not used on any gas right now. argh. (recheck after rocketry overhaul)
		State = "Gas",
		MolarVolume = nil, --will be defaulted to 0 on AddGas
		
		SpecificHeat = 20.6,
		LatentHeat = 500,
		CondensesInto = "LiquidNitrogen",
		EvaporatesInto = nil,
		TriplePressure = 6.3,
		CriticalPressure = 6000,
		A = 5.5757107833e-7,
		B = 4.40221368946,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas
		
		Enthalpy = nil,
		AutoignitionTemperature = nil,
		IsHypergol = nil,
		AutoignitionOffset = nil,
		EnthalpyMultiplier = nil,
		
		ThermalEfficiency = 0.12
	}

local LiquidNitrogen = makeliquidfromgas(Nitrogen)
	LiquidNitrogen.Image = "Icon-LiquidNitrogen.png"
	LiquidNitrogen.ID = 128
	LiquidNitrogen.MolarVolume = 0.0348
AddGas(Nitrogen)
AddGas(LiquidNitrogen)

local CarbonDioxide = {
		Name = "CarbonDioxide",
		HumanReadableSymbol = "CO2",
		Image="Icon-carbondioxide.png", 
		ID = 4,
		MolarMass = 44,
		HeatCapacityRatio = p.TriatomicHeatCapacityRatio, --Triatomic at room temperatures. Gains vibrational freedom on high temperatures making polyatomic-ish there IRL but notingame. (recheck after rocketry overhaul)
		State = "Gas",
		MolarVolume = nil, --will be defaulted to 0 on AddGas
		
		SpecificHeat = 28.2,
		LatentHeat = 600,
		CondensesInto = "LiquidCarbonDioxide",
		EvaporatesInto = nil,
		TriplePressure = 517,
		CriticalPressure = 6000,
		A = 1.579573e-26,
		B = 12.195837931,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas
		
		Enthalpy = nil,
		AutoignitionTemperature = nil,
		IsHypergol = nil,
		AutoignitionOffset = nil,
		EnthalpyMultiplier = nil,
		
		ThermalEfficiency = 0.08
	}
local LiquidCarbonDioxide = makeliquidfromgas(CarbonDioxide)
	LiquidCarbonDioxide.Image = "Icon-liquidcarbondioxide.png"
	LiquidCarbonDioxide.ID = 2048
	LiquidCarbonDioxide.MolarVolume = 0.04
AddGas(CarbonDioxide)
AddGas(LiquidCarbonDioxide)

	local Methane = {
		Name = "Methane",
		HumanReadableSymbol = "CH4",
		Image="Icon-Methane.png", 
		ID = 8,
		MolarMass = 16, 
		HeatCapacityRatio = p.TriatomicHeatCapacityRatio,
		State = "Gas",
		MolarVolume = nil, --will be defaulted to 0 on AddGas
		
		SpecificHeat = 20.4,
		LatentHeat = 1000,
		CondensesInto = "LiquidMethane",
		EvaporatesInto = nil,
		TriplePressure = 6.3,
		CriticalPressure = 6000,
		A = 5.863496734e-15,
		B = 7.8643601035,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas
		
		Enthalpy = 286000,
		AutoignitionTemperature = 573.15,
		IsHypergol = nil,
		AutoignitionOffset = nil,
		EnthalpyMultiplier = nil,
		
		ThermalEfficiency = 0.15
	}
local LiquidMethane = makeliquidfromgas(Methane)
	LiquidMethane.Image = "Icon-LiquidMethane.png"
	LiquidMethane.MolarVolume = 0.04
	LiquidMethane.ID = 512
AddGas(Methane)
AddGas(LiquidMethane)

	local Pollutant = {
		Name = "Pollutant",
		HumanReadableSymbol = "X",
		Image="Icon-pollutant.png", 
		ID = 16,
		MolarMass = 28, 
		HeatCapacityRatio = p.PolyatomicHeatCapacityRatio, --not triatomic.
		State = "Gas",
		MolarVolume = nil, --will be defaulted to 0 on AddGas
		
		SpecificHeat = 24.8,
		LatentHeat = 2000,
		CondensesInto = "LiquidPollutant",
		EvaporatesInto = nil,
		TriplePressure = 1800,
		CriticalPressure = 6000,
		A = 2.079033884,
		B = 1.31202194555,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas
		
		Enthalpy = nil,
		AutoignitionTemperature = nil,
		IsHypergol = nil,
		AutoignitionOffset = nil,
		EnthalpyMultiplier = nil,
		
		ThermalEfficiency = 0.05
	}
local LiquidPollutant = makeliquidfromgas(Pollutant)
	LiquidPollutant.Image = "Icon-liquidpollutant.png"
	LiquidPollutant.MolarVolume = 0.04
	LiquidPollutant.ID = 4096
AddGas(Pollutant)
AddGas(LiquidPollutant)

--next is theoretically Water, but because i'm too lazy to create a makegasfromliquid function, here goes Steam instead.
	local Steam = {
		Name = "Steam",
		HumanReadableSymbol = "H2O",
		Image="Icon-water.png", 
		ID = 1024,
		MolarMass = 108, --higher than IRL water. recheck after rocketry overhaul.
		HeatCapacityRatio = p.TriatomicHeatCapacityRatio,
		State = "Gas",
		MolarVolume = nil, --will be defaulted to 0 on AddGas
		
		SpecificHeat = 72,
		LatentHeat = 8000,
		CondensesInto = "Water",
		EvaporatesInto = nil,
		TriplePressure = 6.3,
		CriticalPressure = 6000,
		A = 3.8782059839e-19,
		B = 7.90030107708,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas
		
		Enthalpy = nil,
		AutoignitionTemperature = nil,
		IsHypergol = nil,
		AutoignitionOffset = nil,
		EnthalpyMultiplier = nil,
		
		ThermalEfficiency = 0.05
	}
local Water = makeliquidfromgas(Steam)
	Water.Image = "Icon-LiquidWater.png"
	Water.MolarVolume = 0.018
	Water.ID = 32
AddGas(Steam)
AddGas(Water)

	local NitrousOxide = {
		Name = "NitrousOxide",
		HumanReadableSymbol = "N2O", --Chemistry.GasSymbols uses "NOS" which is a trademark?
		Image="Icon-nitrousoxide.png", 
		ID = 64,
		MolarMass = 46, 
		HeatCapacityRatio = p.TriatomicHeatCapacityRatio,
		State = "Gas",
		MolarVolume = nil, --will be defaulted to 0 on AddGas
		
		SpecificHeat = 37.2,
		LatentHeat = 4000,
		CondensesInto = "LiquidNitrousOxide",
		EvaporatesInto = nil,
		TriplePressure = 800,
		CriticalPressure = 2000,
		A = 0.065353501531,
		B = 1.70297431874,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas
		
		Enthalpy = nil,
		AutoignitionTemperature = nil,
		IsHypergol = nil,
		AutoignitionOffset = -250,
		EnthalpyMultiplier = 2, --strong oxidizer
		
		ThermalEfficiency = 0.12
	}
local LiquidNitrousOxide = makeliquidfromgas(NitrousOxide)
	LiquidNitrousOxide.Image = "Icon-LiquidNitrousoxide.png"
	LiquidNitrousOxide.MolarVolume = 0.026
	LiquidNitrousOxide.ID = 8192
AddGas(NitrousOxide)
AddGas(LiquidNitrousOxide)

--earlier liquids and steam get slotted here, so their IDs are already represented.

	local Hydrogen = {
		Name = "Hydrogen",
		HumanReadableSymbol = "H2",
		Image="Icon-Hydrogen.png", 
		ID = 16384,
		MolarMass = 2, 
		HeatCapacityRatio = p.TriatomicHeatCapacityRatio,
		State = "Gas",
		MolarVolume = nil, --will be defaulted to 0 on AddGas
		
		SpecificHeat = 20.4, --used to be 2, recheck after rocketry overhaul
		LatentHeat = 200,
		CondensesInto = "LiquidHydrogen",
		EvaporatesInto = nil,
		TriplePressure = 6.3,
		CriticalPressure = 6000,
		A = 3.18041e-5,
		B = 4.4843872973,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas
		
		Enthalpy = 306000,
		AutoignitionTemperature = 573.15,
		IsHypergol = nil,
		AutoignitionOffset = nil,
		EnthalpyMultiplier = nil,
		
		ThermalEfficiency = 0.18
	}
local LiquidHydrogen = makeliquidfromgas(Hydrogen)
	LiquidHydrogen.Image = "Icon-LiquidHydrogen.png"
	LiquidHydrogen.MolarVolume = 0.028
	LiquidHydrogen.ID = 32768
AddGas(Hydrogen)
AddGas(LiquidHydrogen)

--Polluted water lacks a gas form. reeeee
	local PollutedWater = {
		Name = "PollutedWater",
		HumanReadableSymbol = "XH2O", --can't think of a commonly adopted community symbol. ingame icon uses PW but also XH2O in Chemistry._gasSymbols.
		Image="Icon-pollutedwater.png", 
		ID = 65536,
		MolarMass = 108,
		HeatCapacityRatio = p.TriatomicHeatCapacityRatio,
		State = "Liquid", --NOT a gas.
		MolarVolume = 0.018,
		
		SpecificHeat = 72,
		LatentHeat = 8000,
		CondensesInto = nil,
		EvaporatesInto = "Steam",
		TriplePressure = 6.3,
		CriticalPressure = 6000,
		A = 4e-20,
		B = 8.27025711260823,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas
		
		Enthalpy = nil,
		AutoignitionTemperature = nil,
		IsHypergol = nil,
		AutoignitionOffset = nil,
		EnthalpyMultiplier = nil,
		
		ThermalEfficiency = 0.00
	}
AddGas(PollutedWater)


	local Hydrazine = {
		Name = "Hydrazine",
		HumanReadableSymbol = "N2H4", --Chemistry.GasSymbols uses "HZ"
		Image="Icon-Hydrazine.png", 
		ID = 131072,
		MolarMass = 32, 
		HeatCapacityRatio = p.PolyatomicHeatCapacityRatio, --NOT triatomic.
		State = "Gas",
		MolarVolume = nil, --will be defaulted to 0 on AddGas
		
		SpecificHeat = 48.4,
		LatentHeat = 4000,
		CondensesInto = "LiquidHydrazine",
		EvaporatesInto = nil,
		TriplePressure = 6.3,
		CriticalPressure = 6000,
		A = 8E-22,
		B = 9.15642808045339,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas
		
		Enthalpy = 306000,
		AutoignitionTemperature = (6000/8e-22)^(1/9.15642808045339), -- = evaporation temperature at critical pressure
		IsHypergol = true, --Only hypergol in the game as of now (along with liquid hydrazine)
		AutoignitionOffset = nil,
		EnthalpyMultiplier = nil,
		
		ThermalEfficiency = 0.08
	}
local LiquidHydrazine = makeliquidfromgas(Hydrazine)
	LiquidHydrazine.Image = "Icon-LiquidHydrazine.png"
	LiquidHydrazine.MolarVolume = 0.03
	LiquidHydrazine.ID = 262144
AddGas(Hydrazine)
AddGas(LiquidHydrazine)

--Liquid Alcohol lacks a gas form. reeeee
	local LiquidAlcohol = {
		Name = "LiquidAlcohol",
		HumanReadableSymbol = "Alc", --still listed as "Al" in Chemistry._gasSymbols.
		Image="Icon-LiquidAlcohol.png", 
		ID = 524288,
		MolarMass = 46, --same as Ethanol
		HeatCapacityRatio = p.PolyatomicHeatCapacityRatio, --NOT triatomic.
		State = "Liquid", --NOT a gas.
		MolarVolume = 0.058,
		
		SpecificHeat = 33,
		LatentHeat = 2000,
		CondensesInto = nil,
		EvaporatesInto = "Methane",
		EvaporationRatio = 0.6181818181818182,
		TriplePressure = 6.3,
		CriticalPressure = 1000,
		A = 9e-20,
		B = 8.391884446078986,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas
		
		Enthalpy = 566000,
		AutoignitionTemperature = 673.15, -- 100°C higher than other fuels
		IsHypergol = nil,
		AutoignitionOffset = nil,
		EnthalpyMultiplier = nil,
		
		ThermalEfficiency = 0.00
	}
AddGas(LiquidAlcohol)

	local Helium = {
		Name = "Helium",
		HumanReadableSymbol = "He", --listed as "HE" in Chemistry._gasSymbols.
		Image="Icon-Helium.png", 
		ID = 1048576,
		MolarMass = 4, 
		HeatCapacityRatio = p.MonoatomicHeatCapacityRatio, --the only monoatomic gas currently ingame.
		State = "Gas",
		MolarVolume = nil, --will be defaulted to 0 on AddGas
		
		SpecificHeat = 20.8,
		LatentHeat = 0, --Chemistry.LATENT_HEAT_HELIUM
		CondensesInto = nil,
		EvaporatesInto = nil,
		TriplePressure = 0, --Chemistry.MINIMUM_LIQUID_PRESSURE_HELIUM
		CriticalPressure = 515, --Mole.MinimumLiquidPressureAtMaxTemperature. Same as molten salt for some reason.
		A = 0, -- These are actually defined. Were it not defined, these would return an ArgumentOutOfRangeException when queried ingame.
		B = 0, -- Enjoy the divisions by 0 while trying to calculate evaporation pressure, i guess.
		FreezingTemperature = 0, --Chemistry.FREEZING_POINT_HELIUM
		CriticalTemperature = 0, --Chemistry.CRITICAL_TEMPERATURE_HELIUM_K
		
		Enthalpy = nil,
		AutoignitionTemperature = nil,
		IsHypergol = nil,
		AutoignitionOffset = nil,
		EnthalpyMultiplier = nil,
		
		ThermalEfficiency = 0.18
	}
AddGas(Helium)

local LiquidSodiumChloride = {
		Name = "LiquidSodiumChloride",
		HumanReadableSymbol = "NaCl", --most liquids in Chemistry._gasSymbols are prepended with a "L", but not this one.
		Image="Icon-LiquidSodiumChloride.png", 
		ID = 2097152,
		MolarMass = 101,
		HeatCapacityRatio = p.PolyatomicHeatCapacityRatio, --NOT triatomic.
		State = "Liquid", --NOT a gas.
		MolarVolume = 0.04,
		
		SpecificHeat = 130,
		LatentHeat = 16000,
		CondensesInto = nil,
		EvaporatesInto = "Pollutant",
		EvaporationRatio = 0.19076923076923077,
		TriplePressure = 6.3,
		CriticalPressure = 515,
		A = 6.211737044295E-08,
		B = 2.8774143233482707,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas
		
		Enthalpy = nil,
		AutoignitionTemperature = nil,
		IsHypergol = nil,
		AutoignitionOffset = nil,
		EnthalpyMultiplier = nil,
		
		ThermalEfficiency = 0.00
	}
AddGas(LiquidSodiumChloride)

	local Silanol = {
		Name = "Silanol",
		HumanReadableSymbol = "Sil",
		Image="Icon-Silanol.png", 
		ID = 4194304,
		MolarMass = 166, 
		HeatCapacityRatio = p.PolyatomicHeatCapacityRatio, --not triatomic.
		State = "Gas",
		MolarVolume = nil, --will be defaulted to 0 on AddGas
		
		SpecificHeat = 101,
		LatentHeat = 10000,
		CondensesInto = "LiquidSilanol",
		EvaporatesInto = nil,
		TriplePressure = 516,
		CriticalPressure = 6000,
		A = 0.22176555607618392,
		B = 1.5206578718752168,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas
		
		Enthalpy = nil,
		AutoignitionTemperature = nil,
		IsHypergol = nil,
		AutoignitionOffset = nil,
		EnthalpyMultiplier = nil,
		
		ThermalEfficiency = 0.05
	}
local LiquidSilanol = makeliquidfromgas(Silanol)
	LiquidSilanol.Image = "Icon-LiquidSilanol.png"
	LiquidSilanol.MolarVolume = 0.16
	LiquidSilanol.ID = 8388608
AddGas(Silanol)
AddGas(LiquidSilanol)

	local HydrochloricAcid = {
		Name = "HydrochloricAcid",
		HumanReadableSymbol = "HCl",
		Image="Icon-HydrochloricAcid.png", 
		ID = 16777216,
		MolarMass = 36, 
		HeatCapacityRatio = p.PolyatomicHeatCapacityRatio, --NOT triatomic.
		State = "Gas",
		MolarVolume = nil, --will be defaulted to 0 on AddGas
		
		SpecificHeat = 37, --used to be 2, recheck after rocketry overhaul
		LatentHeat = 1000,
		CondensesInto = "LiquidHydrochloricAcid",
		EvaporatesInto = nil,
		TriplePressure = 6.3,
		CriticalPressure = 1000,
		A = 1E-21,
		B = 9.108844460789863,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas
		
		Enthalpy = nil,
		AutoignitionTemperature = nil,
		IsHypergol = nil,
		AutoignitionOffset = nil,
		EnthalpyMultiplier = nil,
		
		ThermalEfficiency = 0.05
	}
local LiquidHydrochloricAcid = makeliquidfromgas(HydrochloricAcid)
	LiquidHydrochloricAcid.Image = "Icon-LiquidHydrochloricAcid.png"
	LiquidHydrochloricAcid.MolarVolume = 0.028
	LiquidHydrochloricAcid.ID = 33554432
AddGas(HydrochloricAcid)
AddGas(LiquidHydrochloricAcid)

	local Ozone = {
		Name = "Ozone",
		HumanReadableSymbol = "O3",
		Image="Icon-Ozone.png", 
		ID = 67108864,
		MolarMass = 24,
		HeatCapacityRatio = p.TriatomicHeatCapacityRatio,
		State = "Gas",
		MolarVolume = nil, --will be defaulted to 0 on AddGas
		
		SpecificHeat =  38.6,
		LatentHeat = 1000,
		CondensesInto = "LiquidOzone",
		EvaporatesInto = nil,
		TriplePressure = 250,
		CriticalPressure = 6000,
		A = 0.006219763823043718,
		B = 2.4097251251207226,
		FreezingTemperature = nil, --will be calculated later on AddGas
		CriticalTemperature = nil, --will be calculated later on AddGas

		Enthalpy = nil,
		AutoignitionTemperature = nil,
		IsHypergol = nil,
		AutoignitionOffset = -150, --strong oxidizer.
		EnthalpyMultiplier = 2,

		ThermalEfficiency = 0.12
	}
local LiquidOzone = makeliquidfromgas(Ozone)
	LiquidOzone.Image = "Icon-LiquidOzone.png"
	LiquidOzone.ID = 134217728
	LiquidOzone.MolarVolume = 0.026
AddGas(Ozone)
AddGas(LiquidOzone)
return p