feat: implement auto-discard feature for excess stock management
This commit is contained in:
@@ -426,6 +426,23 @@ local function main()
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
-- Task 5b: Auto-discard excess stock
|
||||||
|
function()
|
||||||
|
if #cfg.TRASH_DROPPERS == 0 then
|
||||||
|
while true do sleep(3600) end
|
||||||
|
end
|
||||||
|
sleep(8) -- let initial scan finish first
|
||||||
|
log.info("DISCARD", "Auto-discard active with %d trash dropper(s)", #cfg.TRASH_DROPPERS)
|
||||||
|
while true do
|
||||||
|
activity.discarding = true
|
||||||
|
state.needsRedraw = true
|
||||||
|
pcall(ops.discardExcess)
|
||||||
|
activity.discarding = false
|
||||||
|
state.needsRedraw = true
|
||||||
|
sleep(cfg.DISCARD_INTERVAL)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
-- Task 6: Low-stock alert checker
|
-- Task 6: Low-stock alert checker
|
||||||
function()
|
function()
|
||||||
sleep(5)
|
sleep(5)
|
||||||
|
|||||||
Reference in New Issue
Block a user