From b1cbacc920d781cc8278c1ee4a3473f44088c8fa Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Sun, 19 May 2024 20:12:25 +0200 Subject: [PATCH] feat: add harvesting config file --- config/harvesting.lua | 5 +++++ inferium-harvester.lua | 18 +++++++----------- install.lua | 3 ++- 3 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 config/harvesting.lua diff --git a/config/harvesting.lua b/config/harvesting.lua new file mode 100644 index 0000000..d630e78 --- /dev/null +++ b/config/harvesting.lua @@ -0,0 +1,5 @@ +return { + length = 8, + firstCropZ = 2, + energySaving = false +} \ No newline at end of file diff --git a/inferium-harvester.lua b/inferium-harvester.lua index f558e5e..4edbebc 100644 --- a/inferium-harvester.lua +++ b/inferium-harvester.lua @@ -1,15 +1,9 @@ -local config = { - length = 8, - firstCropZ = 2, - energySaving = false -} - -local MIN_FUEL_NEEDED = (10 + config.firstCropZ + config.length) * 2 - -local VERSION = "0.2.0" -local IDLE_TIME = 2 - local turtleUtils = require('libs/turtle-utils') +local config = require('config/harvesting') + +local VERSION = "0.3.0" +local IDLE_TIME = 2 +local MIN_FUEL_NEEDED = (10 + config.firstCropZ + config.length) * 2 -- UTILS @@ -133,6 +127,8 @@ local function harvestDown() if not turtle.placeDown() then error('turtle cannot place crop') end + + turtleUtils.compactInventory() end local function forward() diff --git a/install.lua b/install.lua index 5a8871b..752d239 100644 --- a/install.lua +++ b/install.lua @@ -12,7 +12,8 @@ local LIST_LIBS_FILES = { local LIST_CONFIG_FILES = { 'startup.lua', - 'config/mining.lua' + 'config/mining.lua', + 'config/harvesting.lua' }