Advertisement
KiLLerBoy_001

Untitled

Jan 15th, 2025 (edited)
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.82 KB | None | 0 0
  1. print("Loading Tree Feller by: KiLLerBoy_001")
  2. sleep(0.1)
  3. print("..")
  4. sleep(0.1)
  5. print("..")
  6. sleep(0.1)
  7. print("..")
  8. sleep(0.1)
  9. print("..")
  10. sleep(0.5)
  11. print("Tree Feller loaded..")
  12.  
  13. cnt = 0
  14.  
  15. function RefuelCheck()
  16.     fuel = turtle.getFuelLevel()
  17.     if fuel < 1000 then
  18.         turtle.refuel()
  19.     else
  20.         print("No need to refuel")
  21.         print("Fuel Level="..fuel)
  22.     end
  23. end
  24.  
  25. function ChopDetect()
  26.     if turtle.detect() then
  27.         turtle.dig()
  28.         print("Felling Tree")
  29.         cnt = cnt+1
  30.         print("Turtle has felled "..cnt.." tree(s)")
  31.     else
  32.         sleep(0.5)
  33.     end
  34.     turtle.turnLeft()
  35.     turtle.turnLeft()
  36.     if turtle.detect() then
  37.         turtle.dig()
  38.         print("Felling Tree")
  39.         cnt = cnt+1
  40.         print("Turtle has felled "..cnt.." tree(s)")
  41.     else
  42.         sleep(0.5)
  43.     end
  44.     turtle.turnRight()
  45.     sleep(1)
  46. end
  47.  
  48. function ClearPath()
  49.     if turtle.detect() then
  50.         turtle.dig()
  51.         sleep(0.3)
  52.     end
  53. end
  54.  
  55. function WalkForward(endturn)
  56.     ClearPath()
  57.     turtle.forward()
  58.     repeat
  59.         ClearPath()
  60.         turtle.forward()
  61.     until turtle.detectDown()
  62.     if endturn then
  63.         turtle.turnRight()
  64.     end
  65. end
  66.  
  67. function StepLeft(x,y)
  68.     turtle.turnLeft()
  69.     sleep(0.2)
  70.     for i = 1,x,1
  71.     do
  72.         ClearPath()
  73.         sleep(0.2)
  74.         turtle.forward()
  75.     end
  76.    
  77.     for i = 1,y,1
  78.     do
  79.         turtle.forward()
  80.         sleep(0.2)
  81.     end
  82.     turtle.turnRight()
  83. end
  84.  
  85. function StepRight(x,y)
  86.     turtle.turnRight()
  87.     sleep(0.2)
  88.     for i = 1,x,1
  89.     do
  90.         ClearPath()
  91.         sleep(0.2)
  92.         turtle.forward()
  93.     end
  94.    
  95.     for i = 1,y,1
  96.     do
  97.         turtle.forward()
  98.         sleep(0.2)
  99.     end
  100.     turtle.turnLeft()
  101. end
  102.  
  103. MainThread = true
  104.  
  105.  
  106. while MainThread do
  107.  
  108. turtle.turnLeft()
  109. WalkForward(true)
  110. ChopDetect()
  111.  
  112. WalkForward(true)
  113. ChopDetect()
  114.  
  115. WalkForward(true)
  116. ChopDetect()
  117.  
  118. RefuelCheck()
  119.  
  120. turtle.turnRight()
  121. turtle.turnRight()
  122. WalkForward(false)
  123. WalkForward(false)
  124. WalkForward(false)
  125. turtle.turnLeft()
  126.  
  127. sleep(10)
  128.  
  129. end
  130.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement