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
|
||||||
end
|
end
|
||||||
|
|
||||||
local function harvestDown()
|
local function harvestDown(index)
|
||||||
local cropName = turtleUtils.waitForMatureCrop(turtle.inspectDown, IDLE_TIME)
|
local cropName = turtleUtils.waitForMatureCrop(turtle.inspectDown, IDLE_TIME)
|
||||||
local seedName = getSeedNameFromCropName(cropName)
|
local seedName = getSeedNameFromCropName(cropName)
|
||||||
|
|
||||||
|
localPlan[index] = seedName
|
||||||
|
|
||||||
if not turtle.digDown() then
|
if not turtle.digDown() then
|
||||||
error('turtle cannot harvest crop')
|
error('turtle cannot harvest crop')
|
||||||
end
|
end
|
||||||
@ -210,7 +212,7 @@ end
|
|||||||
|
|
||||||
local function harvestProcedure()
|
local function harvestProcedure()
|
||||||
for i=1, config.length, 1 do
|
for i=1, config.length, 1 do
|
||||||
harvestDown()
|
harvestDown(i)
|
||||||
|
|
||||||
if i ~= config.length then
|
if i ~= config.length then
|
||||||
forward()
|
forward()
|
||||||
@ -410,7 +412,8 @@ local function replantProcedure()
|
|||||||
replantSeeds()
|
replantSeeds()
|
||||||
end
|
end
|
||||||
|
|
||||||
localPlan = utils.shallowClone(remotePlan)
|
-- reset the local plan (it will be re-updated during the harvest procedure)
|
||||||
|
localPlan = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Main procedure
|
-- Main procedure
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user