Guest User

floor.lua

a guest
Aug 28th, 2021
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1.  
  2.  
  3. function findBlock()
  4. for slot = 2,16 do
  5.     if turtle.getItemCount(slot) >0 then
  6.     turtle.select(slot)
  7.     break
  8.     end
  9. end
  10. end
  11.  
  12. function move()
  13.     turtle.forward()
  14.     turtle.placeDown()
  15.     findBlock()
  16.    
  17. end
  18.  
  19. function refuel()
  20.     turtle.select(1)
  21.     turtle.refuel()
  22.    
  23. end
  24.  
  25. function turnRight()
  26.     findBlock()
  27.     turtle.turnRight()
  28.     turtle.forward()
  29.     turtle.placeDown()
  30.     turtle.turnRight()
  31. end
  32.  
  33. function turnLeft()
  34.     findBlock()
  35.     turtle.turnLeft()
  36.     turtle.forward()
  37.     turtle.placeDown()
  38.     turtle.turnLeft()
  39. end
  40.  
  41. function run()
  42.  
  43.     for i=1,59 do
  44.        
  45.     if turtle.getFuelLevel() < 1 then
  46.         refuel()
  47.     else
  48.         move()
  49.         end
  50.     end
  51. end
  52.  
  53. while true do
  54.  
  55. findBlock()
  56. run()
  57. turnRight()
  58. run()
  59. turnLeft()
  60. end
  61.        
Advertisement
Add Comment
Please, Sign In to add comment