FiddleComputers

Felling turtle

Mar 30th, 2019 (edited)
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.73 KB | None | 0 0
  1. function refuel()
  2.     if turtle.getFuelLevel() < 150 then
  3.         turtle.select(1)
  4.         while turtle.getFuelLevel() < 150 do
  5.             turtle.refuel(1)
  6.         end
  7.     end
  8. end
  9.  
  10. while true do
  11.     refuel()
  12.     if turtle.select(13) and turtle.compareDown() then -- SLOT 13: FORWARD
  13.         turtle.forward()
  14.         refuel()
  15.     elseif turtle.select(14) and turtle.compareDown() then -- SLOT 14: TREE
  16.         turtle.turnRight()
  17.         if turtle.select(2) and turtle.compare() then
  18.             while turtle.compare() do
  19.                 turtle.dig()
  20.                 turtle.digUp()
  21.                 turtle.up()
  22.             end
  23.             turtle.select(14)
  24.             while not turtle.compareDown() do
  25.                 turtle.down()
  26.             end
  27.             refuel()
  28.             turtle.select(4)
  29.             turtle.place()
  30.         end
  31.         turtle.turnLeft()
  32.         turtle.forward()
  33.     elseif turtle.select(15) and turtle.compareDown() then -- SLOT 15: TURN RIGHT
  34.         turtle.turnRight()
  35.         turtle.forward()
  36.         refuel()
  37.     elseif turtle.select(16) and turtle.compareDown() then -- SLOT 16: RECHARGE (See bottom for pattern)
  38.         turtle.turnLeft()
  39.         if turtle.select(2) and turtle.getItemCount() > 1 then
  40.             turtle.drop(64)
  41.             turtle.select(3)
  42.             turtle.drop(64)
  43.             turtle.select(2)
  44.             turtle.suck(1)
  45.             turtle.turnRight()
  46.         end
  47.         turtle.forward()
  48.         turtle.forward()
  49.         turtle.turnLeft()
  50.         if turtle.select(4) and turtle.getItemCount() < 32 then
  51.             while turtle.getItemCount() < 64 and turtle.suck(1) do
  52.                 print("+1")
  53.             end
  54.         end
  55.         turtle.turnRight()
  56.         turtle.forward()
  57.         turtle.forward()
  58.         turtle.turnLeft()
  59.         if turtle.select(1) and turtle.getItemCount() < 64 then
  60.             while turtle.getItemCount() < 64 and turtle.suck(1) do
  61.                 print("Récupération charbon...")
  62.             end
  63.         end
  64.         turtle.turnRight()
  65.         turtle.forward()
  66.         turtle.forward()
  67.         refuel()
  68.     end
  69. end
  70.  
  71. --  COAL        ^
  72. --              |
  73. --  SAPLINGS    |
  74. -- 
  75. --  LOGS        T
  76.  
Add Comment
Please, Sign In to add comment