CultistaDeCrocs

bridge

Sep 15th, 2024
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. local parou = false
  2. local passos = 0
  3.  
  4. local asshat = require("libraries.asshat")
  5.  
  6.  
  7.  
  8. function detectarChao()
  9.     local isBlock, block = turtle.inspectDown()
  10.     if (isBlock) then
  11.         parou = true
  12.     end
  13. end
  14.  
  15. function detectarColisao()
  16.     local isBlock, block = turtle.inspect()
  17.     if (isBlock) then
  18.         parou = true
  19.     end
  20. end
  21.  
  22. function andar()
  23.     if not turtle.forward() then
  24.         turtle.select(1)
  25.         turtle.refuel(1)
  26.         turtle.forward()
  27.     end
  28.    
  29.     passos = passos+1
  30. end
  31.  
  32. term.clear()
  33. term.setCursorPos(1,1)
  34. print("I'll make a bridge until I collide with something or find ground below me.\n")
  35. print("Since I don't know how long it's going to be, I don't know how much coal I'll need, so put lots in my 1st inventory slot.\n")
  36. print("Put lots of any block you want in my other slots and press anything to proceed.\n")
  37. write("> ")
  38. read()
  39.  
  40. while not parou do
  41.     detectarColisao()
  42.     colocarBaixo()
  43.     andar()
  44.     detectarChao()
  45. end
  46.  
  47. agradece(passos)
Add Comment
Please, Sign In to add comment