Advertisement
Guest User

Minecolonies_Info

a guest
Mar 11th, 2024
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. -- Initialize Colony Integrator
  2. local colony = peripheral.find("colonyIntegrator")
  3. if not colony then error("Colony Integrator not found.") end
  4. if not colony.isInColony then error("Colony Integrator is not in a colony") end
  5. print("Colony Integrator initialized")
  6.  
  7. -- Initialize Rednet
  8. rednet.open("top")
  9.  
  10. -- Get basic Colony informtation
  11. function sendColonyBasics()
  12. local col_ID, col_Name, col_Happiness, col_isUnderAttack, col_Citizen_Count, col_Citizens_Max
  13.  
  14. col_ID = colony.getColonyID()
  15. rednet.send(1, col_ID, "Colony ID Protocol")
  16.  
  17. col_Name = colony.getColonyName()
  18. rednet.send(1, col_Name, "Colony Name Protocol")
  19.  
  20. col_Happiness = colony.getHappiness()
  21. rednet.send(1, col_Happiness, "Colony Happiness Protocol")
  22.  
  23. col_isUnderAttack = colony.isUnderAttack()
  24. rednet.send(1, col_isUnderAttack, "Colony Under Attack Protocol")
  25.  
  26. col_Citizen_Count = colony.amountOfCitizens()
  27. rednet.send(1, col_Citizen_Count, "Colony Citizen Count Protocol")
  28.  
  29. col_Citizens_Max = colony.maxOfCitizens()
  30. rednet.send(1, col_Citizens_Max, "Colony Citizens Max Protocol")
  31.  
  32. col_Requests = colony.getRequests()
  33. rednet.send(1, col_Requests, "Colony Requests Protocol")
  34. end
  35.  
  36. ----------------------------------------------------------------------------
  37. -- MAIN
  38. ----------------------------------------------------------------------------
  39.  
  40. -- Send messages periodically
  41.  
  42. local time_between_runs = 1
  43. local current_Run = time_between_runs
  44. sendColonyBasics()
  45.  
  46. while true do
  47. current_Run = current_Run - 1
  48. if current_Run <= 0 then
  49. sendColonyBasics()
  50. current_Run = time_between_runs
  51. end
  52. sleep(1)
  53. end
  54.  
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement