From 3e9222dd8d5bd99eea1fdd8791199162a805cea7 Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Wed, 8 May 2024 21:31:17 +0200 Subject: [PATCH] fix: turtleUtils.tryDrop should return when no item to drop --- turtle-utils.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/turtle-utils.lua b/turtle-utils.lua index 90f74a2..a5b8e90 100644 --- a/turtle-utils.lua +++ b/turtle-utils.lua @@ -25,7 +25,17 @@ turtleUtils.trySuckUp = function() end turtleUtils.tryDrop = function() - while not turtle.drop() do + while true do + if turtle.getItemCount() == 0 then + return false + end + + local dropOk = turtle.drop(); + + if (dropOk) then + return true + end + os.sleep(IDLE_TIME) end end