feat: keep requesting until above MAX_NUM
This commit is contained in:
parent
256b3779ed
commit
acdd22bd1f
1 changed files with 7 additions and 2 deletions
|
|
@ -163,6 +163,7 @@ end
|
||||||
|
|
||||||
local main_t = peripheral.wrap(MAIN_TICKER)
|
local main_t = peripheral.wrap(MAIN_TICKER)
|
||||||
local request_t = peripheral.wrap(REQUEST_TICKER)
|
local request_t = peripheral.wrap(REQUEST_TICKER)
|
||||||
|
local requesting = {}
|
||||||
while true do
|
while true do
|
||||||
-- 1. Sum items in inventory and organize by item type
|
-- 1. Sum items in inventory and organize by item type
|
||||||
local items = sum_items(main_t.stock)
|
local items = sum_items(main_t.stock)
|
||||||
|
|
@ -178,9 +179,13 @@ while true do
|
||||||
diff = filter_clamp(diff, current_dist)
|
diff = filter_clamp(diff, current_dist)
|
||||||
local crafts = diff_to_crafts(diff)
|
local crafts = diff_to_crafts(diff)
|
||||||
execute_crafts(item_type, crafts)
|
execute_crafts(item_type, crafts)
|
||||||
|
elseif num > MAX_NUM then
|
||||||
|
-- keep requesting until above MAX_NUM
|
||||||
|
requesting[item_type] = nil
|
||||||
else
|
else
|
||||||
-- TODO
|
requesting[item_type] = true
|
||||||
-- TODO potentially keep requesting until above MAX_NUM
|
end
|
||||||
|
if requesting[item_type] then
|
||||||
request_more(request_t, item_type)
|
request_more(request_t, item_type)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue