Advertisement
MigasRocha

test

Jun 25th, 2022
1,117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. while true do
  2.  
  3. function refuel()
  4.  
  5.     if turtle.getFuelLevel() < 50 then
  6.         turtle.select(16)
  7.         turtle.placeUp()
  8.         turtle.suckUp()
  9.         turtle.refuel()
  10.         turtle.dropUp()
  11.         turtle.digUp()
  12.         turtle.select(1)
  13.     end
  14. end
  15.  
  16. function refill()
  17.  
  18.     if  turtle.getItemCount(1) == 0 then
  19.         turtle.select(15)
  20.         turtle.placeUp()
  21.         turtle.select(1)
  22.         turtle.suckUp()
  23.         turtle.select(15)
  24.         turtle.digUp()
  25.         turtle.select(1)
  26.     end
  27. end
  28.  
  29. function (testground)
  30.  
  31.     if turtle.detectDown() == false then
  32.         turtle.placeDown()
  33.     end
  34.     if turtle.detectDown() == true then
  35.         andarfrente()
  36.     end
  37.  
  38. function testsides()
  39.  
  40.         turtle.turnLeft()
  41.     if  turtle.detect() == true then
  42.         turtle.turnRight()
  43.         turtle.turnRight()
  44.         turtle.forward()
  45.         turtle.turnLeft()
  46.         testground()
  47.     end
  48.  
  49.     turtle.turnRight()
  50.     if turtle.detect() == true then
  51.         turtle.turnLeft()
  52.         turtle.turnLeft()
  53.         turtle.forward()
  54.         turtle.turnRight()
  55.         testground()
  56.     end
  57. end
  58.  
  59. function andarfrente()
  60.  
  61.     if turtle.detect() == false then
  62.         turtle.forward()
  63.     end
  64.  
  65.     if turtle.detect() == true then
  66.         testsides()
  67.     end
  68. end
  69.  
  70.  
  71. function andar()
  72.  
  73. if turtle.getItemCount(1) > 0 then
  74.     refuel()
  75.     testground()
  76. end
  77.     end
  78.    
  79. refuel()
  80. refill()
  81. andar()
  82.  
  83. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement