Advertisement
FiddleComputers

Felling turtle program

Jan 18th, 2019
1,783
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.39 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
  13.         turtle.forward()
  14.         refuel()
  15.     elseif turtle.select(14) and turtle.compareDown() then
  16.         if turtle.turnRight() and turtle.select(2) and turtle.compare() then
  17.             while turtle.compare() do
  18.                 turtle.dig()
  19.                 turtle.digUp()
  20.                 turtle.up()
  21.             end
  22.             turtle.select(14)
  23.             while not turtle.compareDown() do
  24.                 turtle.down()
  25.             end
  26.             refuel()
  27.             turtle.select(4)
  28.             turtle.place()
  29.         else
  30.             turtle.turnLeft()
  31.         end
  32.     elseif turtle.select(15) and turtle.compareDown() then
  33.         turtle.turnLeft()
  34.         turtle.forward()
  35.         refuel()
  36.     elseif turtle.select(16) and turtle.compareDown() then
  37.         if turtle.turnRight() and turtle.select(4) and turtle.getItemCount() < 32 then
  38.             while turtle.getItemCount() < 64 do
  39.                 turtle.suck(1)
  40.             end
  41.         end
  42.         turtle.turnLeft()
  43.         if turtle.select(1) and turtle.getItemCount() < 64 then
  44.             while turtle.getItemCount() < 64 and turtle.suck(1) do
  45.                 print("Récupération charbon...")
  46.             end
  47.         end
  48.         if turtle.select(2) and turtle.getItemCount() > 1 then
  49.             turtle.up()
  50.             turtle.drop(64)
  51.             turtle.select(3)
  52.             turtle.drop(64)
  53.             turtle.select(2)
  54.             turtle.suck(1)
  55.             turtle.down()
  56.         end
  57.         turtle.turnLeft()
  58.         refuel()
  59.     end
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement