Advertisement
Marlingaming

CC Tweaked - Reactor Facility Manager

May 13th, 2022
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. local Reactor_Status = {}
  2. local Reactor_Heat = {}
  3. local Reactor_Power = {}
  4. local Facility_Status = -1 -- -1 = Offline, 0 = Reserve Power, 1 = Startup, 2 = Normal Operations
  5. local Reactor_Layout = {}
  6. local PowerFacilityChannel = 35
  7. local modem
  8.  
  9. function ReadMessage( Channel, Message, ReplyChannel) --reads messages
  10. if Channel == PowerFacilityChannel and Message == "getStatus" then
  11. modem.transmit(Reply,PowerFacilityChannel,Facility_Status)
  12. elseif Channel == PowerFacilityChannel and Message == "shutdown_Power" then
  13. ShutPower()
  14. end
  15.  
  16. end
  17.  
  18. function ShutPower()--turns off all power
  19.  
  20. end
  21.  
  22. function CheckReactors()--updates reactor variables based off reactor data()
  23.  
  24. end
  25.  
  26. function PowerFacilityCheck()--ensures everything is working correctly, if error detected, facility turns off
  27.  
  28. end
  29.  
  30. function Loop()
  31. while true do
  32. local a, b, c, d, e, f = os.pullEvent()
  33. if a == "modem_message" then
  34. ReadMessage(c,d,e)
  35. elseif a == "pass" then
  36. CheckReactors()
  37. end
  38. if Facility_Status > -1 then
  39. PowerFacilityCheck()
  40. os.queueEvent("pass")
  41. else
  42. break
  43. end
  44. end
  45. end
  46.  
  47. Loop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement