Toastbrot5561

ComputerCraft Boneless Turtle Treefarm

Feb 24th, 2021 (edited)
1,244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.46 KB | None | 0 0
  1. -- Funktionen
  2. -- Turtle Setup: (w Emtyp,c colored wool, s Setzlinge)
  3. -- wwww
  4. -- wwww
  5. -- wwww
  6. -- wwsc
  7. -- Welt: links Wolle,Hinten truhe,Unten truhe setzlinge, rechts setzlinge-farm Reihe,
  8. function checkFuel()
  9.     if(turtle.getFuelLevel()<250) then
  10.         turtle.select(2);
  11.         turtle.refuel(10);
  12.     end
  13. end
  14.  
  15. function checkRotation()
  16.     for i = 0,4,1 do
  17.         turtle.turnLeft();
  18.         turtle.select(16);
  19.         if turtle.compare() then
  20.             turtle.turnRight();
  21.             return true;
  22.         end
  23.     end
  24.     return fales;
  25.  end
  26.  function searchRotation()
  27.         for i = 0,4,1 do
  28.         turtle.turnLeft();
  29.         turtle.forward();
  30.         if checkRotation() then
  31.             return true;
  32.         end
  33.         turtle.back();
  34.     end
  35.  end
  36.  function pickupSetzlinge()
  37.      turtle.select(15);
  38.      turtle.turnRight();
  39.      turtle.suck();
  40.      turtle.forward();
  41.      for i=1,4,1 do
  42.         turtle.turnRight();
  43.         turtle.suck();
  44.      end
  45.      turtle.back();
  46.      turtle.turnLeft();
  47. end
  48.  function dumpInventory()
  49.     for i = 3,14,1 do
  50.         turtle.select(i);
  51.         turtle.drop();
  52.     end
  53.  end
  54.  function Resupply()
  55.     turtle.turnLeft();
  56.     turtle.turnLeft();
  57.  
  58.     dumpInventory();
  59.     turtle.select(15);
  60.     turtle.suckDown();
  61.  
  62.     turtle.turnLeft();
  63.     turtle.turnLeft();
  64.  
  65.  end
  66.  function CheckTree()
  67.     turtle.turnRight();
  68.     turtle.select(1);
  69.     if turtle.compare() then
  70.         FarmTree();
  71.     end
  72.     turtle.select(15);
  73.     turtle.place();        
  74.     turtle.turnLeft();
  75.  end
  76.  function FarmTree()
  77.     turtle.select(1);
  78.     for i = 0,10,1 do
  79.        if turtle.compare() then
  80.           turtle.dig();
  81.           turtle.digUp();
  82.           turtle.up();
  83.        end
  84.        if turtle.compare()==false then
  85.            break;
  86.        end
  87.     end
  88.     for i = 0,10,1 do
  89.         turtle.down();
  90.     end
  91.            
  92.  end
  93.  
  94.  -- Program Start
  95.  while(turtle.down()) do
  96.     end
  97.  searchRotation();
  98.  turtle.select(2);
  99.  checkFuel();
  100.  while(turtle.back()) do
  101.     turtle.refuel();
  102.  end
  103.  Resupply();
  104.  while(true) do
  105.      turtle.select(2);
  106.      while(turtle.forward()) do
  107.         turtle.select(15);
  108.         pickupSetzlinge();
  109.         turtle.forward();      
  110.         turtle.select(2);
  111.         checkFuel();
  112.         CheckTree();
  113.         turtle.forward();
  114.         sleep(20);
  115.  
  116.      end
  117.      while(turtle.back()) do
  118.          turtle.select(2);
  119.          checkFuel();
  120.      end
  121.      Resupply();
  122.     print("sleeping");
  123.      for i =0,100,1 do
  124.         print(".");
  125.         sleep(10);
  126.      end
  127. end
  128.    
  129.            
  130.    
Add Comment
Please, Sign In to add comment