Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.find("monitor")
- -- Find the reactor by pattern
- local reactor
- for _, name in ipairs(peripheral.getNames()) do
- if name:match("uraninite_reactor") then
- reactor = peripheral.wrap(name)
- break
- end
- end
- -- Checks
- if not monitor then
- print("Monitor not found!")
- return
- end
- if not reactor then
- print("Reactor not found!")
- return
- end
- monitor.setTextScale(0.5)
- monitor.setBackgroundColor(colors.black)
- monitor.setTextColor(colors.white)
- local function writeLine(y, text)
- monitor.setCursorPos(1, y)
- monitor.write(text)
- end
- -- Main display loop
- while true do
- local energy = reactor.getStoredEnergy() or 0
- local max = 80000000 -- adjust this if your reactor has a different cap
- local percent = (energy / max) * 100
- -- Reactor stats
- local status = reactor.getStatus and reactor.getStatus() or "Unknown"
- local efficiency = reactor.getEfficiency and reactor.getEfficiency() or 0
- local input = reactor.getLastInput and reactor.getLastInput() or 0
- local output = reactor.getLastOutput and reactor.getLastOutput() or 0
- -- Fuel levels (safe fallback to "N/A")
- local redstone = reactor.getRedstone and reactor.getRedstone() or "N/A"
- local coal = reactor.getCoal and reactor.getCoal() or "N/A"
- local dryIce = reactor.getDryIce and reactor.getDryIce() or "N/A"
- local uraninite = reactor.getUraninite and reactor.getUraninite() or "N/A"
- monitor.clear()
- writeLine(1, "=== POWAH REACTOR ===")
- writeLine(2, string.rep("-", 27))
- writeLine(3, string.format("Stored : %.2f MFE", energy / 1e6))
- writeLine(4, string.format("Capacity : %.2f MFE", max / 1e6))
- writeLine(5, string.format("Fullness : %5.1f%%", percent))
- writeLine(6, string.format("Status : %s", status))
- writeLine(7, string.format("Efficiency: %.2f%%", efficiency * 100))
- writeLine(8, string.format("Input : %.1f FE/t", input))
- writeLine(9, string.format("Output : %.1f FE/t", output))
- writeLine(11, "=== Fuel Levels ===")
- writeLine(12, string.rep("-", 27))
- writeLine(13, string.format("Redstone : %s", tostring(redstone)))
- writeLine(14, string.format("Coal : %s", tostring(coal)))
- writeLine(15, string.format("Dry Ice : %s", tostring(dryIce)))
- writeLine(16, string.format("Uraninite: %s", tostring(uraninite)))
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement