Advertisement
Guest User

farm.lua

a guest
Apr 3rd, 2020
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. seconds = 1
  2. minutes = 60
  3. hours = 120
  4.  
  5. toolSlot = 1
  6. fuelSlot = 16
  7.  
  8. function fuelUp()
  9.     turtle.select(fuelSlot)
  10.     turtle.refuel(1)
  11.     turtle.select(toolSlot)
  12. end
  13.  
  14. function wait(time, interval)
  15.     delay = time * interval
  16.     sleep(delay)
  17. end
  18. grid = {x = 2, y = 1}
  19.  
  20. turtle.select(toolSlot)
  21. while true do
  22.     if turtle.getFuelLevel() < 1 then
  23.         fuelUp()
  24.     end
  25.     for i=0, grid.y do
  26.         for i=0, grid.x do
  27.             turtle.forward()
  28.             _, data = turtle.inspectDown()
  29.             if data.metadata == 3 then
  30.                 turtle.placeDown()
  31.             end
  32.         end
  33.         turtle.turnRight()
  34.         turtle.forward()
  35.         turtle.turnRight()
  36.     end
  37.     wait(30, seconds)
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement