From 1748b29bbda2c940c8f9fca8e8f223f2a7fb7491 Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Fri, 24 May 2024 18:56:49 +0200 Subject: [PATCH] feat(coal-creafter): dropAll should stop try dropping when a slot is empty --- coal-crafter.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/coal-crafter.lua b/coal-crafter.lua index 592328e..fe76098 100644 --- a/coal-crafter.lua +++ b/coal-crafter.lua @@ -25,7 +25,7 @@ local function dropAll(side, dropFn) turtleUtils.waitForInventory(side, IDLE_TIME) local errorPrinted = false - while not turtleUtils.dropSlot(i, dropFn) do + while turtle.getItemCount(i) > 0 and not turtleUtils.dropSlot(i, dropFn) do if not errorPrinted then print('> please empty the turtle inventory') errorPrinted = true @@ -140,6 +140,10 @@ local function main() print('> drop all') dropAll(STORAGE_INVENTORY_SIDE, dropInStorageFn) + if not turtleUtils.isInventoryEmpty() then + error('Error: inventory is not empty', 0) + end + turtle.select(CRAFTING_SLOT) print('> coal-crafter process started')