Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local fuelSlot = 1
- local floorWireID = "chisel:factory"
- local floorWires = {
- 2;
- }
- local floorSideID = "chisel:technicalnew"
- local floorSide = {
- 3;
- 4;
- }
- local floorMainID = "chisel:laboratory"
- local floorMain = {
- 5;
- 6;
- }
- local wallsID = "chisel:laboratory"
- local walls = {
- 9;
- 10;
- 11;
- 12;
- 13;
- 14;
- 15;
- 16;
- }
- local IECNET = false
- -- end of config
- local args = {...}
- function refuel()
- if(turtle.getFuelLevel() < 5) then
- turtle.select(fuelSlot)
- if(turtle.refuel(1) == false) then
- error("out of fuel")
- end
- end
- end
- --digs the block infront
- function digForward()
- while(turtle.dig()) do
- end
- end
- --digs the block below
- function digDown()
- while(turtle.digDown()) do
- end
- end
- --digs the block above
- function digUp()
- while(turtle.digUp()) do
- end
- end
- function placeWalls()
- for i=1, #walls do
- turtle.select(walls[i])
- if(turtle.getItemCount() > 0) then
- if(turtle.getItemDetail().name == wallsID) then
- while(not turtle.place()) do
- digForward()
- end
- return true
- end
- end
- end
- return false
- end
- function placeWallsUp()
- for i=1, #walls do
- turtle.select(walls[i])
- if(turtle.getItemCount() > 0) then
- if(turtle.getItemDetail().name == wallsID) then
- while(not turtle.placeUp()) do
- digDown()
- end
- return true
- end
- end
- end
- return false
- end
- function placeFloorWire()
- for i=1, #floorWires do
- turtle.select(floorWires[i])
- if(turtle.getItemCount() > 0) then
- if(turtle.getItemDetail().name == floorWireID) then
- while(not turtle.placeDown()) do
- digDown()
- end
- return true
- end
- end
- end
- return false
- end
- function placeFloorSide()
- for i=1, #floorSide do
- turtle.select(floorSide[i])
- if(turtle.getItemCount() > 0) then
- if(turtle.getItemDetail().name == floorSideID) then
- while(not turtle.placeDown()) do
- digDown()
- end
- return true
- end
- end
- end
- return false
- end
- function placeFloorMain()
- for i=1, #floorMain do
- turtle.select(floorMain[i])
- if(turtle.getItemCount() > 0) then
- if(turtle.getItemDetail().name == floorMainID) then
- while(not turtle.placeDown()) do
- digDown()
- end
- return true
- end
- end
- end
- return false
- end
- function goForward()
- digForward()
- turtle.forward()
- digUp()
- digDown()
- refuel()
- end
- function turn()
- turtle.turnRight()
- turtle.turnRight()
- end
- function move(dist)
- for i=2,dist,1 do
- turtle.forward()
- refuel()
- end
- end
- function floorPlaceOneDirection()
- goForward()
- placeFloorWire()
- goForward()
- placeFloorSide()
- goForward()
- placeFloorMain()
- goForward()
- placeFloorMain()
- digForward()
- end
- function tunnel()
- --assumes the turtle is in the middle on the floor
- refuel()
- digForward()
- turtle.forward()
- digUp()
- digDown()
- placeFloorWire()
- turtle.turnRight()
- floorPlaceOneDirection()
- placeWalls()
- turn()
- move(5)
- floorPlaceOneDirection()
- placeWalls()
- refuel()
- for i=1,3,1 do
- digUp()
- turtle.up()
- digForward()
- placeWalls()
- end
- digUp()
- placeWallsUp()
- turn()
- refuel()
- for i=2,9,1 do
- goForward()
- placeWallsUp()
- end
- digForward()
- placeWalls()
- for i=1,2,1 do
- digDown()
- turtle.down()
- digForward()
- placeWalls()
- end
- refuel()
- turtle.down()
- turn()
- refuel()
- move(5)
- turtle.turnRight()
- end
- local iterations = 1
- if(not(args[1] == nil)) then
- iterations = args[1]
- end
- print("starting")
- for i=1,iterations,1 do
- tunnel()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement