feat: implement auto-discard feature for excess stock management

This commit is contained in:
MayaTheShy
2026-03-25 17:46:18 -04:00
parent 1336590241
commit 22836dafb2

View File

@@ -426,6 +426,23 @@ local function main()
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
function()
sleep(5)