Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function GoUp()
- turtle.digUp();
- turtle.up();
- end
- local function GoDown()
- turtle.digDown();
- turtle.down();
- end
- local function GoLeft()
- turtle.turnLeft();
- turtle.dig();
- turtle.forward();
- turtle.turnRight();
- end
- local function GoRight()
- turtle.turnRight();
- turtle.dig();
- turtle.forward();
- turtle.turnLeft();
- end
- local function PlaceTorch()
- turtle.select(1);
- turtle.placeDown();
- end
- local direction = true; -- true = same as start, false = opposite
- local turnBool = true; -- False go left, True go right
- local function TurnAround()
- turtle.turnLeft();
- turtle.turnLeft();
- direction = not direction;
- end
- local function GoToStart(length, width, height, startDirection)
- for i = 1, height do
- if i ~= height then
- GoDown();
- end
- end
- for i = 1, width do
- if i ~= width then
- GoLeft();
- end
- end
- if direction == true then -- True = same as start
- for i = 1, length do
- if i ~= length then
- turtle.back();
- end
- end
- end
- end
- local function checkFuel(length, width, height)
- local neededFuel = (length * 2 * width) * (height * 2);
- if turtle.getFuelLevel() < neededFuel then
- turtle.select(2);
- if turtle.refuel() ~= false then
- turtle.refuel();
- print("Success! Fuel level is " .. turtle.getFuelLevel() .. ". Starting mining...");
- else
- term.clear();
- print("Unable to refuel,\nCurrent fuel is " .. turtle.getFuelLevel() .. "\nNeeded fuel is " .. neededFuel ..
- "\nPlease fill slot 2 with at least " .. ((neededFuel - turtle.getFuelLevel()) / 80) ..
- " Coal.\nor at least " .. (neededFuel / 1000) .. " Lava Buckets.");
- checkFuel(length, width, height);
- end
- end
- end
- local function stripMine(length, width, height)
- local startDirection = turnBool;
- local canStart = false;
- local neededFuel = (length * 2 * width) * (height * 2);
- if turtle.getFuelLevel() < neededFuel then
- checkFuel(length, width, height);
- stripMine(length, width, height);
- else
- for p = 1, height do
- for i = 1, width do -- width
- local t = 0;
- for j = 1, length do -- Length
- if t == 5 and turnBool == true and p == 2 then
- PlaceTorch();
- t = 0;
- end
- turtle.dig();
- turtle.forward();
- t = t + 1;
- end
- if i ~= width then
- if turnBool == true then
- GoRight();
- elseif turnBool == false then
- GoLeft();
- end
- turnBool = not turnBool;
- end
- TurnAround();
- end
- print("New direction: " .. tostring(turnBool) .. " - False left, True right");
- if p ~= height then
- GoUp();
- end
- end
- GoToStart(length, width, height, startDirection);
- end
- end
- stripMine(60, 11, 3);
Add Comment
Please, Sign In to add comment