Advertisement
Guest User

dig.lua

a guest
Feb 23rd, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. --START THE TURTLE AT 1,1,1--
  2.  
  3. local length =5-- 53
  4. local width =5-- 20
  5. local height =5-- 12
  6.  
  7. function mineForward(z)--z is the height
  8.     for a = 1, z, 1 do
  9.         turtle.digUp()
  10.         turtle.up()
  11.     end
  12.     turtle.dig()
  13.     turtle.forward()
  14.     for a = z, 1, -1 do
  15.         turtle.digDown()
  16.         turtle.down()
  17.     end
  18.     turtle.dig()
  19.     turtle.forward()
  20. end
  21.  
  22. if width % 2 == 1 then
  23.     width = width + 1
  24.     width = width / 2
  25.  
  26. elseif width % 2 == 0 then
  27.     width = width / 2
  28. end
  29.  
  30. for y = 1, length,1 do --y is the length
  31.     for x = 1, width, 1 do--x is the x width
  32.         mineForward(height)
  33.         if(x % 2 == 1 and x == width)  then
  34.             turtle.back()
  35.             turtle.turnLeft()
  36.             turtle.forward()
  37.             turtle.turnLeft()
  38.         elseif(x % 2 == 0 and x == width) then
  39.             turtle.back()
  40.             turtle.turnRight()
  41.             turtle.forward()
  42.             turtle.turnRight()
  43.         end
  44.     end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement