feat(inferium-harvester): update the local plan on the go
This commit is contained in:
parent
be9c2c10a1
commit
d16a9b2587
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user