furnaces
This commit is contained in:
parent
bb3b213f1a
commit
afa282a556
4 changed files with 14 additions and 5 deletions
4
util.lua
4
util.lua
|
|
@ -75,9 +75,7 @@ end
|
|||
function replace_ingredient(recipe, old, new)
|
||||
if recipe ~= nil and recipe.ingredients ~= nil then
|
||||
for i, ingredient in pairs(recipe.ingredients) do
|
||||
-- For final fixes
|
||||
if ingredient.name == old then ingredient.name = new end
|
||||
-- For updates
|
||||
if ingredient[1] == old then ingredient[1] = new end
|
||||
end
|
||||
end
|
||||
|
|
@ -120,11 +118,9 @@ end
|
|||
function replace_some_ingredient(recipe, old, new, amount)
|
||||
if recipe ~= nil and recipe.ingredients ~= nil then
|
||||
for i, ingredient in pairs(recipe.ingredients) do
|
||||
-- For final fixes
|
||||
if ingredient.name == old then
|
||||
ingredient.amount = math.max(1, ingredient.amount - amount)
|
||||
end
|
||||
-- For updates
|
||||
if ingredient[1] == old then
|
||||
ingredient[2] = math.max(1, ingredient[2] - amount)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue