fix: get to a working state
This commit is contained in:
parent
28e72b142f
commit
0f1ace9116
1 changed files with 7 additions and 5 deletions
|
|
@ -101,7 +101,7 @@ function cycleItems (ticker, items)
|
|||
local makeRequest
|
||||
makeRequest = function (item, amt, addr)
|
||||
local limit = 64
|
||||
if addr = MELTER_ADDR then limit = 9 end
|
||||
if addr == MELTER_ADDR then limit = 9 end
|
||||
if amt < limit then return end
|
||||
local request = {
|
||||
name = item,
|
||||
|
|
@ -109,7 +109,7 @@ function cycleItems (ticker, items)
|
|||
}
|
||||
ticker.requestFiltered(addr, request)
|
||||
os.sleep(1)
|
||||
return makeRequest(item, amt - limit)
|
||||
return makeRequest(item, amt - limit, addr)
|
||||
end
|
||||
for _, pair in pairs(PRODUCTS) do
|
||||
local name, addr = pair[1], pair[2]
|
||||
|
|
@ -142,20 +142,22 @@ function getNumCraftable (recipe, current_stock)
|
|||
result = math.min(result, num)
|
||||
end
|
||||
end
|
||||
if result == nil then result = 0 end
|
||||
return result
|
||||
end
|
||||
|
||||
function craftRecipe (ticker, recipe, count)
|
||||
if count == nil then count = 1 end
|
||||
local createRequest
|
||||
createRequest = function (recipe)
|
||||
local ingredient = table.remove(recipe)
|
||||
createRequest = function (recipe, i)
|
||||
if i == nil then i = 1 end
|
||||
local ingredient = recipe[i]
|
||||
if ingredient == nil then return end
|
||||
local item = {
|
||||
name = ingredient[1],
|
||||
_requestCount = ingredient[2],
|
||||
}
|
||||
return item, createRequest(recipe)
|
||||
return item, createRequest(recipe, i + 1)
|
||||
end
|
||||
while count > 0 do
|
||||
ticker.requestFiltered(PRESS_ADDR, createRequest(recipe))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue