Guest User

room

a guest
Jun 25th, 2014
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. local inputs = { ... }
  2.  
  3. local length = tonumber(inputs[1])
  4. local width = tonumber(inputs[2])
  5. local height = tonumber(inputs[3])
  6.  
  7. function tryDig()
  8.   while turtle.detect() do
  9.     turtle.dig()
  10.     sleep(0.1)
  11.   end
  12.   return turtle.forward()
  13. end
  14.  
  15. function digLength(X)
  16.   digX = 0
  17.   while digX < X do
  18.     if tryDig() then
  19.       digX = digX + 1    
  20.     end
  21.   end
  22. end
  23.  
  24. function xyAxis(length, width)
  25. local yAxis = 0
  26.   while yAxis < width do
  27.     digLength(length)
  28.     if (yAxis % 2) == 0 then
  29.       turtle.right()
  30.       tryDig()
  31.       turtle.right()
  32.     else
  33.       turtle.left()
  34.       tryDig()
  35.       turtle.left()
  36.     end
  37.   yAxis = yAxis + 1
  38.   end
  39. end
  40.  
  41. xyAxis(length, width)
Advertisement
Add Comment
Please, Sign In to add comment