Advertisement
Guest User

mine.lua

a guest
Jul 18th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. local args = {...}
  2. local dist = args[1]
  3.  
  4. turtle.select(16)
  5. if turtle.getItemCount(16) == 0 then
  6.     error('Please place target block in slot 16')
  7. end
  8.  
  9. function searchAround()
  10.     turtle.select(16)
  11.     if turtle.compareDown() then
  12.         turtle.digDown()
  13.         turtle.down()
  14.         searchAround()
  15.         turtle.up()
  16.     elseif turtle.compareUp() then
  17.         turtle.digUp()
  18.         turtle.up()
  19.         searchAround()
  20.         turtle.down()
  21.     end
  22.    
  23.     turtle.turnLeft()
  24.     if turtle.compare() then
  25.         turtle.dig()
  26.         turtle.forward()
  27.         searchAround()
  28.         turtle.back()
  29.     end
  30.    
  31.     turtle.turnRight()
  32.     turtle.turnRight()
  33.     if turtle.compare() then
  34.         turtle.dig()
  35.         turtle.forward()
  36.         searchAround()
  37.         turtle.back()
  38.     end
  39.     turtle.turnLeft()
  40. end
  41.  
  42.  
  43. for i = 1,dist do
  44.     turtle.dig()
  45.     turtle.forward()
  46.     turtle.digUp()
  47.     searchAround()
  48.     turtle.up()
  49.     searchAround()
  50.     turtle.down()
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement