I have the same question, albeit slightly differently...
I want to know if its possible to change the recipes in the `global` or per-map settings.
My initial thought is "no" because I dont think you can modify prototypes after the data phase...
To answer your question:
In your vanilla.lua file, you can load the settings and use them in the recipe
HUGE CAVEAT: I am new to the scene, I am new to Lua as well (I have experience in other languages) so please take my advise with a grain of salt...
Code: Select all
hard_recipes = settings.startup["hard-rceipes"].value -- Note, this spelling mistake matches that of the settings.lua file you provided
recipes = {
{
type = "recipe",
category = "basic-crafting",
name = "small-solar-farm",
normal = {
enabled = false,
ingredients = {
{"solar-panel", 100},
},
energy_required = 5,
result = "small-solar-farm",
},
},
{
type = "recipe",
category = "basic-crafting",
name = "medium-solar-farm",
normal = {
enabled = false,
ingredients = {
{"solar-panel", 200},
},
energy_required = 5,
result = "medium-solar-farm",
},
},
{
type = "recipe",
category = "basic-crafting",
name = "large-solar-farm",
normal = {
enabled = false,
ingredients = {
{"solar-panel", 400},
},
energy_required = 5,
result = "large-solar-farm",
},
}
}
if hard_recipes then
for _, recipe in ipairs(recipes) do
for _, ingredient in recipe.ingredients do
ingredient.amount = ingredient.amount*2
end
end
end
data:extend(recipes)