Advertisement
Guest User

startup

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