Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- if #tArgs ~= 1 then
- print( "Usage: tunnel_3x3 <length>" )
- return
- end
- -- Mine in a quarry pattern until we hit something we can't dig
- local length = tonumber( tArgs[1] )
- if length < 1 then
- print( "Tunnel length must be positive" )
- return
- end
- if length < 8 then
- print("Tunnel length must be > 8")
- return
- end
- local function tryPlaceDown()
- turtle.select(16)
- turtle.placeDown()
- end
- --[[ ]]
- local sub_length = length
- local ritorno = 0
- turtle.up()
- tryPlaceDown()
- for n=1, sub_length do
- for i=1, 8 do
- turtle.forward()
- sub_length = sub_length - 1
- ritorno = ritorno +1
- end
- tryPlaceDown()
- if sub_length < 8 then
- break
- end
- end
- --[[ ]]
- print( "Returning to start..." )
- -- Return to where we started
- depth = ritorno
- turtle.turnLeft()
- turtle.turnLeft()
- while depth > 0 do
- if turtle.forward() then
- depth = depth - 1
- else
- turtle.dig()
- end
- end
- turtle.forward()
- turtle.down()
- turtle.turnRight()
- turtle.turnRight()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement