feat(inferium-harvester): do not block harvest procedure when no crop
This commit is contained in:
parent
4af7ae8cfe
commit
d4cbe6e808
@ -2,7 +2,7 @@ local utils = require('libs/utils')
|
||||
local turtleUtils = require('libs/turtle-utils')
|
||||
local config = require('config/harvesting')
|
||||
|
||||
local VERSION = "0.6.0"
|
||||
local VERSION = "1.0.0"
|
||||
local IDLE_TIME = 2
|
||||
local WAIT_ITEM_IDLE_TIME = 5
|
||||
local MIN_FUEL_NEEDED = (100 + config.firstCropZ + config.length) * 2
|
||||
@ -189,6 +189,10 @@ local function harvestDown(index)
|
||||
|
||||
localPlan[index] = seedName
|
||||
|
||||
if not seedName then
|
||||
return false
|
||||
end
|
||||
|
||||
if not turtle.digDown() then
|
||||
error('turtle cannot harvest crop')
|
||||
end
|
||||
@ -202,6 +206,8 @@ local function harvestDown(index)
|
||||
end
|
||||
|
||||
compactIfNeeded()
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
|
||||
@ -57,6 +57,10 @@ end
|
||||
turtleUtils.waitForMatureCrop = function(inspectFn, sleepTime)
|
||||
inspectFn = inspectFn or turtle.inspect
|
||||
|
||||
if not inspectFn() then
|
||||
return nil
|
||||
end
|
||||
|
||||
return waitFor(function()
|
||||
return turtleUtils.getMatureCrop(inspectFn)
|
||||
end, sleepTime)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user