mercwear

mekanism reactor monitor

May 29th, 2025 (edited)
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. local reactor_location = "back"
  2. local waste_limit = 10
  3. local damage_limit = 1
  4. local temp_limit = 900
  5. local reactor = peripheral.wrap(reactor_location)
  6. local reactor_temp = reactor.getTemperature()
  7. local reactor_waste_fill = reactor.getWasteFilledPercentage()
  8. local reactor_damage = reactor.getDamagePercent()
  9. local reactor_status = reactor.getStatus()
  10. local discord_payload = "No Status"
  11.  
  12.  
  13. local cycle_count = 0
  14. local discord_web_hook = "REDACTED"
  15. print("Reactor waste monitor active")
  16. http.post(discord_web_hook, "content= Reactor Monitor Active")
  17.  
  18. while true do
  19. term.clear()
  20. term.setCursorPos(1,1)
  21. cycle_count = cycle_count + 1
  22.  
  23. reactor_status = reactor.getStatus()
  24. reactor_temp = reactor.getTemperature()
  25. reactor_waste_fill = reactor.getWasteFilledPercentage()
  26. reactor_damage = reactor.getDamagePercent()
  27.  
  28.  
  29. print("Reactor Monitoring Active")
  30. print("Reactor Status: "..tostring(reactor_status))
  31. print("Reactor Temp: "..tostring(reactor_temp))
  32. print("Reactor Waste Level: "..tostring(reactor_waste_fill))
  33. print("Reactor Damage: "..tostring(reactor_damage))
  34.  
  35.  
  36. if reactor_temp >= temp_limit or reactor_waste_fill >= waste_limit or reactor_damage >= damage_limit then
  37. print("Shutdown limit reached, shutting down.")
  38. http.post(discord_web_hook, "content= Reactor shutting down due to threshold being reached.")
  39. reactor.scram()
  40. return
  41. end
  42.  
  43.  
  44. if cycle_count >= 120 then
  45. cycle_count = 0
  46. --Create discord payload
  47. discord_payload = "Reactor Update \n Temp: "..tostring(reactor_temp).."\n Waste Level: "..tostring(reactor_waste_fill).."\n Damage: "..tostring(reactor_damage)
  48. http.post(discord_web_hook, "content="..discord_payload)
  49. end
  50. sleep(7)
  51.  
  52.  
  53. end
Advertisement
Add Comment
Please, Sign In to add comment