Update lignumis/prototypes/compatibility/k2so.lua

Some refactoring. Decided to remove the technology entirely and have it be unlocked with Advanced Labs. Needed to directly fix Production Science research as well, since it was erroneously still requiring Steam and Wood. Once Optimization Science shows up, Steam/Wood should already be replaced with Gold Tech Cards.
This commit is contained in:
Jiopaba 2026-03-22 06:36:43 +01:00
parent 78d8a7bcdd
commit a100862e87

View file

@ -78,27 +78,9 @@ data:extend({
} }
}) })
data:extend({ Technology:new("kr-advanced-lab")
{ :addRecipe("gold-research-data")
type = "technology", :addRecipe("gold-tech-card")
name = "gold-tech-card",
icon = Lignumis.graphics .. "technology/lig-gold-science-pack-tech.png",
icon_size = 128,
unit = {
time = 45,
count = 500,
ingredients = {
{ "wood-science-pack", 1 },
{ "steam-science-pack", 1 }
}
},
prerequisites = { "gold-fluid-handling", "kr-advanced-lab" },
effects = {
{ type = "unlock-recipe", recipe = "gold-research-data" },
{ type = "unlock-recipe", recipe = "gold-tech-card" }
}
}
})
data.raw.recipe["burner-inserter"].ingredients = { data.raw.recipe["burner-inserter"].ingredients = {
{ type = "item", name = "wooden-gear-wheel", amount = 1 }, { type = "item", name = "wooden-gear-wheel", amount = 1 },
@ -141,89 +123,76 @@ if settings.startup["kr-realistic-weapons"].value then
data.raw.recipe["firearm-magazine"].enabled = false data.raw.recipe["firearm-magazine"].enabled = false
end end
if settings.startup["lignumis-technology-progression"].value if not (settings.startup["lignumis-technology-progression"].value and
and settings.startup["lignumis-k2so-gold-tech-card"].value settings.startup["lignumis-k2so-gold-tech-card"].value) then
then return
for _, technology in pairs(data.raw.technology) do end
if technology.unit
and technology.unit.ingredients
and not technology.lignumis_skip_science_packs
and not table.contains(Lignumis.science_blacklist, technology.name)
and not table.contains(Lignumis.science_pack_whitelist, technology.name)
then
local has_whitelisted_pack = false
local has_wood_pack = false
local has_steam_pack = false
for _, ingredient in pairs(technology.unit.ingredients) do local function upgrade_to_gold_card(tech)
local ingredient_name = ingredient[1] or ingredient.name if not (tech and tech.unit and tech.unit.ingredients) then return end
if ingredient_name == "wood-science-pack" then local new_ingredients = {}
has_wood_pack = true local changed = false
elseif ingredient_name == "steam-science-pack" then
has_steam_pack = true for _, ing in pairs(tech.unit.ingredients) do
elseif table.contains(Lignumis.science_pack_whitelist, ingredient_name) then local name = ing[1] or ing.name
has_whitelisted_pack = true if name == "wood-science-pack" or name == "steam-science-pack" then
changed = true
else
table.insert(new_ingredients, ing)
end end
end end
if has_whitelisted_pack and has_wood_pack and has_steam_pack then local has_gold = false
local ingredients = {} for _, ing in pairs(new_ingredients) do
if (ing[1] or ing.name) == "gold-tech-card" then has_gold = true break end
for _, ingredient in pairs(technology.unit.ingredients) do
local ingredient_name = ingredient[1] or ingredient.name
if ingredient_name ~= "wood-science-pack" and ingredient_name ~= "steam-science-pack" then
table.insert(ingredients, ingredient)
end
end end
table.insert(ingredients, { "gold-tech-card", 1 }) if not has_gold then
technology.unit.ingredients = ingredients table.insert(new_ingredients, {"gold-tech-card", 1})
changed = true
if technology.prerequisites and not table.contains(technology.prerequisites, "gold-tech-card") then
table.insert(technology.prerequisites, "gold-tech-card")
end
end
end
end end
for _, lab in pairs(data.raw.lab) do if changed then
if lab.inputs and not table.contains(Lignumis.lab_blacklist, lab.name) and not table.contains(lab.inputs, "gold-tech-card") then tech.unit.ingredients = new_ingredients
table.insert(lab.inputs, "gold-tech-card") tech.prerequisites = tech.prerequisites or {}
end if not table.contains(tech.prerequisites, "kr-advanced-lab") then
end table.insert(tech.prerequisites, "kr-advanced-lab")
end
local utility_science = data.raw.technology["utility-science-pack"] end
if utility_science and utility_science.unit and utility_science.unit.ingredients then end
local ingredients = {}
for name, tech in pairs(data.raw.technology) do
for _, ingredient in pairs(utility_science.unit.ingredients) do if tech.unit and tech.unit.ingredients
local ingredient_name = ingredient[1] or ingredient.name and not tech.lignumis_skip_science_packs
and not table.contains(Lignumis.science_blacklist, name)
if ingredient_name ~= "wood-science-pack" and ingredient_name ~= "steam-science-pack" then and not table.contains(Lignumis.science_pack_whitelist, name) then
table.insert(ingredients, ingredient)
end local has_wood = false
end local has_steam = false
local has_white = false
local has_gold_card = false for _, ing in pairs(tech.unit.ingredients) do
for _, ingredient in pairs(ingredients) do local n = ing[1] or ing.name
local ingredient_name = ingredient[1] or ingredient.name if n == "wood-science-pack" then has_wood = true
if ingredient_name == "gold-tech-card" then elseif n == "steam-science-pack" then has_steam = true
has_gold_card = true elseif table.contains(Lignumis.science_pack_whitelist, n) then has_white = true end
break end
end
end if has_wood and has_steam and has_white then
upgrade_to_gold_card(tech)
if not has_gold_card then end
table.insert(ingredients, { "gold-tech-card", 1 }) end
end end
utility_science.unit.ingredients = ingredients -- Special Cases needing fixing
upgrade_to_gold_card(data.raw.technology["production-science-pack"])
utility_science.prerequisites = utility_science.prerequisites or {} upgrade_to_gold_card(data.raw.technology["utility-science-pack"])
if not table.contains(utility_science.prerequisites, "gold-tech-card") then
table.insert(utility_science.prerequisites, "gold-tech-card") -- Make sure gold tech card is in the labs, same code as in vanilla-updates.lua
for _, lab in pairs(data.raw.lab) do
if lab.inputs and not table.contains(Lignumis.lab_blacklist, lab.name) then
if not table.contains(lab.inputs, "gold-tech-card") then
table.insert(lab.inputs, "gold-tech-card")
end end
end end
end end