Grochonou

Untitled

Feb 14th, 2026
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. local distance = 10
  2. local delaiAttente = 600
  3.  
  4. -- On force le fuel au départ
  5. turtle.select(16)
  6. turtle.refuel()
  7.  
  8. while true do
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. print("Recolte forcee en cours...")
  12.  
  13. -- 1. Orientation vers la ligne
  14. turtle.turnRight()
  15.  
  16. for i = 1, distance do
  17. -- 2. ACTION DE RECOLTE SANS VERIFICATION
  18. -- On tente de cliquer à gauche, en haut à gauche et en bas à gauche
  19. turtle.turnLeft()
  20.  
  21. turtle.select(1) -- On s'assure d'avoir le slot 1 sélectionné
  22.  
  23. -- On mitraille de clics (Droit et Gauche)
  24. turtle.place() -- Clic droit devant
  25. turtle.attack() -- Clic gauche devant
  26. turtle.placeUp() -- Clic droit en haut (si la plante est grande)
  27. turtle.attackUp()
  28. turtle.placeDown() -- Clic droit en bas
  29. turtle.attackDown()
  30.  
  31. -- On aspire tout ce qui a pu tomber
  32. turtle.suck()
  33. turtle.suckUp()
  34. turtle.suckDown()
  35.  
  36. -- 3. On se remet dans l'axe
  37. turtle.turnRight()
  38.  
  39. -- 4. AVANCER
  40. if i < distance then
  41. -- Si elle refuse d'avancer, c'est qu'il y a un mur
  42. if not turtle.forward() then
  43. print("Obstacle! Tentative de creuser...")
  44. turtle.dig() -- On creuse seulement si c'est bloque
  45. turtle.forward()
  46. end
  47. end
  48. end
  49.  
  50. -- 5. RETOUR AU COFFRE
  51. print("Retour au coffre...")
  52. turtle.turnLeft()
  53. turtle.turnLeft()
  54. for i = 1, distance - 1 do
  55. turtle.forward()
  56. end
  57.  
  58. -- 6. VIDAGE COMPLET
  59. turtle.turnLeft()
  60. turtle.turnLeft()
  61. for s = 1, 15 do
  62. turtle.select(s)
  63. if turtle.getItemCount() > 0 then
  64. turtle.dropDown()
  65. end
  66. end
  67.  
  68. -- Reset position
  69. turtle.turnLeft()
  70.  
  71. print("Cycle fini. Attente 10 min.")
  72. sleep(delaiAttente)
  73. end
Advertisement
Add Comment
Please, Sign In to add comment