This commit is contained in:
Brevven 2022-06-26 02:06:58 -07:00
parent b109fd2cd9
commit c9dc300b14

View file

@ -457,17 +457,22 @@ function util.replace_product(recipe_name, old, new)
end
function replace_product(recipe, old, new)
if recipe ~= nil and recipe.results ~= nil then
if recipe then
if recipe.main_product == old then
recipe.main_product = new
end
if recipe.result == old then
recipe.results = new
recipe.result = new
return
end
if recipe.results then
for i, result in pairs(recipe.results) do
if result.name == old then result.name = new end
if result[1] == old then result[1] = new end
end
end
end
end
-- Remove an element of type t and name from data.raw
function util.remove_raw(t, name)