Fix compatibility with Krastorio2

This commit is contained in:
Simon Brodtmann 2025-07-07 23:20:13 +02:00
parent bac183d1c1
commit 0d2ca52091
2 changed files with 14 additions and 5 deletions

View file

@ -311,7 +311,7 @@ end
if mods["Krastorio2"] then if mods["Krastorio2"] or mods["Krastorio2-spaced-out"] then
-- Krastorio² needs much more wood than usually provided by Bio Industries. If Krastorio² is -- Krastorio² needs much more wood than usually provided by Bio Industries. If Krastorio² is
-- active, BI should produce much more wood/wood pulp. For better baĺancing, our recipes should -- active, BI should produce much more wood/wood pulp. For better baĺancing, our recipes should
-- also be changed to require more wood/wood pulp as ingredients. -- also be changed to require more wood/wood pulp as ingredients.
@ -322,11 +322,20 @@ if mods["Krastorio2"] then
"wood", "bi-woodpulp", "wood", "bi-woodpulp",
"bi-seed", "seedling", "water", "bi-seed", "seedling", "water",
} }
local multiply = function(items)
for _, item in pairs(items) do
for _, updateItem in pairs(update) do
if item.name == updateItem then
item.amount = item.amount * 4
end
end
end
end
for _, recipe in pairs(data.raw.recipe) do for _, recipe in pairs(data.raw.recipe) do
BioInd.writeDebug("Recipe has \"mod\" property: %s", { recipe.mod and true or false }) BioInd.writeDebug("Recipe has \"mod\" property: %s", { recipe.mod and true or false })
if recipe.mod == "Bio_Industries_2" then if recipe.mod == "Bio_Industries_2" then
krastorio.recipes.multiplyIngredients(recipe.name, update, 4) multiply(recipe.ingredients)
krastorio.recipes.multiplyProducts(recipe.name, update, 4) multiply(recipe.results)
BioInd.writeDebug("Changed ingredients for %s: %s", BioInd.writeDebug("Changed ingredients for %s: %s",
{ recipe and recipe.name or "nil", recipe and recipe.ingredients or "nil" }) { recipe and recipe.name or "nil", recipe and recipe.ingredients or "nil" })
BioInd.writeDebug("Changed results for %s: %s", BioInd.writeDebug("Changed results for %s: %s",

View file

@ -237,7 +237,7 @@ end
-- Krastorio2 -- Krastorio2
if mods["Krastorio2"] then if mods["Krastorio2"] or mods["Krastorio2-spaced-out"] then
-- Replace liquid air with oxygen in Algae Biomass conversion 2 and 3 -- Replace liquid air with oxygen in Algae Biomass conversion 2 and 3
thxbob.lib.recipe.replace_ingredient("bi-biomass-2", "liquid-air", "oxygen") thxbob.lib.recipe.replace_ingredient("bi-biomass-2", "liquid-air", "oxygen")
thxbob.lib.recipe.replace_ingredient("bi-biomass-3", "liquid-air", "oxygen") thxbob.lib.recipe.replace_ingredient("bi-biomass-3", "liquid-air", "oxygen")
@ -422,7 +422,7 @@ BioInd.writeDebug("Adjusting result for \"angelsrefining\" …")
recipe.result = "solid-sand" recipe.result = "solid-sand"
-- Adjust icon for Krastorio -- Adjust icon for Krastorio
elseif mods["Krastorio2"] or mods["Krastorio"] then elseif mods["Krastorio2"] or mods["Krastorio2-spaced-out"] then
BioInd.writeDebug("Using Krastorio icon …") BioInd.writeDebug("Using Krastorio icon …")
recipe.icons[1].icon = ICONPATH .. "sand-Krastorio.png" recipe.icons[1].icon = ICONPATH .. "sand-Krastorio.png"
end end