Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- get arguments
- local tArgs = { ... }
- if #tArgs ~= 1 then
- print( "Usage: basicTunnel; <Tunnel Length divided by 2>" )
- return
- end
- local tunnelLength = tonumber( tArgs[1] )
- if tunnelLength < 1 then
- print( "Tunnel Length must be positive!" )
- return
- end
- -- function to tunnel 1x3 directly in front moving into new space
- local function digInFront ()
- if turtle.detect() then
- if turtle.dig() then
- turtle.suckDown()
- end
- end
- if turtle.forward() then
- if turtle.detectUp() then
- if turtle.digUp() then
- turtle.suckDown()
- end
- end
- if turtle.detectDown() then
- if turtle.digDown() then
- turtle.suckDown()
- end
- end
- end
- if turtle.back() then
- end
- end
- -- program start
- local done = false
- while not done do
- for n = 0, tunnelLength do
- digInFront()
- turtle.turnRight()
- digInFront()
- digInFront()
- turtle.turnLeft()
- digInFront()
- turtle.turnLeft()
- digInFront()
- digInFront()
- turtle.turnRight()
- end
- done = true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement