Advertisement
Oysi

DiamondFinder

Mar 17th, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1.  
  2. -- Script made by Oysi
  3.  
  4. local args = {...}
  5.  
  6. local width = tonumber(args[1])
  7. local depth = tonumber(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. local function digForward() if turtle.detect() then turtle.dig() end end
  43. local function digUp() if turtle.detectUp() then turtle.digUp() end end
  44. local function digDown() if turtle.detectDown() then turtle.digDown() end end
  45.  
  46. local function block()
  47.     mineForward()
  48.     digUp()
  49.     digDown()
  50.     turnLeft()
  51.    
  52.     mineForward()
  53.     digUp()
  54.     digDown()
  55.     turnRight()
  56.    
  57.     mineForward()
  58.     digUp()
  59.     digDown()
  60.     turnRight()
  61.    
  62.     mineForward()
  63.     digUp()
  64.     digDown()
  65. end
  66.  
  67. local function strip()
  68.     for x = 1, width do
  69.         mineForward()
  70.         digUp()
  71.         digDown()
  72.     end
  73. end
  74.  
  75. local function side()
  76.     strip()
  77.     mineForward()
  78.     turnRight()
  79.     mineForward()
  80.     turnRight()
  81.     strip()
  82. end
  83.  
  84. for z = 1, depth do
  85.     block()
  86.     turnLeft()
  87.     block()
  88.  
  89.     side()
  90.  
  91.     mineForward()
  92.     mineForward()
  93.  
  94.     side()
  95.  
  96.     mineForward()
  97.     mineForward()
  98.  
  99.     turnLeft()
  100. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement