feat: implement auto-crafting feature for excess stock management
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user