Griffork

ClearCube v0.6.9

May 24th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. args = {...}
  2. width = args[1];
  3. length = args[2];
  4. height = args[3];
  5.  
  6. if width==nil then
  7.     error("Width not specified");
  8. end
  9. if length==nil then
  10.     error("Length not specified");
  11. end
  12. if height==nil then
  13.     error("Height not specified");
  14. end
  15.  
  16. turtle.turnRight();
  17. for i=0, width/2-1, 1 do
  18.     --Assuming that we were put in the centre of one side of the bottom of the cube
  19.     -- move to the side of the cube to start.
  20.     turtle.dig();
  21.         while not turtle.forward() do
  22.             turtle.dig()
  23.         end
  24.     turtle.turnLeft();
  25. end
  26.  
  27.  
  28. function mineRow(num)
  29.     for i=0, num, 1 do
  30.     --Dig infront of you.
  31.         while turtle.detect() do
  32.             turtle.dig()
  33.         end
  34.     --dig infront of you if you can't move forward.
  35.         while not turtle.forward() do
  36.             turtle.dig()
  37.         end
  38.     end
  39. end
  40.  
  41. function digPlane(x, y)
  42.     for i=0, y, 1 do
  43.         --Mine 1 row
  44.         mineRow(x/2);
  45.         turtle.turnLeft();
  46.         --Else turn around and get ready for the next one.
  47.         mineRow(0);
  48.         turtle.turnLeft();
  49.         --Mine 1 row
  50.         mineRow(x/2);
  51.         turtle.turnRight();
  52.         --Exit if we've finished this area.
  53.         if i+1 >= y then
  54.             break
  55.         end
  56.         --Mine column a little
  57.         mineRow(0);
  58.         turtle.turnRight();
  59.     end
  60.     --Turn around and get ready for the next plane.
  61.     turtle.turnLeft();
  62. end
  63.  
  64. function digCube(x, y, z)
  65.     for i=0, z, 1 do
  66.         digPlane(x, y);
  67.         --Dig above you
  68.             while turtle.detectUp() do
  69.                 turtle.digUp()
  70.             end
  71.         --Move up
  72.             while not turtle.up() do
  73.                 turtle.digUp()
  74.             end
  75.     end
  76. end
  77.  
  78. digCube(length, width, height);
Advertisement
Add Comment
Please, Sign In to add comment