From: Olav Bakke Svendsen Date: Tue, 14 May 2024 12:56:20 +0000 (+0200) Subject: vines/turtle.lua: dig cooldown X-Git-Tag: skystone~12 X-Git-Url: http://git.olavbs.no/?a=commitdiff_plain;h=e08fadae0ef7616b935fbb34a3dc2d5122e5eb14;p=cc.git vines/turtle.lua: dig cooldown --- 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