Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 3x3 Tunnel digger script for ComputerCraft turtle by Scott 'Satscape' Hather - www.satscape.info
- -- Place the turtle at the front left of where you want the 3x3xinfinte tunnel (and facing it)
- -- Place a chest directly behind it
- -- Place torches in the bottom right slot (one stack will last 640 metres)
- -- Place coal/lava etc in first slot
- -- It will empty itself into the chest at regular intervals and embed torches in the tunnel walls! (only works with latest CC - requires modifying to work with turtles with 9 slots)
- if turtle.getItemCount(16) == 0 then
- print("Place some torches in the last slot");
- os.sleep(10);
- os.reboot();
- end
- if turtle.getFuelLevel()==0 then
- turtle.select(1);
- local ok=turtle.refuel();
- if not ok then
- print("Place some fuel into first slot");
- os.sleep(10);
- os.reboot();
- end
- end
- distanceFromChest=0;
- distanceWere=0;
- function digAndMove()
- while (turtle.detect()) do
- turtle.dig(); os.sleep(1);
- end
- turtle.forward();
- end
- function digAndMoveUp()
- while (turtle.detectUp()) do
- turtle.digUp(); os.sleep(1);
- end
- turtle.up();
- end
- while (turtle.getItemCount(16) >0) do
- print("Diggy Diggy hole, got "..turtle.getFuelLevel().." fuel left.");
- distanceFromChest=distanceFromChest + 1;
- digAndMove(); -- bottom left
- turtle.turnRight();
- digAndMove(); -- bottom centre
- digAndMove(); -- bottom right
- turtle.turnLeft();
- digAndMoveUp(); -- centre right
- turtle.turnLeft();
- digAndMove(); -- centre centre
- digAndMove(); -- centre left
- if distanceFromChest % 10 == 1 then
- turtle.dig();
- turtle.select(16);
- turtle.place(); -- place the torch embedded in tunnel
- end
- turtle.turnRight();
- digAndMoveUp(); -- top left
- turtle.turnRight();
- digAndMove(); -- top centre
- digAndMove(); -- top right
- turtle.turnLeft();
- turtle.turnLeft();
- turtle.forward(); turtle.forward();
- turtle.turnRight();
- turtle.down();
- turtle.down();
- if distanceFromChest % 50 ==0 then -- time to empty our stuff
- distanceWere=distanceFromChest;
- turtle.turnLeft(); turtle.turnLeft();
- while distanceFromChest > 0 do
- turtle.forward();
- distanceFromChest = distanceFromChest - 1;
- end
- os.sleep(1);
- for slot=1, 15, 1 do
- turtle.select(slot);
- turtle.drop();
- end
- os.sleep(1);
- turtle.turnLeft(); turtle.turnLeft();
- while distanceWere > 0 do
- turtle.forward();
- distanceWere = distanceWere - 1;
- distanceFromChest = distanceFromChest + 1;
- end
- end
- end
- print("Ending tunnel2 script");
- os.sleep(10);
- os.reboot(); -- reboots until you place torches in last slot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement