SHARE
TWEET

Untitled

a guest Jun 16th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- get arguments
  2.  
  3. local tArgs = { ... }
  4. if #tArgs ~= 1 then
  5.     print( "Usage: basicTunnel; <Tunnel Length divided by 2>" )
  6.     return
  7. end
  8.  
  9. local tunnelLength = tonumber( tArgs[1] )
  10. if tunnelLength < 1 then
  11.     print( "Tunnel Length must be positive!" )
  12.     return
  13. end
  14.  
  15. -- function to tunnel 1x3 directly in front moving into new space
  16.  
  17. local function digInFront ()
  18.  
  19.     if turtle.detect() then
  20.         if turtle.dig() then
  21.             turtle.suckDown()
  22.         end
  23.     end
  24.    
  25.     if turtle.forward() then
  26.  
  27.         if turtle.detectUp() then
  28.             if turtle.digUp() then
  29.                 turtle.suckDown()
  30.             end
  31.         end
  32.        
  33.         if turtle.detectDown() then
  34.             if turtle.digDown() then
  35.                 turtle.suckDown()
  36.             end
  37.         end
  38.     end
  39.    
  40.     if turtle.back() then
  41.     end
  42. end
  43.  
  44. -- program start
  45.  
  46. local done = false
  47.  
  48. while not done do
  49.     for n = 0, tunnelLength do
  50.    
  51.         digInFront()
  52.         turtle.turnRight()
  53.         digInFront()
  54.         digInFront()
  55.         turtle.turnLeft()
  56.        
  57.         digInFront()
  58.         turtle.turnLeft()
  59.         digInFront()
  60.         digInFront()
  61.         turtle.turnRight()
  62.     end
  63.     done = true
  64. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top