From 192f33c823bca521b92cb9848ea8445e3d65b077 Mon Sep 17 00:00:00 2001 From: Emerson Rosen-Jones Date: Sat, 3 Jan 2026 19:42:51 -0500 Subject: [PATCH] fix: remove syntax and logic errors --- oregen-manager.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/oregen-manager.lua b/oregen-manager.lua index 9a74d32..1719662 100644 --- a/oregen-manager.lua +++ b/oregen-manager.lua @@ -251,8 +251,10 @@ function getNumCraftable (ingredients, current_stock) return result end -function adjustStock (current_stock, recipe, count) - for _, ingredient in ipairs(recipe.ingredients) do +function adjustStock (current_stock, ingredients, count) + if count == 0 then return end + local item, i_count + for _, ingredient in ipairs(ingredients) do item, i_count = ingredient[1], ingredient[2] current_stock[item] = current_stock[item] - (i_count * count) end @@ -263,7 +265,7 @@ function craftRecipe (ticker, recipe, current_stock) if recipe.limit ~= nil then count = math.min(count, recipe.limit) end - adjustStock(current_stock, recipe, count) + adjustStock(current_stock, recipe.ingredients, count) local createRequest createRequest = function (recipe, i) if i == nil then i = 1 end