feat: keep requesting until above MAX_NUM

This commit is contained in:
Emerson Rosen-Jones 2026-01-16 22:05:57 -05:00
parent 256b3779ed
commit acdd22bd1f

View file

@ -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