fix: remove syntax errors
This commit is contained in:
parent
efb7b6f6d1
commit
685a3d47e0
1 changed files with 6 additions and 4 deletions
|
|
@ -61,7 +61,7 @@ function createModes (items)
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function updateModes (current_modes)
|
function updateModes (ticker, current_modes)
|
||||||
local lower_lim, upper_lim
|
local lower_lim, upper_lim
|
||||||
local limits = {}
|
local limits = {}
|
||||||
for item, _ in pairs(current_modes) do
|
for item, _ in pairs(current_modes) do
|
||||||
|
|
@ -154,7 +154,7 @@ function getNumCraftable (recipe, current_stock)
|
||||||
for _, ingredient in ipairs(recipe) do
|
for _, ingredient in ipairs(recipe) do
|
||||||
item, count = ingredient[1], ingredient[2]
|
item, count = ingredient[1], ingredient[2]
|
||||||
if current_stock[item] == nil then return 0 end
|
if current_stock[item] == nil then return 0 end
|
||||||
local num = math.floor(current_stock[item] / count))
|
local num = math.floor(current_stock[item] / count)
|
||||||
if result == nil then
|
if result == nil then
|
||||||
result = num
|
result = num
|
||||||
else
|
else
|
||||||
|
|
@ -194,7 +194,7 @@ end
|
||||||
|
|
||||||
function run (ticker, export_storage, current_modes)
|
function run (ticker, export_storage, current_modes)
|
||||||
cycleItems(ticker)
|
cycleItems(ticker)
|
||||||
updateModes(current_modes)
|
updateModes(ticker, current_modes)
|
||||||
local export_amounts = getAmounts(export_storage.list)
|
local export_amounts = getAmounts(export_storage.list)
|
||||||
local stock_amounts = getAmounts(ticker.stock)
|
local stock_amounts = getAmounts(ticker.stock)
|
||||||
for item, mode in pairs(current_modes) do
|
for item, mode in pairs(current_modes) do
|
||||||
|
|
@ -205,7 +205,9 @@ function run (ticker, export_storage, current_modes)
|
||||||
local count = getNumCraftable(recipe, stock_amounts)
|
local count = getNumCraftable(recipe, stock_amounts)
|
||||||
craftRecipe(ticker, recipe, count)
|
craftRecipe(ticker, recipe, count)
|
||||||
elseif mode[1] == "export" then
|
elseif mode[1] == "export" then
|
||||||
local amt_needed = export_amounts[item]
|
local export_amt = export_amounts[item]
|
||||||
|
if export_amt == nil then export_amt = 0 end
|
||||||
|
local amt_needed = KEEP_STOCKED[item] - export_amt
|
||||||
local amt = math.min(amt_needed, mode[2])
|
local amt = math.min(amt_needed, mode[2])
|
||||||
export(ticker, item, amt)
|
export(ticker, item, amt)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue