From e08fadae0ef7616b935fbb34a3dc2d5122e5eb14 Mon Sep 17 00:00:00 2001 From: Olav Bakke Svendsen Date: Tue, 14 May 2024 14:56:20 +0200 Subject: [PATCH] vines/turtle.lua: dig cooldown --- vines/turtle.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vines/turtle.lua b/vines/turtle.lua index 1a1201a..66af0cc 100644 --- a/vines/turtle.lua +++ b/vines/turtle.lua @@ -97,7 +97,7 @@ local transferAndSelect = function(i, t) if i < 1 or i > 16 then return false, msg .. "Index out of range" end -- if a wanted item already is in the wanted slot, select it and return early local item = turtle.getItemDetail(i) - if oneOf(t, item.name) then + if item and oneOf(t, item.name) then turtle.select(i) return true end @@ -131,6 +131,10 @@ local harvest = function() local selected, select_error = transferAndSelect(1, shears) if not selected then return false, "No shears available: " .. select_error end local cut, cut_error = automata.digBlock() + while cut_error == "dig is on cooldown" do + sleep(0.1) + cut, cut_error = automata.digBlock() + end if not cut then return false, "Could not cut vine: " .. cut_error end local collect, collect_error = automata.collectItems() if not collect then return false, "Could not collect vine: " .. collect_error end -- 2.30.2