Advertisement
ETvd

Powah Reactor Mon v2

Jun 21st, 2025 (edited)
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. local monitor = peripheral.find("monitor")
  2.  
  3. -- Find the reactor by pattern
  4. local reactor
  5. for _, name in ipairs(peripheral.getNames()) do
  6. if name:match("uraninite_reactor") then
  7. reactor = peripheral.wrap(name)
  8. break
  9. end
  10. end
  11.  
  12. -- Checks
  13. if not monitor then
  14. print("Monitor not found!")
  15. return
  16. end
  17.  
  18. if not reactor then
  19. print("Reactor not found!")
  20. return
  21. end
  22.  
  23. monitor.setTextScale(0.5)
  24. monitor.setBackgroundColor(colors.black)
  25. monitor.setTextColor(colors.white)
  26.  
  27. local function writeLine(y, text)
  28. monitor.setCursorPos(1, y)
  29. monitor.write(text)
  30. end
  31.  
  32. -- Main display loop
  33. while true do
  34. local energy = reactor.getStoredEnergy() or 0
  35. local max = 80000000 -- adjust this if your reactor has a different cap
  36. local percent = (energy / max) * 100
  37.  
  38. -- Reactor stats
  39. local status = reactor.getStatus and reactor.getStatus() or "Unknown"
  40. local efficiency = reactor.getEfficiency and reactor.getEfficiency() or 0
  41. local input = reactor.getLastInput and reactor.getLastInput() or 0
  42. local output = reactor.getLastOutput and reactor.getLastOutput() or 0
  43.  
  44. -- Fuel levels (safe fallback to "N/A")
  45. local redstone = reactor.getRedstone and reactor.getRedstone() or "N/A"
  46. local coal = reactor.getCoal and reactor.getCoal() or "N/A"
  47. local dryIce = reactor.getDryIce and reactor.getDryIce() or "N/A"
  48. local uraninite = reactor.getUraninite and reactor.getUraninite() or "N/A"
  49.  
  50. monitor.clear()
  51.  
  52. writeLine(1, "=== POWAH REACTOR ===")
  53. writeLine(2, string.rep("-", 27))
  54. writeLine(3, string.format("Stored : %.2f MFE", energy / 1e6))
  55. writeLine(4, string.format("Capacity : %.2f MFE", max / 1e6))
  56. writeLine(5, string.format("Fullness : %5.1f%%", percent))
  57. writeLine(6, string.format("Status : %s", status))
  58. writeLine(7, string.format("Efficiency: %.2f%%", efficiency * 100))
  59. writeLine(8, string.format("Input : %.1f FE/t", input))
  60. writeLine(9, string.format("Output : %.1f FE/t", output))
  61.  
  62. writeLine(11, "=== Fuel Levels ===")
  63. writeLine(12, string.rep("-", 27))
  64. writeLine(13, string.format("Redstone : %s", tostring(redstone)))
  65. writeLine(14, string.format("Coal : %s", tostring(coal)))
  66. writeLine(15, string.format("Dry Ice : %s", tostring(dryIce)))
  67. writeLine(16, string.format("Uraninite: %s", tostring(uraninite)))
  68.  
  69. os.sleep(1)
  70. end
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement