Advertisement
guamie

tunnel10

Jan 21st, 2015
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.81 KB | None | 0 0
  1. --tunnel10 
  2.  
  3.                    
  4.      
  5.         --VARIABLES
  6.         --CobblestoneCounter
  7.                 cslot = 1
  8.                 turtle.select(cslot)
  9.          
  10.         --FUNCTIONS
  11.          
  12.         -- Ensure turtle goes up
  13.         function goUp()
  14.                 while not turtle.up() do
  15.                         upDig()
  16.                 end
  17.         end
  18.              
  19.         --Ensure turtle goes down
  20.         function goDown()
  21.                 while not turtle.down() do
  22.                         downDig()
  23.                 end
  24.         end
  25.              
  26.         -- Ensure turtle moves forward
  27.         function goForward()
  28.                 while not turtle.forward() do
  29.                         forwardDig()
  30.                 end
  31.         end
  32.              
  33.         -- Dig forward
  34.         function forwardDig()
  35.                 while turtle.detect() do
  36.                         turtle.dig()
  37.                 end
  38.         end
  39.              
  40.         -- Dig up
  41.         function upDig()
  42.                 while turtle.detectUp() do
  43.                         turtle.digUp()
  44.                 end
  45.         end
  46.              
  47.         -- Dig Down
  48.         function downDig()
  49.                 turtle.digDown()
  50.         end
  51.                                
  52.         --Place Cobblestone Below
  53.         function placeCobblestoneDown()
  54.                 turtle.select(cslot)
  55.                 turtle.placeDown()
  56.                 CounterCobblestone()
  57.         end
  58.          
  59.         --Place Cobblestone Regularly
  60.         function placeCobblestone()
  61.                 turtle.select(cslot)
  62.                 turtle.place()
  63.                 CounterCobblestone()
  64.         end
  65.          
  66.         --Place Cobblestone Above
  67.         function placeCobblestoneUp()
  68.                 turtle.select(cslot)
  69.                 turtle.placeUp()
  70.                 CounterCobblestone()
  71.         end
  72.          
  73.         --Counts stacks of cobble
  74.         function CounterCobblestone()
  75.                 while turtle.getItemCount(cslot) < 1 do
  76.                         cslot = (cslot%13)+1
  77.                 end    
  78.         end
  79.          
  80.         --Place Cobblestone Below and then move forward
  81.         function CobbleDForward()
  82.                 placeCobblestoneDown()
  83.                 goForward()
  84.         end
  85.  
  86.  
  87. --Clearing our 3x1 section for tunnel      
  88.  
  89. function UpandDown()
  90.     turtle.digUp()
  91.     turtle.digDown()
  92. end
  93.  
  94. -- Variables, X is movement, Y is slot, Z is usage of slot
  95. x=0
  96. y=1
  97. z=0
  98. turtle.select(y)
  99. goUp()
  100. goUp()
  101. goUp()
  102. -- We need to build a ceiling to avoid floods
  103. while x < 10
  104. if not turtle.detectUp()
  105. turtle.placeUp()
  106. goForward()
  107. z=z+1
  108. else
  109. sleep(.1)
  110. goForward()
  111. end
  112. x=x+1
  113. end
  114. end
  115. while x > 0
  116. turtle.back()
  117. goDown()
  118. goDown()
  119. goDown()
  120. x=0
  121. turtle.up()
  122. while x < 10 do
  123.  goForward()
  124.     UpandDown()
  125. x +1
  126. end
  127.  
  128. while x > 0  do
  129. turtle.back()
  130. end
  131. turtle.down()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement