Actions

Module

Difference between revisions of "Gas/data"

From Unofficial Stationeers Wiki

m (fix some copypasting brainfarts)
(Add image links for all gases)
 
(One intermediate revision 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 52: Line 52:
 
--]]--
 
--]]--
  
 +
  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 71:
 
    
 
    
 
     gas.HeatCapacityRatio = gas.HeatCapacityRatio or 0.03
 
     gas.HeatCapacityRatio = gas.HeatCapacityRatio or 0.03
 +
    gas.HumanReadableName = gas.HumanReadableName or GetHumanReadableName(gas)
  
 
     for k,v in pairs(gas) do
 
     for k,v in pairs(gas) do
Line 95: Line 100:
 
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 128:
 
}
 
}
 
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 136:
 
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 165:
  
 
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 173:
 
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 201:
 
}
 
}
 
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 209:
 
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 237:
 
}
 
}
 
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 245:
 
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 273:
 
}
 
}
 
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 282:
 
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 = 48, --higher than IRL water. recheck after rocketry overhaul.
Line 288: Line 310:
 
}
 
}
 
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 318:
 
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 346:
 
}
 
}
 
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 356:
 
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 384:
 
}
 
}
 
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 393:
 
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 = 48,
Line 394: Line 425:
 
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 420: Line 453:
 
}
 
}
 
local LiquidHydrazine = makeliquidfromgas(Hydrazine)
 
local LiquidHydrazine = makeliquidfromgas(Hydrazine)
 +
LiquidHydrazine.Image = "Icon-LiquidHydrazine.png"
 
LiquidHydrazine.MolarVolume = 0.03
 
LiquidHydrazine.MolarVolume = 0.03
 
LiquidHydrazine.ID = 262144
 
LiquidHydrazine.ID = 262144
Line 428: Line 462:
 
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 457: Line 493:
 
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 524:
 
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 515: Line 555:
 
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 583:
 
}
 
}
 
local LiquidSilanol = makeliquidfromgas(Silanol)
 
local LiquidSilanol = makeliquidfromgas(Silanol)
 +
LiquidSilanol.Image = "Icon-LiquidSilanol.png"
 
LiquidSilanol.MolarVolume = 0.16
 
LiquidSilanol.MolarVolume = 0.16
 
LiquidSilanol.ID = 8388608
 
LiquidSilanol.ID = 8388608
Line 548: Line 591:
 
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 619:
 
}
 
}
 
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 627:
 
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 655:
 
}
 
}
 
local LiquidOzone = makeliquidfromgas(Ozone)
 
local LiquidOzone = makeliquidfromgas(Ozone)
 +
LiquidOzone.Image = "Icon-LiquidOzone.png"
 
LiquidOzone.ID = 134217728
 
LiquidOzone.ID = 134217728
 
LiquidOzone.MolarVolume = 0.026
 
LiquidOzone.MolarVolume = 0.026

Latest revision as of 07:41, 2 March 2026

Documentation for this module may be created at Module:Gas/data/doc

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

    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 = 48, --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 = 48,
		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 = 204000,
		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 = 63,
		LatentHeat = 18000,
		CondensesInto = nil,
		EvaporatesInto = "Methane",
		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 = 418000,
		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 = 1000,
		CondensesInto = nil,
		EvaporatesInto = "Pollutant",
		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