Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- xCord, yCord, zCord, blockcount, xDCord, yDCord, zDCord = 0,0,0,0,1,1,1;
- local function setxyz()
- print("Warning if you enter values greater than 64 errors are possible");
- io.write("Input X (Forward): ");
- xCord = io.read();
- io.write("Input Z (Right): ");
- zCord = io.read();
- io.write("Input Y (UP): ");
- yCord = io.read();
- print("The expected number of blocks: "..(xCord * yCord * zCord));
- blockcount = xCord * yCord * zCord;
- end
- local function checkFuel()
- if (turtle.getFuelLevel() <= 10) then
- repeat
- io.write("Plase any fuel in grid and press any button");
- io.read();
- turtle.refuel("all");
- until turtle.getFuelLevel() > 10
- end
- print("Fuel level: "..turtle.getFuelLevel());
- end
- local function digingUP()
- for y = 1, yCord - 1 do
- yDCord = y;
- turtle.digUp();
- blockcount = blockcount -1;
- while turtle.up() == false do
- turtle.digUp();
- turtle.attackUp();
- checkFuel();
- end
- checkFuel();
- print(blockcount);
- print(xDCord.."--"..yDCord.."--"..zDCord);
- end
- end
- local function digingDown()
- for y = 1, yCord - 1 do
- yDCord = yDCord - 1;
- turtle.digDown();
- blockcount = blockcount -1;
- while turtle.down() == false do
- turtle.digDown();
- turtle.attackDown();
- checkFuel();
- end
- checkFuel();
- print(blockcount);
- print(xDCord.."--"..yDCord.."--"..zDCord);
- end
- yDCord = 1;
- print(xDCord.."--"..yDCord.."--"..zDCord);
- end
- local function digingXUp()
- for x = 1, xCord do
- xDCord = x;
- if (tonumber(xDCord) == 0) then xDCord = 1; end
- if (yDCord == 1) then
- digingUP();
- else
- digingDown();
- end
- if (x <= xCord - 1) then
- turtle.dig();
- blockcount = blockcount -1;
- while turtle.forward() == false do
- turtle.dig();
- turtle.attack();
- checkFuel();
- end
- print(xDCord.."--"..yDCord.."--"..zDCord);
- checkFuel();
- end
- end
- end
- local function digingXDown()
- for x = 1, xCord do
- xDCord = xDCord - 1;
- if (tonumber(xDCord) == 0) then xDCord = 1; end
- if (yDCord == 1) then
- digingUP();
- else
- digingDown();
- end
- if (x <= xCord - 1) then
- turtle.dig();
- blockcount = blockcount -1;
- while turtle.forward() == false do
- turtle.dig();
- turtle.attack();
- checkFuel();
- end
- if (tonumber(xDCord) == 0) then xDCord = 1; end
- print(xDCord.."--"..yDCord.."--"..zDCord);
- checkFuel();
- end
- end
- end
- local function diging()
- print("Start Diging");
- if (blockcount == 0 or blockcount == 1) then
- return false;
- else
- checkFuel();
- for z = 1, zCord do
- zDCord = z;
- if (z % 2 == 0) then
- digingXDown();
- if (z < tonumber(zCord)) then
- turtle.turnLeft();
- turtle.dig();
- blockcount = blockcount -1;
- while turtle.forward() == false do
- turtle.dig();
- turtle.attack();
- checkFuel();
- end
- turtle.turnLeft()
- checkFuel();
- print(xDCord.."--"..yDCord.."--"..zDCord);
- end
- else
- digingXUp();
- if (z < tonumber(zCord)) then
- turtle.turnRight();
- turtle.dig();
- blockcount = blockcount -1;
- while turtle.forward() == false do
- turtle.dig();
- turtle.attack();
- checkFuel();
- end
- turtle.turnRight();
- checkFuel();
- print(xDCord.."--"..yDCord.."--"..zDCord);
- end
- end
- end
- end
- return true;
- end
- local function backToStartPosition()
- for i = 1, 16 do
- end
- end
- setxyz();
- if (xCord == nil or yCord == nil or zCord == nil) then
- print("Error input data");
- return;
- else
- diging();
- print("Fuel level: "..turtle.getFuelLevel());
- print("Done");
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement