CultistaDeCrocs

chopTree

Sep 15th, 2024
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. local asshat = require("libraries.asshat")
  2. local passos = 0
  3.  
  4. function corta()
  5.     turtle.digUp()
  6.     turtle.up()
  7.     passos = passos+1
  8.     altura = altura+1
  9. end
  10.  
  11. function detectaCima()
  12.     if (turtle.inspectUp()) then
  13.         corta()
  14.     else
  15.         desce()
  16.         volta()
  17.     end
  18. end
  19.  
  20. function desce()
  21.     for i=1, altura do
  22.         turtle.down()
  23.         passos = passos+1
  24.     end
  25. end
  26.  
  27. function volta()
  28.     turtle.turnLeft()
  29.     turtle.turnLeft()
  30.     turtle.forward()
  31.     passos = passos+1
  32. end
  33.  
  34.  
  35. -- Main
  36.  
  37. informacaoTitulo("T R E E  C H O P P E R")
  38. print("Cutting tree...")
  39.  
  40. altura = 0
  41. turtle.dig()
  42. turtle.forward()
  43. passos = passos+1
  44.  
  45. while turtle.inspectUp() do
  46.     corta()
  47. end
  48.  
  49. desce()
  50. volta()
  51.  
  52. agradece(passos)
Add Comment
Please, Sign In to add comment