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