nullius compat

This commit is contained in:
mamoniot
2023-05-14 13:06:16 -04:00
parent f82243e7e8
commit 25856782f7

View File

@@ -11,20 +11,31 @@ if mods["nullius"] then
table.insert(data.raw.technology["nullius-broadcasting-1"].prerequisites, "cybersyn-train-network") table.insert(data.raw.technology["nullius-broadcasting-1"].prerequisites, "cybersyn-train-network")
end end
-- Reset the combinator recipe back to arithmetic combinator recipe in case a mod has changed it
local recipe = flib.deep_copy(data.raw["recipe"]["arithmetic-combinator"].ingredients) if mods["nullius"] then
for k, _ in pairs(recipe) do --Credit to modo-lv for submitting the following code
local mult = 2 -- Place combinator in the same subgroup as the regular train stop
for i, _ in pairs(recipe) do data.raw["recipe"][COMBINATOR_NAME].subgroup = data.raw["train-stop"]["train-stop"].subgroup
if recipe[k][i] == "copper-cable" then data.raw["item"][COMBINATOR_NAME].subgroup = data.raw["item"]["train-stop"].subgroup
mult = 4 -- Nullius makes modded technologies part of its research tree
break; -- Place combinator in the same place on the research tree as LTN
end table.insert(data.raw.technology["nullius-broadcasting-1"].prerequisites, "cybersyn-train-network")
end else
for i, _ in pairs(recipe) do -- Reset the combinator recipe back to arithmetic combinator recipe in case a mod has changed it
if type(recipe[k][i]) == "number" then local recipe = flib.deep_copy(data.raw["recipe"]["arithmetic-combinator"].ingredients)
recipe[k][i] = mult*recipe[k][i] for k, _ in pairs(recipe) do
local mult = 2
for i, _ in pairs(recipe) do
if recipe[k][i] == "copper-cable" then
mult = 4
break;
end
end
for i, _ in pairs(recipe) do
if type(recipe[k][i]) == "number" then
recipe[k][i] = mult*recipe[k][i]
end
end end
end end
data.raw["recipe"][COMBINATOR_NAME].ingredients = recipe
end end
data.raw["recipe"][COMBINATOR_NAME].ingredients = recipe