From cc817f53ea09382512a05f0a650a7f184061ccdb Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Sun, 26 May 2024 14:07:32 +0200 Subject: [PATCH] feat(tunnels-miner): use turtleUtils.compactInventory --- tunnels-miner.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tunnels-miner.lua b/tunnels-miner.lua index d22c62b..53e51f3 100644 --- a/tunnels-miner.lua +++ b/tunnels-miner.lua @@ -6,7 +6,7 @@ local TIME_TO_START = 3 local IDLE_TIME_BETWEEN_TUNNELS = 1 local SPACE_BETWEEN_TUNNELS = 3 -local VERSION = "2.1.1" +local VERSION = "2.2.0" local MOVES_BY_DIRECTION = { right = { @@ -129,13 +129,20 @@ local function ensureEnoughSpaceInInventory(config) return end - -- 1. select an item that is not in whitelist item + -- 1. try to compact inventory + turtleUtils.compactInventory() + + if not turtleUtils.isInventoryFull() then + return + end + + -- 2. otherwise select an item that is not in whitelist item local selected = turtleUtils.selectItemBy(function(slot) return not isWhitelistedOre(config, turtle.getItemDetail(slot)) end) if selected then - -- 2. drop the selected item + -- 3. and drop the selected item turtle.drop() trySelectEmptySlot() else