Page 1 of 1
The real hierarchy of recipes
Posted: Sat Aug 19, 2023 2:38 pm
by Bong_Cat
Hello guys!
I solved my previous problem, but now, even when changing the recipe in data-final-fixes.luca, I don't see any changes in the game, although a note that the recipe has been changed by my mod appears.
Please explain to me, someone, how do I change the recipe 100%?
This piece of code is not working properly:
Code: Select all
data.raw.recipe["stone-furnace"].ingredients =
{
{"stone-brick", 5},
{"alumina", 1}
}
Re: The real hierarchy of recipes
Posted: Sat Aug 19, 2023 3:34 pm
by Bong_Cat
Okey, I find some K2(?) functions and they help me replace recipe of stone-furnace
Code: Select all
krastorio.recipes.overrideIngredients("stone-furnace", {
{"stone-brick", 5},
{"alumina", 1}
})
But with tech-cards this function do not work, I don't even see the mark:
Code: Select all
krastorio.recipes.overrideIngredients("logistic-tech-card",{
{"assembling-machine-1",1},
{"electronic-circuit", 5},
{"blank-tech-card", 5}
})

Please help me change these recipes, I think I'm just getting more confused
Re: The real hierarchy of recipes
Posted: Sat Aug 19, 2023 6:27 pm
by Bong_Cat
Okay, in the deep of K2 data I found this:
Code: Select all
-- Add a new recipe variation for one mod
-- (call this function two time with the same mod_name, science_pack_name will overwrite the previus variation)
-- this function must be called with the same argument in setting-update stage and in data-update stage, both!
-- @ mod_name, name of mod that use this recipe for this science pack
-- @ science_pack_name, name of science pack es: "automation-science-pack"
-- @ recipe, all recipe defined as standard of data.raw of Factorio
function krastorio.science_pack_recipes.addRecipeVariation(mod_name, science_pack_name, recipe)
if not krastorio.science_pack_recipes[mod_name] then
krastorio.science_pack_recipes[mod_name] = {}
end
if data.raw["string-setting"] and data.raw["string-setting"]["kr-" .. science_pack_name .. "-recipe"] then
table.insert(data.raw["string-setting"]["kr-" .. science_pack_name .. "-recipe"].allowed_values, mod_name)
else
krastorio.science_pack_recipes[mod_name][science_pack_name] = recipe
end
end
return krastorio.science_pack_recipes
I did as it says here:
Code: Select all
--Смена Рецепта Автоматизационной(Красной) научной карты
krastorio.science_pack_recipes.addRecipeVariation("ArtHous's Tweaks", "automation-science-pack", {
type = "recipe",
name = "automation-science-pack",
enabled = false,
energy_required = 20,
result_count = 5,
ingredients = {
{ "blank-tech-card", 5},
{ "kr-loader", 1}
},
result = "automation-science-pack"
})
--Смена Рецета Логистической(Залёной) научной карты
krastorio.science_pack_recipes.addRecipeVariation("ArtHous's Tweaks", "logistic-science-pack", {
type = "recipe",
name = "logistic-science-pack",
enabled = false,
energy_required = 20,
result_count = 5,
ingredients = {
{ "blank-tech-card", 5},
{ "electronic-circuit", 5},
{ "assembling-machine-1", 1}
},
result = "logistic-science-pack"
})
but it doesn't work.
Can someone explain to me what's wrong?
Re: The real hierarchy of recipes
Posted: Sun Aug 20, 2023 11:45 am
by jodokus31
If you simply want to override some recipes of K2, you probably should do in the data-updates state and/or let your mod depend on K2
If you call factorio with the --dump-data flag, you get an output file of the structure of actual existing recipes, etc. (f.e. if a recipe uses normal/expensive or not)
Based on that, it should be straightforward to adjust the recipes with lua
If you rather want to dig into K2 and use those tool functions, you should exactly check, what they do. They can make things easier, if you know what they do. I have no clue about K2