vines/turtle.lua: command strings testing 5
authorOlav Bakke Svendsen <mail@olavbs.no>
Tue, 14 May 2024 12:22:17 +0000 (14:22 +0200)
committerOlav Bakke Svendsen <mail@olavbs.no>
Tue, 14 May 2024 12:22:17 +0000 (14:22 +0200)
vines/turtle.lua

index fe0ff33c8311b6d3969c9328257e7342e5dfcd24..c3405bd94425683c170589653cdead8ff1c2e1dd 100644 (file)
@@ -119,7 +119,8 @@ end
 local harvest = function()
   local facing_block, block = turtle.inspect()
   if not (facing_block and block.name == "minecraft:vine") then return false, "Not facing vine" end
-  if not transferAndSelect(1, shears) then return false, "No shears available" end
+  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()
   if not cut then return false, "Could not cut vine: " .. cut_error end
   local collect, collect_error = automata.collectItems()
@@ -175,8 +176,8 @@ local sequence = function()
   print("pretending to refuel")
   print("pretending to stock up on shears")
   local enter_vineyard = "rf3hfhflfr2d2"
-  local harvest_up = function(n) rep(n, "hu2") .. "h" end
-  local harvest_down = function(n) rep(n, "hd2") .. "h" end
+  local harvest_up = function(n) return rep(n, "hu2") .. "h" end
+  local harvest_down = function(n) return rep(n, "hd2") .. "h" end
   local harvest_ns = rep(2, harvest_up(8).."lfdr"..harvest_down(7).."lfdr")..harvest_up(8)
   local harvest_ew = rep(2, harvest_down(8).."lfur"..harvest_up(7).."lfur")..harvest_down(8)
   local go_to_dropoff = "u2lhfrhf5lf2"