Advertisement
Guest User

qr

a guest
Apr 18th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1. quarry = peripheral.wrap("front")
  2.  
  3. move = 10
  4.  
  5. function bdig()
  6.   while turtle.detect() do
  7.    
  8.     turtle.dig()
  9.  
  10.   end
  11. end
  12.  
  13. function buildUp()
  14.  
  15.   moveToQuarry()
  16.  
  17.   turtle.turnLeft()
  18.   bdig()
  19.   turtle.forward()
  20.   turtle.select(3)
  21.   turtle.placeDown()
  22.   turtle.back()
  23.   turtle.select(1)
  24.   turtle.place()
  25.  
  26.  
  27.   turtle.digUp()
  28.   turtle.up()
  29.   bdig()
  30.   turtle.select(2)
  31.   turtle.place()
  32.  
  33.   turtle.down()
  34.  
  35.   turtle.turnLeft()
  36.  
  37.   moveToQuarry()
  38.  
  39.   turtle.select(1)
  40.   turtle.dropUp()
  41.   turtle.turnRight()
  42.   bdig()
  43.  
  44.   turtle.turnRight()
  45.   moveToQuarry()
  46.   turtle.turnLeft()
  47.  
  48. end
  49.  
  50.  
  51. function moveToQuarry()
  52.  
  53.   for i = 0, move do
  54.    
  55.     if turtle.detect() then
  56.      
  57.       bdig()
  58.    
  59.     end
  60.    
  61.     if turtle.detectUp() then
  62.      
  63.       turtle.digUp()
  64.      
  65.     end  
  66.    
  67.     turtle.forward()
  68.    
  69.   end
  70.  
  71.  
  72. end
  73.  
  74. function buildDown()
  75.  
  76.   bdig()
  77.   turtle.down()
  78.  
  79.   turtle.turnRight()
  80.  
  81.  
  82. end
  83.  
  84. function routine()
  85.  
  86.   quarry = peripheral.wrap("front")
  87.  
  88.   while true do
  89.  
  90.     while (quarry.hasWork()) do
  91.    
  92.       os.sleep(5)
  93.  
  94.     end
  95.    
  96.     turtle.up()
  97.    
  98.     for i = 2, 16 do
  99.    
  100.      
  101.       if not (i == 3) then
  102.      
  103.         turtle.select(i)
  104.         turtle.drop()
  105.        
  106.       end
  107.        
  108.     end
  109.    
  110.     turtle.select(2)
  111.  
  112.     buildDown()
  113.    
  114.     buildUp()
  115.    
  116.   end
  117.  
  118. end
  119.  
  120. if not quarry then
  121.  
  122.   buildUp()  
  123.   quarry = peripheral.wrap("front")
  124.   routine()
  125.  
  126. else
  127.  
  128.   routine()
  129.  
  130. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement