Module:Combustion/data: Difference between revisions
From Stationeers Community Wiki
More actions
Created page with "-- Load with mw.loadData. local GasData = mw.loadData("Module:Gas/data") CombustionData={} CombustionData.Hydrazine={ FuelAmount=1, Outputs={{GasData.Pollutant, Amount = 4}} } CombustionData.LiquidHydrazine = CombustionData.Hydrazine CombustionData.Methane={ Oxygen = { FuelAmount = 2, OxidizerAmount = 1, Outputs = { {GasData.Pollutant, Amount = 3}, {GasData.CarbonDioxide, Amount = 6} } },..." |
No edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
local GasData = mw.loadData("Module:Gas/data") | local GasData = mw.loadData("Module:Gas/data") | ||
CombustionData={} | local CombustionData={} | ||
CombustionData.Hydrazine={ | CombustionData.Hydrazine={ | ||
FuelAmount=1, | FuelAmount=1, | ||
Outputs={{GasData.Pollutant, Amount = 4}} | Outputs={{Gas = GasData.Pollutant, Amount = 4}} | ||
} | } | ||
CombustionData.LiquidHydrazine = CombustionData.Hydrazine | CombustionData.LiquidHydrazine = CombustionData.Hydrazine | ||
| Line 16: | Line 16: | ||
OxidizerAmount = 1, | OxidizerAmount = 1, | ||
Outputs = { | Outputs = { | ||
{GasData.Pollutant, Amount = 3}, | {Gas = GasData.Pollutant, Amount = 3}, | ||
{GasData.CarbonDioxide, Amount = 6} | {Gas = GasData.CarbonDioxide, Amount = 6} | ||
} | } | ||
}, | }, | ||
| Line 25: | Line 25: | ||
OxidizerAmount=1, | OxidizerAmount=1, | ||
Outputs={ | Outputs={ | ||
{GasData.CarbonDioxide, Amount = 2}, | {Gas = GasData.CarbonDioxide, Amount = 2}, | ||
{GasData.Nitrogen, Amount = 2} | {Gas = GasData.Nitrogen, Amount = 2} | ||
} | } | ||
}, | }, | ||
| Line 34: | Line 34: | ||
OxidizerAmount=2, | OxidizerAmount=2, | ||
Outputs={ | Outputs={ | ||
{GasData.Pollutant, Amount = 3}, | {Gas = GasData.Pollutant, Amount = 3}, | ||
{GasData.CarbonDioxide, Amount = 6}, | {Gas = GasData.CarbonDioxide, Amount = 6}, | ||
{GasData.Steam, Amount = 1} | {Gas = GasData.Steam, Amount = 1} | ||
} | } | ||
} | } | ||
| Line 50: | Line 50: | ||
FuelAmount=2, | FuelAmount=2, | ||
OxidizerAmount=1, | OxidizerAmount=1, | ||
Outputs={{GasData.Steam, Amount = 3}} | Outputs={{Gas = GasData.Steam, Amount = 3}} | ||
}, | }, | ||
| Line 57: | Line 57: | ||
OxidizerAmount=1, | OxidizerAmount=1, | ||
Outputs={ | Outputs={ | ||
{GasData.Steam, Amount = 1}, | {Gas = GasData.Steam, Amount = 1}, | ||
{GasData.Nitrogen, Amount = 2} | {Gas = GasData.Nitrogen, Amount = 2} | ||
} | } | ||
}, | }, | ||
| Line 65: | Line 65: | ||
FuelAmount=3, | FuelAmount=3, | ||
OxidizerAmount=1, | OxidizerAmount=1, | ||
Outputs={{GasData.Steam, Amount = 4}} | Outputs={{Gas = GasData.Steam, Amount = 4}} | ||
}, | }, | ||
} | } | ||
| Line 79: | Line 79: | ||
OxidizerAmount = 3, | OxidizerAmount = 3, | ||
Outputs = { | Outputs = { | ||
{GasData.CarbonDioxide, Amount = 4}, | {Gas = GasData.CarbonDioxide, Amount = 4}, | ||
{GasData.Steam, Amount = 2} | {Gas = GasData.Steam, Amount = 2} | ||
} | } | ||
}, | }, | ||
| Line 88: | Line 88: | ||
OxidizerAmount = 2, | OxidizerAmount = 2, | ||
Outputs = { | Outputs = { | ||
{GasData.Nitrogen, Amount = 4}, | {Gas = GasData.Nitrogen, Amount = 4}, | ||
{GasData.Steam, Amount = 2} | {Gas = GasData.Steam, Amount = 2} | ||
} | } | ||
}, | }, | ||
| Line 97: | Line 97: | ||
OxidizerAmount = 2, | OxidizerAmount = 2, | ||
Outputs = { | Outputs = { | ||
{GasData.CarbonDioxide, Amount = 1}, | {Gas = GasData.CarbonDioxide, Amount = 1}, | ||
{GasData.Steam, Amount = 3} | {Gas = GasData.Steam, Amount = 3} | ||
} | } | ||
} | } | ||
| Line 105: | Line 105: | ||
CombustionData.LiquidAlcohol.LiquidNitrousOxide = CombustionData.LiquidAlcohol.NitrousOxide | CombustionData.LiquidAlcohol.LiquidNitrousOxide = CombustionData.LiquidAlcohol.NitrousOxide | ||
CombustionData.LiquidAlcohol.LiquidOzone = CombustionData.LiquidAlcohol.Ozone | CombustionData.LiquidAlcohol.LiquidOzone = CombustionData.LiquidAlcohol.Ozone | ||
-- references to GasData include a metatable failing mw.loadData, so we're doing a deep copy of the table to strip them | |||
local function DeepCopy(OriginalTable, seen) | |||
seen = seen or {} -- Table to track visited tables for circular references | |||
if type(OriginalTable) ~= 'table' then | |||
return OriginalTable | |||
end | |||
if seen[OriginalTable] then | |||
return seen[OriginalTable] | |||
end | |||
local NewTable = {} | |||
seen[OriginalTable] = NewTable | |||
for k, v in pairs(OriginalTable) do | |||
NewTable[k] = DeepCopy(v, seen) -- Recursively copy nested tables | |||
end | |||
return NewTable | |||
end | |||
CombustionData = DeepCopy(CombustionData) | |||
return CombustionData | return CombustionData | ||
Latest revision as of 00:02, 19 March 2026
Documentation for this module may be created at Module:Combustion/data/doc
-- Load with mw.loadData.
local GasData = mw.loadData("Module:Gas/data")
local CombustionData={}
CombustionData.Hydrazine={
FuelAmount=1,
Outputs={{Gas = GasData.Pollutant, Amount = 4}}
}
CombustionData.LiquidHydrazine = CombustionData.Hydrazine
CombustionData.Methane={
Oxygen = {
FuelAmount = 2,
OxidizerAmount = 1,
Outputs = {
{Gas = GasData.Pollutant, Amount = 3},
{Gas = GasData.CarbonDioxide, Amount = 6}
}
},
NitrousOxide={
FuelAmount=1,
OxidizerAmount=1,
Outputs={
{Gas = GasData.CarbonDioxide, Amount = 2},
{Gas = GasData.Nitrogen, Amount = 2}
}
},
Ozone={
FuelAmount=3,
OxidizerAmount=2,
Outputs={
{Gas = GasData.Pollutant, Amount = 3},
{Gas = GasData.CarbonDioxide, Amount = 6},
{Gas = GasData.Steam, Amount = 1}
}
}
}
CombustionData.Methane.LiquidOxygen = CombustionData.Methane.Oxygen
CombustionData.Methane.LiquidNitrousOxide = CombustionData.Methane.NitrousOxide
CombustionData.Methane.LiquidOzone = CombustionData.Methane.Ozone
CombustionData.LiquidMethane = CombustionData.Methane
CombustionData.Hydrogen={
Oxygen={
FuelAmount=2,
OxidizerAmount=1,
Outputs={{Gas = GasData.Steam, Amount = 3}}
},
NitrousOxide={
FuelAmount=1,
OxidizerAmount=1,
Outputs={
{Gas = GasData.Steam, Amount = 1},
{Gas = GasData.Nitrogen, Amount = 2}
}
},
Ozone={
FuelAmount=3,
OxidizerAmount=1,
Outputs={{Gas = GasData.Steam, Amount = 4}}
},
}
CombustionData.Hydrogen.LiquidOxygen = CombustionData.Hydrogen.Oxygen
CombustionData.Hydrogen.LiquidNitrousOxide = CombustionData.Hydrogen.NitrousOxide
CombustionData.Hydrogen.LiquidOzone = CombustionData.Methane.Ozone
CombustionData.LiquidHydrogen = CombustionData.Hydrogen
CombustionData.LiquidAlcohol={
Oxygen={
FuelAmount = 1,
OxidizerAmount = 3,
Outputs = {
{Gas = GasData.CarbonDioxide, Amount = 4},
{Gas = GasData.Steam, Amount = 2}
}
},
NitrousOxide={
FuelAmount = 1,
OxidizerAmount = 2,
Outputs = {
{Gas = GasData.Nitrogen, Amount = 4},
{Gas = GasData.Steam, Amount = 2}
}
},
Ozone={
FuelAmount = 1,
OxidizerAmount = 2,
Outputs = {
{Gas = GasData.CarbonDioxide, Amount = 1},
{Gas = GasData.Steam, Amount = 3}
}
}
}
CombustionData.LiquidAlcohol.LiquidOxygen = CombustionData.LiquidAlcohol.Oxygen
CombustionData.LiquidAlcohol.LiquidNitrousOxide = CombustionData.LiquidAlcohol.NitrousOxide
CombustionData.LiquidAlcohol.LiquidOzone = CombustionData.LiquidAlcohol.Ozone
-- references to GasData include a metatable failing mw.loadData, so we're doing a deep copy of the table to strip them
local function DeepCopy(OriginalTable, seen)
seen = seen or {} -- Table to track visited tables for circular references
if type(OriginalTable) ~= 'table' then
return OriginalTable
end
if seen[OriginalTable] then
return seen[OriginalTable]
end
local NewTable = {}
seen[OriginalTable] = NewTable
for k, v in pairs(OriginalTable) do
NewTable[k] = DeepCopy(v, seen) -- Recursively copy nested tables
end
return NewTable
end
CombustionData = DeepCopy(CombustionData)
return CombustionData