fix(inferium-harvester): get seedName from cropName
This commit is contained in:
parent
88d8fae296
commit
1438db9973
@ -5,7 +5,7 @@ local config = {
|
|||||||
|
|
||||||
local MIN_FUEL_NEEDED = (10 + config.firstCropZ + config.length) * 2
|
local MIN_FUEL_NEEDED = (10 + config.firstCropZ + config.length) * 2
|
||||||
|
|
||||||
local VERSION = "0.1.1"
|
local VERSION = "0.1.2"
|
||||||
local IDLE_TIME = 2
|
local IDLE_TIME = 2
|
||||||
|
|
||||||
local turtleUtils = require('libs/turtle-utils')
|
local turtleUtils = require('libs/turtle-utils')
|
||||||
@ -35,6 +35,10 @@ local function retrieveChestFuelOrientation()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function getSeedNameFromCropName(cropName)
|
||||||
|
return string.gsub(cropName, 'crop', 'seeds')
|
||||||
|
end
|
||||||
|
|
||||||
-- Implementations
|
-- Implementations
|
||||||
local function retrieveHomePositionProcedure()
|
local function retrieveHomePositionProcedure()
|
||||||
if turtleUtils.getInventory('bottom') then
|
if turtleUtils.getInventory('bottom') then
|
||||||
@ -115,12 +119,13 @@ end
|
|||||||
|
|
||||||
local function harvestDown()
|
local function harvestDown()
|
||||||
local cropName = turtleUtils.waitForMatureCrop(turtle.inspectDown, IDLE_TIME)
|
local cropName = turtleUtils.waitForMatureCrop(turtle.inspectDown, IDLE_TIME)
|
||||||
|
local seedName = getSeedNameFromCropName(cropName)
|
||||||
|
|
||||||
if not turtle.digDown() then
|
if not turtle.digDown() then
|
||||||
error('turtle cannot harvest crop')
|
error('turtle cannot harvest crop')
|
||||||
end
|
end
|
||||||
|
|
||||||
if not turtleUtils.selectItemByName(cropName) then
|
if not turtleUtils.selectItemByName(seedName) then
|
||||||
error('turtle cannot find any crop to place')
|
error('turtle cannot find any crop to place')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user