Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 3x3 Tunnel by dillmo --
- --[[
- This program creates a 3x3 lit-up tunnel for as far as you want. To run
- this program, place your turtle on the bottom row of the middle column of
- your tunnel wall. Then, place torches in the turtle's first inventory
- slot and cobblestone is the second slot. Before running the program, be
- sure to configure the program to meet your needs.
- --]]
- -- Configuration --
- local length = 61 -- The length of the tunnel
- -- Function Definitions --
- local function digVerticalLine()
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- while turtle.detectUp() do
- turtle.digUp()
- os.sleep(0.5)
- end
- turtle.digDown()
- end
- local function turnAround()
- turtle.turnRight()
- turtle.turnRight()
- end
- local function checkForHoles()
- turtle.down()
- if not turtle.detectDown() then
- turtle.select(2)
- turtle.placeDown()
- end
- turtle.up()
- end
- local function digIntoWall()
- digVerticalLine()
- checkForHoles()
- turtle.turnLeft()
- digVerticalLine()
- checkForHoles()
- turnAround()
- turtle.forward()
- digVerticalLine()
- checkForHoles()
- turnAround()
- turtle.forward()
- turtle.turnRight()
- end
- -- Program --
- turtle.up()
- for i=0, length - 1 do
- digIntoWall()
- if i % 5 == 0 then
- turtle.select(1)
- turtle.placeDown()
- end
- end
Add Comment
Please, Sign In to add comment