Guest User

quarry

a guest
Oct 14th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. function forward()
  2.   if turtle.forward() then
  3.    
  4.   else
  5.     while turtle.detect() do
  6.       sleep(1)
  7.     end
  8.     turtle.forward()
  9.   end
  10. end
  11.  
  12. function placeQuarry()
  13.  
  14.   turtle.up();
  15.   turtle.select(1);
  16.   turtle.place();
  17.  
  18.   turtle.down();
  19.   turtle.down();
  20.   turtle.select(2);
  21.   turtle.place();
  22.  
  23.   turtle.select(3);
  24.  
  25.   turtle.transferTo(1,1);
  26.   turtle.transferTo(2,1);
  27.  
  28.   turtle.up()
  29.  
  30.  
  31.   while true do
  32.     p = peripheral.wrap("front");
  33.    
  34.     if p.isActive() ~= "true" then
  35.       break
  36.     else
  37.       sleep(1)
  38.     end
  39.   end
  40.  
  41.   print("Quarry finished")
  42.  
  43.   turtle.select(1);
  44.   turtle.transferTo(3,1);
  45.   turtle.select(2);
  46.   turtle.transferTo(3,1);
  47.  
  48.   turtle.up()  
  49.   turtle.select(1);
  50.   turtle.dig();
  51.  
  52.   turtle.down();
  53.   turtle.down();
  54.   turtle.dig();
  55.  
  56.   turtle.up();
  57.  
  58.   for i=0,8,1 do
  59.      forward()
  60.   end
  61.   sleep(5)
  62. end
  63.  
  64. while true do
  65.   placeQuarry()
  66. end
Advertisement
Add Comment
Please, Sign In to add comment