From 1438db99738c1b2a320eed6adf57bcca901925fc Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Sun, 19 May 2024 17:10:21 +0200 Subject: [PATCH] fix(inferium-harvester): get seedName from cropName --- inferium-harvester.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/inferium-harvester.lua b/inferium-harvester.lua index 256bec2..9bae091 100644 --- a/inferium-harvester.lua +++ b/inferium-harvester.lua @@ -5,7 +5,7 @@ local config = { 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 turtleUtils = require('libs/turtle-utils') @@ -35,6 +35,10 @@ local function retrieveChestFuelOrientation() end end +local function getSeedNameFromCropName(cropName) + return string.gsub(cropName, 'crop', 'seeds') +end + -- Implementations local function retrieveHomePositionProcedure() if turtleUtils.getInventory('bottom') then @@ -115,12 +119,13 @@ end local function harvestDown() local cropName = turtleUtils.waitForMatureCrop(turtle.inspectDown, IDLE_TIME) + local seedName = getSeedNameFromCropName(cropName) if not turtle.digDown() then error('turtle cannot harvest crop') end - if not turtleUtils.selectItemByName(cropName) then + if not turtleUtils.selectItemByName(seedName) then error('turtle cannot find any crop to place') end