Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- width = args[1];
- length = args[2];
- height = args[3];
- if width==nil then
- error("Width not specified");
- end
- if length==nil then
- error("Length not specified");
- end
- if height==nil then
- error("Height not specified");
- end
- turtle.turnRight();
- for i=0, width/2-1, 1 do
- --Assuming that we were put in the centre of one side of the bottom of the cube
- -- move to the side of the cube to start.
- turtle.dig();
- while not turtle.forward() do
- turtle.dig()
- end
- end
- turtle.turnLeft();
- function mineRow(num)
- for i=0, num, 1 do
- print("depth = " .. i);
- --Dig infront of you.
- while turtle.detect() do
- turtle.dig()
- end
- --dig infront of you if you can't move forward.
- while not turtle.forward() do
- turtle.dig()
- end
- end
- end
- function digPlane(x, y)
- for i=0, y, 1 do
- print("width = " .. i);
- --Mine 1 row
- mineRow(x/2);
- turtle.turnLeft();
- --Else turn around and get ready for the next one.
- mineRow(0);
- turtle.turnLeft();
- --Mine 1 row
- mineRow(x/2);
- turtle.turnRight();
- --Exit if we've finished this area.
- i = i + 1
- print("width = " .. i);
- if tonumber(i+1) >= tonumber(y) then
- break
- end
- --Mine column a little
- mineRow(0);
- turtle.turnRight();
- end
- --Turn around and get ready for the next plane.
- turtle.turnRight();
- mineRow(1);
- end
- function digCube(x, y, z)
- print(x)
- print(y)
- print(z)
- for i=0, z, 1 do
- print("height = " .. i);
- digPlane(x, y);
- --Dig above you
- while turtle.detectUp() do
- turtle.digUp()
- end
- --Move up
- while not turtle.up() do
- turtle.digUp()
- end
- end
- end
- digCube(length, width, height);
Advertisement
Add Comment
Please, Sign In to add comment