Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local reactor, lMon, rMon
- reactor = peripheral.wrap("BigReactors-Reactor_0")
- lMon = peripheral.wrap("left")
- rMon = peripheral.wrap("right")
- lMon.setTextScale(0.5)
- rMon.setTextScale(0.5)
- lMon.clear()
- rMon.clear()
- print("Running Reactor Monitor...")
- function UpdateScreens(stored, lastTick, reactorOn, rods)
- local storedPerc
- storedPerc = math.floor((stored / 10000) * 100)
- lMon.clear()
- lMon.setCursorPos(1,1)
- lMon.write("Stored:")
- lMon.setCursorPos(1,2)
- lMon.write(stored .. "k " .. storedPerc .. "%")
- lMon.setCursorPos(1,3)
- lMon.write("Current:")
- lMon.setCursorPos(1,4)
- lMon.write(lastTick)
- rMon.clear()
- rMon.setCursorPos(1,1)
- rMon.write("Status:")
- rMon.setCursorPos(1,2)
- if reactorOn then
- rMon.write("Active")
- else
- rMon.write("Inactive")
- end
- rMon.setCursorPos(1,3)
- rMon.write("Rods:")
- rMon.setCursorPos(1,4)
- for k,v in pairs(rods) do
- rMon.write(v .. "% ")
- end
- end
- function PollReactor()
- local energyStored, energyLastTick, reactorOn, rods
- energyStored = math.floor(reactor.getEnergyStored() / 1000)
- energyLastTick = math.floor(reactor.getEnergyProducedLastTick())
- reactorOn = reactor.getActive()
- rods = {}
- rodCount = reactor.getNumberOfControlRods()
- for i=1,rodCount,1 do
- rods[i] = reactor.getControlRodLevel(i - 1)
- end
- UpdateScreens(energyStored, energyLastTick, reactorOn, rods)
- end
- while true do
- PollReactor()
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement