Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Initialize Colony Integrator
- local colony = peripheral.find("colonyIntegrator")
- if not colony then error("Colony Integrator not found.") end
- if not colony.isInColony then error("Colony Integrator is not in a colony") end
- print("Colony Integrator initialized")
- -- Initialize Rednet
- rednet.open("top")
- -- Get basic Colony informtation
- function sendColonyBasics()
- local col_ID, col_Name, col_Happiness, col_isUnderAttack, col_Citizen_Count, col_Citizens_Max
- col_ID = colony.getColonyID()
- rednet.send(1, col_ID, "Colony ID Protocol")
- col_Name = colony.getColonyName()
- rednet.send(1, col_Name, "Colony Name Protocol")
- col_Happiness = colony.getHappiness()
- rednet.send(1, col_Happiness, "Colony Happiness Protocol")
- col_isUnderAttack = colony.isUnderAttack()
- rednet.send(1, col_isUnderAttack, "Colony Under Attack Protocol")
- col_Citizen_Count = colony.amountOfCitizens()
- rednet.send(1, col_Citizen_Count, "Colony Citizen Count Protocol")
- col_Citizens_Max = colony.maxOfCitizens()
- rednet.send(1, col_Citizens_Max, "Colony Citizens Max Protocol")
- col_Requests = colony.getRequests()
- rednet.send(1, col_Requests, "Colony Requests Protocol")
- end
- ----------------------------------------------------------------------------
- -- MAIN
- ----------------------------------------------------------------------------
- -- Send messages periodically
- local time_between_runs = 1
- local current_Run = time_between_runs
- sendColonyBasics()
- while true do
- current_Run = current_Run - 1
- if current_Run <= 0 then
- sendColonyBasics()
- current_Run = time_between_runs
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement