feat: implement auto-crafting feature for excess stock management

This commit is contained in:
MayaTheShy
2026-03-25 18:07:26 -04:00
parent 2c99169ce9
commit f327f82677
6 changed files with 99 additions and 0 deletions

View File

@@ -443,6 +443,25 @@ local function main()
end
end,
-- Task 5c: Auto-craft excess items into target products
function()
if #cfg.AUTO_CRAFT_RULES == 0 then
while true do sleep(3600) end
end
sleep(12) -- let initial scan + discard settle first
log.info("AUTOCRAFT", "Auto-craft active with %d rule(s)", #cfg.AUTO_CRAFT_RULES)
while true do
if ctx.craftTurtleName then
activity.autocrafting = true
state.needsRedraw = true
pcall(ops.autoCraft)
activity.autocrafting = false
state.needsRedraw = true
end
sleep(cfg.AUTO_CRAFT_INTERVAL)
end
end,
-- Task 6: Low-stock alert checker
function()
sleep(5)