From d16a9b258768ee9138277e4723193df9c4e75fc5 Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Tue, 21 May 2024 17:44:38 +0200 Subject: [PATCH] feat(inferium-harvester): update the local plan on the go --- inferium-harvester.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/inferium-harvester.lua b/inferium-harvester.lua index afe3b53..776340a 100644 --- a/inferium-harvester.lua +++ b/inferium-harvester.lua @@ -182,10 +182,12 @@ local function compactIfNeeded() end end -local function harvestDown() +local function harvestDown(index) local cropName = turtleUtils.waitForMatureCrop(turtle.inspectDown, IDLE_TIME) local seedName = getSeedNameFromCropName(cropName) + localPlan[index] = seedName + if not turtle.digDown() then error('turtle cannot harvest crop') end @@ -210,7 +212,7 @@ end local function harvestProcedure() for i=1, config.length, 1 do - harvestDown() + harvestDown(i) if i ~= config.length then forward() @@ -410,7 +412,8 @@ local function replantProcedure() replantSeeds() end - localPlan = utils.shallowClone(remotePlan) + -- reset the local plan (it will be re-updated during the harvest procedure) + localPlan = {} end -- Main procedure