Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- REFUEL PROGRAM --
- -- Config
- local areaRefuel = false -- Refuels in an area (useful for lava lakes)
- -- Variables
- local lenghtCount = 0;
- local widthCount = 0;
- local bucket = false;
- -- Functions
- local function clc(x,y,bc,tc)
- x = x or 1;
- y = y or 1;
- bc = bc or colors.black;
- tc = tc or colors.white;
- term.setCursorPos(x,y);
- term.setBackgroundColor(bc);
- term.setTextColor(tc);
- term.clear();
- end
- -- STARTUP
- textutils.slowPrint("Welcome to the refueler program by TheDarkray",40);
- sleep(0.4);
- while (bucket == false) do
- clc(1,1,colors.white,colors.black);
- print("Please insert an empty bucket in slot 1 (top left)");
- local item = turtle.getItemDetail(1);
- print("If you inserted the bucket press enter to continue.");
- io.read();
- if (item.name == "minecraft:bucket") then
- break;
- end
- end
- clc(1,1,colors.white,colors.black);
- print("Please insert the distance to cover: ");
- local length = io.read();
- length = tonumber(length);
- if (areaRefuel) then
- print("Please insert the width to cover: ");
- local width = io.read();
- length = tonumber(width);
- end
- -- MAIN PROGRAM
- turtle.forward();
- turtle.select(1);
- if (areaRefuel) then
- for i = 0, math.ceil(width/2) do
- for i = 0, length do
- turtle.attack();
- turtle.placeDown();
- turtle.refuel();
- turtle.forward();
- turtle.dig();
- end
- turtle.turnLeft(); turtle.back(); turtle.turnLeft();
- for i = 0, length do
- turtle.attack();
- turtle.placeDown();
- turtle.refuel();
- turtle.forward();
- turtle.dig();
- end
- turtle.turnLeft();
- turtle.forward();
- turtle.turnLeft();
- end
- turtle.turnLeft();
- for i = 0, width do
- turtle.placeDown();
- turtle.refuel();
- turtle.forward();
- turtle.dig();
- end
- turtle.turnRight();
- else
- for i = 0, length do
- turtle.attack();
- turtle.dig();
- turtle.forward();
- turtle.placeDown();
- turtle.refuel();
- end
- turtle.turnLeft(); turtle.back(); turtle.turnLeft();
- for i = 0, length do
- turtle.attack();
- turtle.placeDown();
- turtle.refuel();
- turtle.forward();
- turtle.dig();
- end
- turtle.turnRight();
- turtle.placeDown();
- turtle.refuel();
- turtle.forward();
- turtle.dig();
- turtle.turnRight();
- end
- turtle.back();
- clc(1,1,colors.white,colors.black);
- print("REFUELING COMPLETE");
- print("FUEL LEVEL: "..turtle.getFuelLevel().."/"..turtle.getFuelLimit());
- sleep(1);
- clc();
Advertisement
Add Comment
Please, Sign In to add comment