itssnowing

Untitled

Jul 15th, 2021
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. --Setup and variables
  2. detector = peripheral.wrap("right") --Defines the Detector on the right
  3. range = 32 --CHANGE ME TO 32 (2 chunks)
  4. redstonesides = {"left"} --Sides to output signal to.
  5. sleeptime = 36000 --CHANGE ME TO 36000 (ten minutes)
  6.  
  7. --Functions--
  8. function playersNearby(var)
  9. local near = detector.isPlayersInRange(var)
  10. clear()
  11. print("Day " .. os.day() .. ": Found player nearby. Enabling Will collection.")
  12. return near
  13. end
  14.  
  15. function setSides(sides, var)
  16. for i=1, #sides do
  17. rs.setOutput(sides[i], var)
  18. end
  19. end
  20.  
  21. function clear()
  22. term.setBackgroundColor(colours.black) -- Set the background colour to black.
  23. term.clear() -- Paint the entire display with the current background colour.
  24. term.setCursorPos(1,1)
  25. end
  26.  
  27. function growWill()
  28. while true do
  29. if playersNearby(range) then
  30. setSides(redstonesides, true)
  31. else
  32. setSides(redstonesides, false)
  33. end
  34. sleep(sleeptime)
  35. end
  36. end
  37.  
  38. --Program body--
  39. growWill()
  40.  
  41.  
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment