JustDoesGames

Cocoa Farm

Jul 12th, 2024
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.98 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3.  
  4. local farmed = 0
  5. local f = fs.open("save.lua", "r")
  6. if f then
  7.     farmed = f.readAll()
  8.     f.close()
  9. end
  10.  
  11. local setLabel = function() os.setComputerLabel("§fFarmed: §6"..farmed) end
  12.  
  13. local update = function()
  14.     term.clear()
  15.     term.setCursorPos(1,1)
  16.    
  17.     print("Coco Farm")
  18.     print("Farmed: "..farmed)
  19.     setLabel()
  20. end
  21.  
  22. print("Tiny Coco Farm")
  23. print("z256")
  24.  
  25. while true do
  26.     update()
  27.     while select(2, turtle.inspect()).state.age ~= 2 and select(2, turtle.inspectDown()).state.age ~= 2 do
  28.         sleep(1)
  29.     end
  30.     if select(2, turtle.inspect()).state.age == 2 then
  31.         turtle.dig()
  32.         turtle.place()
  33.         farmed = farmed + 1
  34.     end
  35.     if select(2, turtle.inspectDown()).state.age == 2 then
  36.         turtle.digDown()
  37.         turtle.placeDown()
  38.         farmed = farmed + 1
  39.     end
  40.    
  41.     turtle.dropUp()
  42.    
  43.     local f = fs.open("save.lua", "w")
  44.     f.write(farmed)
  45.     f.close()
  46. end
  47.  
  48.  
Advertisement
Add Comment
Please, Sign In to add comment