Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local reactor = peripheral.wrap("BigReactors-Reactor_0")
- local mon = peripheral.wrap("monitor_0")
- local cap = peripheral.wrap("tile_blockcapacitorbank_name_0")
- local active = true
- function ShowReactorInfo()
- mon.setCursorPos(1,1)
- mon.setTextColor(colors,lime)
- mon.write("Reactor Status: ")
- if reactor.getActive() == true then
- mon.setTextColor(colors,green)
- mon.write("ON")
- else
- mon.setTextColor(colors,red)
- mon.write("OFF")
- end
- mon.setCursorPos(1,2)
- mon.setTextColor(colors,lime)
- mon.write("RF/t: ")
- mon.setTextColor(colors.lime)
- mon.write(math.floor(reactor.getEnergyProducedLastTick()))
- mon.setCursorPos(1,3)
- mon.setTextColor(colors.white)
- mon.write("Energy Buffer: ")
- mon.setTextColor(colors.lime)
- mon.write(math.floor(reactor.getEnergyStored()))
- mon.write(" RF")
- mon.setCursorPos(1,4)
- mon.setTextColor(colors.white)
- mon.write("Energy Buffer is ")
- mon.setTextColor(colors.red)
- mon.write(math.floor(reactor.getEnergyStored() * 0.00001))
- mon.write(" % filled")
- mon.setCursorPos(1,5)
- mon.setTextColor(colors.white)
- mon.write("Casing Heat: ")
- mon.setTextColor(colors.lime)
- mon.write(math.floor(reactor.getCasingTemperature()))
- mon.write(" °C")
- mon.setCursorPos(1,6)
- mon.setTextColor(colors.white)
- mon.write("Fuel/t: ")
- mon.setTextColor(colors.lime)
- mon.write(math.floor(reactor.getFuelConsumedLastTick()))
- mon.write(" mB")
- end
- function ShowCapInfo()
- mon.setCursorPos(1,8)
- mon.setTextColor(colors.white)
- mon.write("Capacitor Energy: ")
- mon.setTextColor(colors.lime)
- mon.write(math.floor(cap.getEndergyStored()))
- mon.write(" RF/ ")
- mon.write(math.floor(cap.getMaxEndergyStored()))
- mon.setCursorPos(1,9)
- mon.setTextColor(colors.white)
- mon.write("Capacitor is ")
- mon.write(math.floor(cap.getMaxEndergyStored()/cap.getEndergyStored()))
- mon.write(" % filled")
- end
- function CheckStorage()
- local perc = math.floor(cap.getMaxEndergyStored()/cap.getEndergyStored())
- local limit = 20
- local energyBuffer = math.floor(reactor.getEnergyStored())
- if (perc <= limit and energyBuffer <= 98) then
- reactor.setActive(true)
- elseif (energyBuffer >= 99) then
- reactor.setActive(false)
- end
- if (perc < limit-5) then
- print("WARNING! LOW ENERGY LEVEL!")
- active = false
- end
- end
- while active == true do
- ShowReactorInfo()
- ShowCapInfo()
- CheckStorage()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement