koriar

digtunnel

Dec 31st, 2020 (edited)
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.43 KB | None | 0 0
  1. local tArgs = { ... }
  2. if #tArgs ~= 1 then
  3.     print( "Usage: digtunnel <length>" )
  4.     return
  5. end
  6.  
  7. -- mine just enough for a person
  8. local size = tonumber( tArgs[1] )
  9. local pos = -1
  10. -- its -1 to fix the position... it will technically mine one too far
  11.  
  12. turtle.up()
  13.  
  14. while pos < size do
  15.     turtle.dig()
  16.     turtle.digDown()
  17.     turtle.forward()
  18.     pos = pos + 1
  19. end
  20.  
  21. -- return
  22. while pos > 0 do
  23.     turtle.back()
  24.     pos = pos - 1
  25. end
  26.  
Add Comment
Please, Sign In to add comment