Fix some old 1.1 code

This commit is contained in:
Simon Brodtmann 2025-10-06 12:06:59 +02:00
parent 4d876db270
commit 76c19f1d53
2 changed files with 1 additions and 17 deletions

View file

@ -993,8 +993,6 @@ function add_product(recipe, product)
return
end
end
recipe.result = nil
recipe.result_count = nil
table.insert(recipe.results, product)
end
end
@ -1119,7 +1117,6 @@ end
function replace_some_product(recipe, old, old_amount, new, new_amount)
if recipe ~= nil then
if recipe.result == new then return end
if recipe.results then
for i, existing in pairs(recipe.results) do
if existing.name == new then
@ -1211,10 +1208,6 @@ function set_product_amount(recipe, product, amount)
end
end
end
if not recipe.results and not recipe.result_count then
-- implicit one item result
recipe.result_count = amount
end
end
end
@ -1348,10 +1341,6 @@ function replace_product(recipe, old, new, options)
if recipe.main_product == old then
recipe.main_product = new
end
if recipe.result == old then
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
@ -1611,10 +1600,6 @@ end
function add_to_product(recipe, product, amount)
if recipe ~= nil and recipe.results ~= nil then
if recipe.result == product then
recipe.result_count = recipe.result_count + amount
return
end
for i, result in pairs(recipe.results) do
if result.name == product then
result.amount = result.amount + amount
@ -1823,7 +1808,6 @@ function util.sum_products(recipe_name)
-- this is going to end up approximate in some cases, integer division is probs fine
if data.raw.recipe[recipe_name] then
local recipe = data.raw.recipe[recipe_name]
if not recipe.results then return recipe.result_count end
local sum = 0
for i, result in pairs(recipe.results) do
local amt = 0

View file

@ -16,7 +16,7 @@ data:extend({
enabled = false,
energy_required = 1,
ingredients = {{type="fluid", name="strange-matter", amount = 1}},
result = ore,
results = {{ type = "item", name = ore, amount = 1 }},
category = "crafting-with-fluid",
subgroup = "synthesis",
},