feat(coal-creafter): dropAll should stop try dropping when a slot is empty

This commit is contained in:
Guillaume ARM 2024-05-24 18:56:49 +02:00
parent a1364a4bff
commit 1748b29bbd

View File

@ -25,7 +25,7 @@ local function dropAll(side, dropFn)
turtleUtils.waitForInventory(side, IDLE_TIME) turtleUtils.waitForInventory(side, IDLE_TIME)
local errorPrinted = false 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 if not errorPrinted then
print('> please empty the turtle inventory') print('> please empty the turtle inventory')
errorPrinted = true errorPrinted = true
@ -140,6 +140,10 @@ local function main()
print('> drop all') print('> drop all')
dropAll(STORAGE_INVENTORY_SIDE, dropInStorageFn) dropAll(STORAGE_INVENTORY_SIDE, dropInStorageFn)
if not turtleUtils.isInventoryEmpty() then
error('Error: inventory is not empty', 0)
end
turtle.select(CRAFTING_SLOT) turtle.select(CRAFTING_SLOT)
print('> coal-crafter process started') print('> coal-crafter process started')