Hiya,
Been playing with canisters for a while now, and noticed that you recently updated the mod to support alternative recipes.
I've been using some mods that add alternate recipes and wanted to ensure they use canisters as well.
So I wrote a small code snippet (and made a personal mod that I don't plan on publishing) to dynamically add canisters to any item that outputs rocket-fuel
.
It does use part of your current code for recycling and such. No idea if you want to add dynamic recipe allocation (because of balancing etc), but figured I'd share anyway.
local recycling = {}
if mods["quality"] then
recycling = require("__quality__/prototypes/recycling")
end
for _, recipe in pairs(data.raw["recipe"]) do
if recipe.results then
for _, result in pairs(recipe.results) do
if result.name:match("rocket%-fuel") and not recipe.category:match("recycling") then
local has_canister = false
if recipe.ingredients then
for _, ingredient in pairs(recipe.ingredients) do
if ingredient.name:match("canister") then
has_canister = true
end
end
end
if not has_canister then
table.insert(recipe.ingredients, { type = "item", name = "canister", amount = 1 })
if mods["quality"] then
recycling.generate_recycling_recipe(recipe)
end
end
end
end
end
end