Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- if #args < 2 then print("Usage: tunnel2 side len") os.exit() end
- side = args[1]
- len = tonumber(args[2])
- slot = 1
- if side == "l" then
- sidef=function()
- turtle.turnLeft()
- turtle.place()
- turtle.turnRight()
- end
- elseif side == "r" then
- sidef=function()
- turtle.turnRight()
- turtle.place()
- turtle.turnLeft()
- end
- elseif side == "m" then
- sidef= function() end
- else
- print("ERROR: Side must be l, r, or m!")
- os.exit()
- end
- function check()
- if turtle.getItemCount(slot) == 0 then
- slot = slot + 1
- turtle.select(slot)
- end
- end
- function dig()
- while turtle.detect() do
- turtle.dig()
- sleep(.1)
- end
- end
- for i=1,len do
- check()
- dig()
- turtle.placeDown()
- sidef()
- turtle.up()
- check()
- dig()
- sidef()
- turtle.up()
- check()
- dig()
- turtle.placeUp()
- sidef()
- turtle.down()
- turtle.down()
- turtle.forward()
- end
- for i=1,len do
- turtle.back()
- end
Advertisement
Add Comment
Please, Sign In to add comment