Advertisement
Guest User

Tunnel Draft Three

a guest
Mar 31st, 2012
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. local tArgs = { ... }
  2. if #tArgs ~= 1 then
  3.     print( "Usage: tunnel <width>" )
  4.     return
  5. end
  6. local width = tonumber( tArgs[1] )
  7. if width < 1 then
  8.     print( "Tunnel Width must be positive" )
  9.     return
  10. end
  11.  
  12. local move = 0
  13.        
  14. print("Tunnelling...")
  15. loop = 1
  16. while loop == 1 do
  17.     move = width
  18.  
  19.     --Start
  20.     if turtle.detect() then
  21.         turtle.dig()
  22.         turtle.forward()
  23.     else
  24.         turtle.forward()
  25.     end
  26.     turtle.turnLeft
  27.    
  28.     --Side Movement
  29.     while move > 0 do
  30.         if turtle.detectDown() then
  31.             turtle.digDown()
  32.         end
  33.         if turtle.detect() then
  34.             turtle.dig()
  35.             turtle.forward()
  36.             move = move - 1
  37.         else
  38.             turtle.forward()
  39.             move = move - 1
  40.         end
  41.     end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement