Advertisement
guamie

tunneltest

Jan 25th, 2015
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.71 KB | None | 0 0
  1. --tunneltest   
  2.  
  3.     --even easier tunnel.  is always 3 for now, and always go 10
  4.             --FUNCTIONS
  5.              
  6.             -- Ensure turtle goes up
  7.             function goUp()
  8.                     while not turtle.up() do
  9.                             upDig()
  10.                     end
  11.             end
  12.                  
  13.             --Ensure turtle goes down
  14.             function goDown()
  15.                     while not turtle.down() do
  16.                             downDig()
  17.                     end
  18.             end
  19.                  
  20.             -- Ensure turtle moves forward
  21.             function goForward()
  22.                     while not turtle.forward() do
  23.                             forwardDig()
  24.                     end
  25.             end
  26.                  
  27.     Dirt=1
  28.     Cobblestone=2
  29.     CobblestoneZ=64
  30.     Length=10
  31.      
  32.     function VoidAhead()
  33.             turtle.select(Dirt)
  34.             turtle.place()
  35.             turtle.dig()
  36.     end
  37.      
  38.     function VoidAbove()
  39.             turtle.select(Cobblestone)
  40.             turtle.placeUp()
  41.             CobblestoneZ=CobblestoneZ-1
  42.     end
  43.      function VoidAbove2()
  44.             turtle.select(Cobblestone)
  45.             turtle.placeUp()
  46.             turtle.digUp()
  47.     end    
  48.     goUp()
  49.     goUp()
  50.    
  51. --tunnel ceiling, 10 long...
  52.  
  53.  
  54.     for i=1, Length do
  55.      
  56.             if turtle.detect() == false then
  57.                     VoidAhead()
  58.                     goForward()
  59.                     else if turle.detect() == true then
  60.                     goForward()
  61.             end
  62.     end
  63.      
  64.     if turtle.detectUp() == false then
  65.                     VoidAbove()
  66.     end
  67.     end
  68. for i=1, Length do
  69.     shell.run('go back')
  70. end
  71. shell.run('go down 2')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement