Guest User

quarry

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