itssnowing

Untitled

Jul 18th, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 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. chunkowner = "Bipedsnowman"
  7.  
  8. --Functions--
  9. function playersNearby(var)
  10. local near = detector.isPlayersInRange(var)
  11. clear()
  12. print("Day " .. os.day() .. ": Found player nearby. Enabling Will collection.")
  13. return near
  14. end
  15.  
  16. function setSides(sides, var)
  17. for i=1, #sides do
  18. rs.setOutput(sides[i], var)
  19. end
  20. end
  21.  
  22. function clear()
  23. term.setBackgroundColor(colours.black) -- Set the background colour to black.
  24. term.clear() -- Paint the entire display with the current background colour.
  25. term.setCursorPos(1,1)
  26. end
  27.  
  28. function ownerOnline()
  29. if getPlayerPos(chunkowner) != nil then
  30. return true
  31. end
  32. return false
  33. end
  34.  
  35. function growWill()
  36. while true do
  37. if playersNearby(range) or ownerOnline() then
  38. setSides(redstonesides, true)
  39. else
  40. setSides(redstonesides, false)
  41. end
  42. sleep(sleeptime)
  43. end
  44. end
  45.  
  46. --Program body--
  47. growWill()
  48.  
  49.  
  50.  
  51.  
Advertisement
Add Comment
Please, Sign In to add comment