Yobi

Roomdig

Dec 31st, 2012
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. input = {...}
  2. -- x, y, and then z
  3. width = input[1]
  4. depth = input[2]
  5. height = input[3]
  6. startdir = 0
  7. dir = 0
  8.  
  9. function turnright()
  10. turtle.turnRight()
  11. dir = dir + 1
  12. if dir > 4 then
  13.     dir = 0
  14.     end
  15. end
  16.  
  17. function turnleft()
  18. turtle.turnLeft()
  19. dir = dir - 1
  20. if dir < 0 then
  21.     dir = 4
  22.     end
  23. end
  24.  
  25. for i = 1, height do
  26.     for i = 1, width do
  27.         for i = 1, depth - 1 do
  28.             turtle.dig()
  29.             turtle.forward()
  30.             end
  31.  
  32.     turnright()
  33.     turnright()
  34.  
  35.         for i = 1, depth - 1 do
  36.             turtle.forward()
  37.             end
  38.  
  39.     if i ~= tonumber(width) then
  40.         turnleft()
  41.         turtle.dig()
  42.         turtle.forward()
  43.         turnleft()
  44.         end
  45.     end
  46.  
  47. --Height loop kicks in here.
  48.  
  49. turnright()
  50. turnright()
  51. turnleft() -- Does a little dance, I like it so I'm leaving it.
  52.  
  53.     for i = 1, width do
  54.         turtle.forward()
  55.     end
  56.  
  57. turnright()
  58.  
  59.     if i ~= tonumber(height) then
  60.         turtle.digUp()
  61.         turtle.up()
  62.         else
  63.             for i = 1, height do
  64.                 turtle.down()
  65.             end
  66.     end
  67. end
Advertisement
Add Comment
Please, Sign In to add comment