Advertisement
Oysi

Turtle Tunnel Miner

Mar 17th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1.  
  2. -- Script made by Oysi
  3.  
  4. local args = {...}
  5.  
  6. local height = args[1]
  7. local depth = args[2]
  8.  
  9. local function mineForward()
  10.     if turtle.detect() then
  11.         turtle.dig()
  12.     end
  13.     if not turtle.forward() then
  14.         sleep(0.1)
  15.         mineForward()
  16.     end
  17. end
  18.  
  19. local function mineUp()
  20.     if turtle.detectUp() then
  21.         turtle.digUp()
  22.     end
  23.     if not turtle.up() then
  24.         sleep(0.1)
  25.         mineUp()
  26.     end
  27. end
  28.  
  29. local function mineDown()
  30.     if turtle.detectDown() then
  31.         turtle.digDown()
  32.     end
  33.     if not turtle.down() then
  34.         sleep(0.1)
  35.         mineDown()
  36.     end
  37. end
  38.  
  39. local function turnLeft() repeat until turtle.turnLeft() end
  40. local function turnRight() repeat until turtle.turnRight() end
  41.  
  42. for z = 1, depth do
  43.     mineForward()
  44.     turnLeft()
  45.     for y = 1, height - 1 do
  46.         if turtle.detect() then
  47.             turtle.dig()
  48.         end
  49.         mineUp()
  50.     end
  51.     if turtle.detect() then
  52.         turtle.dig()
  53.     end
  54.     turnRight()
  55.     mineForward()
  56.     turnLeft()
  57.     if turtle.detect() then
  58.         turtle.dig()
  59.     end
  60.     for y = 1, height - 1 do
  61.         mineDown()
  62.         if turtle.detect() then
  63.             turtle.dig()
  64.         end
  65.     end
  66.     turnRight()
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement