Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 3x3 Tunnel and Block Placer --
- --[[
- This program creates a 3x3 tunnel with
- specifc blocks.
- --]]
- -- Configuration --
- local length = 21 -- Do not set more than 21 blocks
- --Fuction Definitions --
- local function digCenterLine() --Digs Centerline of Tunnel
- 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 placeSideBlock(block)
- digCenterLine()
- if not turtle.detectDown() then
- turtle.select(block)
- turtle.placeDown()
- end
- if not turtle.detectUp() then
- turtle.select(block)
- turtle.placeUp()
- end
- turtle.back()
- turtle.select(block)
- turtle.place()
- end
- local function placeBottomBlock()
- if turtle.detectDown() then
- turtle.digDown()
- os.sleep(0.5)
- end
- turtle.select(3)
- turtle.placeDown()
- end
- local function placeTopBlock()
- if turtle.detectUp() then
- turtle.digUp()
- os.sleep(0.5)
- end
- turtle.select(4)
- turtle.placeUp()
- end
- local function digTunnel()
- digCenterLine()
- turtle.turnLeft()
- digCenterLine()
- placeSideBlock(1)
- turnAround()
- turtle.forward()
- digCenterLine()
- placeSideBlock(2)
- turnAround()
- turtle.down()
- placeBottomBlock()
- turtle.forward()
- placeBottomBlock()
- turtle.forward()
- placeBottomBlock()
- turnAround()
- turtle.up()
- turtle.up()
- placeTopBlock()
- turtle.forward()
- placeTopBlock()
- turtle.forward()
- placeTopBlock()
- turnAround()
- turtle.forward()
- turtle.down()
- turtle.turnRight()
- end
- -- Program --
- turtle.up()
- for i=0, length - 1 do
- digTunnel()
- if i % 7 == 0 then
- turtle.up()
- turtle.digUp()
- turtle.select(5)
- turtle.placeUp()
- turtle.down()
- end
- end
- turtle.down()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement