Advertisement
ccraftersanonmoose

Fusion Reactor Monitor and Controller

Mar 21st, 2025 (edited)
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.41 KB | None | 0 0
  1. -- Script to monitor the fusion reactor from Mekanism. Mostly for fun to visualize levels.
  2. -- Written for Mekanism & CC:Tweaked
  3. -- Script by craftersanonmoose
  4. -- Version history
  5. -- version 0.1 3/21/25
  6. -- adding monitoring functionality
  7. -- will add buttons to control injection rate later
  8.  
  9. --------------------------------------------------------------------------------
  10. -- prepare monitor
  11. mon = peripheral.wrap("top")
  12. mon.clear()
  13. reactor = peripheral.wrap("fusionReactorLogicAdapter")
  14.  
  15. -- get and display information
  16. function displayInfo()
  17.   mon.setTextScale(1)
  18.   -- Reactor Section
  19.   mon.setCursorPos(1,2)
  20.   mon.write("Fusion Reactor")
  21.   if reactor.getPassiveGeneration(true) ==> 1 then
  22.     mon.setCursorPos(1,3)
  23.     mon.write("Status:")
  24.     mon.setCursorPos(1,4)
  25.    -- mon.clearLine()
  26.     mon.write("Active  ")
  27.   else
  28.     mon.setCursorPos(1,3)
  29.     mon.write("Status:")
  30.     mon.setCursorPos(1,4)
  31.   --  mon.clearLine()
  32.     mon.write("Disabled")
  33.   end  
  34.   mon.setCursorPos(1,12)
  35.   mon.write("Injection Rate")
  36.   mon.setCursorPos(1,13)
  37.   mon.write(reactor.getInjectionRate())    
  38.  -- mon.setCursorPos(1,8)
  39.  -- mon.write("Current Burn Rate: ")
  40.  -- mon.setCursorPos(1,10)
  41.  -- mon.write(reactor.getActualBurnRate())
  42.   mon.setCursorPos(1,16)
  43.   mon.write("Current Temp:")
  44.   mon.setCursorPos(1,17)
  45.   mon.write(math.floor(reactor.getCaseHeat() - 273.15).."C ")
  46.   end
  47.  
  48.  
  49. while true do
  50.     displayInfo()
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement