Advertisement
Guest User

digger

a guest
Dec 11th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. function step()
  2.   turtle.dig()
  3.   turtle.forward()
  4.   turtle.digUp()
  5.   turtle.digDown()
  6.   turtle.turnLeft()
  7.   turtle.dig()
  8.   turtle.forward()
  9.   turtle.digUp()
  10.   turtle.digDown()
  11.   turtle.turnLeft()
  12.   turtle.turnLeft()
  13.   turtle.forward()
  14.   turtle.dig()
  15.   turtle.forward()
  16.   turtle.digUp()
  17.   turtle.digDown()
  18.   turtle.turnLeft()
  19.   turtle.turnLeft()
  20.   turtle.forward()
  21.   turtle.turnRight()
  22. end
  23.  
  24.  
  25. function nextSel(Ind)
  26.   local stop = 0
  27.   while turtle.getItemCount(Ind) == 0 and stop == 0 do
  28.     Ind = Ind + 1
  29.     if Ind > 16 then
  30.       Ind = 1
  31.       stop = 1
  32.     end
  33.   end
  34.   turtle.select(Ind)
  35. end
  36.  
  37.  
  38. local N = (...)
  39.  
  40. for i = 1, N do
  41.   step()
  42.   if i % 5 == 0 then
  43.     print("Percorsi " .. i .. " Blocchi.")
  44.   end
  45.   if i % 20 == 0 then
  46.     nextSel(1)
  47.     turtle.placeDown()
  48.   end
  49. end
  50.  
  51. for i = 1, N do
  52.   turtle.back()
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement