Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mon = peripheral.wrap("monitor_0")
- local on = colors.green
- local off = colors.red
- --Reactor
- local reactor = peripheral.wrap("back")
- local RCTE = reactor.getEnergyStored()
- local RPT = reactor.getEnergyProducedLastTick()
- local RCRS = reactor.setAllControlRodLevels
- --Energy Cells
- local cube = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_5")
- local cell2 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_6")
- local cell3 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_7")
- local crf = cube.getEnergyStored()
- local crf2 = cell2.getEnergyStored()
- local crf3 = cell3.getEnergyStored()
- function writeonmonitor()
- mon.clear()
- while true do
- sleep(0.05)
- mon.setTextScale(2)
- mon.setBackgroundColor(colors.white)
- crf = cube.getEnergyStored()
- crf2 = cell2.getEnergyStored()
- crf3 = cell3.getEnergyStored()
- RCTE = reactor.getEnergyStored()
- RPT = reactor.getEnergyProducedLastTick()
- RCRS = reactor.getControlRodLevel(1)
- if crf <= 70000000 then
- reactor.setActive(true)
- elseif RCTE > 100000 then
- reactor.setActive(false)
- end
- if reactor.getActive() == true then
- mon.setCursorPos(1,5)
- mon.clearLine()
- mon.setTextColor(on)
- mon.write("Reactor Info: On")
- else
- mon.setTextColor(off)
- mon.setCursorPos(1,5)
- mon.clearLine()
- mon.write("Reactor Info: Off")
- end
- mon.setCursorPos(1,8)
- mon.clearLine()
- mon.setTextColor(colors.gray)
- mon.write("Control Rods: "..reactor.getControlRodLevel(1).."% Inserted")
- mon.setTextColor(colors.gray)
- mon.setCursorPos(3,6)
- mon.clearLine()
- mon.write("Current RF: "..RCTE)
- mon.setCursorPos(2,7)
- mon.clearLine()
- mon.write("RF-Per Tick: "..RPT)
- mon.setTextColor(colors.gray)
- mon.setCursorPos(1,11)
- mon.clearLine()
- mon.write("Current RF Cell1: "..crf)
- mon.setCursorPos(1,12)
- mon.clearLine()
- mon.write("Current RF Cell2: "..crf2)
- mon.setCursorPos(1,13)
- mon.clearLine()
- mon.write("Current RF Cell3: "..crf3)
- mon.setCursorPos(1,10)
- mon.setTextScale(2)
- mon.setTextColor(colors.lightGray)
- mon.write("EnergyCell Info:")
- mon.setTextColor(colors.lime)
- mon.setCursorPos(1,2)
- mon.write("[++] ( Reactor Monitor ) [++]")
- mon.setCursorPos(1,1)
- mon.write("[=]=======================[=]")
- mon.setCursorPos(1,3)
- mon.write("[=]=======================[=]")
- -- Control Rods
- mon.setCursorPos(3,9)
- mon.setTextColor(colors.black)
- mon.setBackgroundColor(colors.red)
- mon.write("Set 0%")
- mon.setCursorPos(11,9)
- mon.setBackgroundColor(colors.yellow)
- mon.write("Set 50%")
- mon.setCursorPos(19,9)
- mon.setBackgroundColor(colors.blue)
- mon.write("Set 100%")
- mon.setCursorPos(1,1)
- mon.setBackgroundColor(colors.white)
- end
- end
- function clickEvent()
- while true do
- event, side, x, y = os.pullEvent()
- if event == "monitor_touch" then
- if x >= 3 and x <= 8 and y == 9 then
- print("0% clicked")
- reactor.setAllControlRodLevels(0)
- elseif x >= 11 and x <= 18 and y == 9 then
- print("50% clicked")
- reactor.setAllControlRodLevels(50)
- elseif x >= 19 and x <= 24 and y == 9 then
- print("100% clicked")
- reactor.setAllControlRodLevels(100)
- end
- end
- sleep(0.5)
- end
- end
- while true do
- parallel.waitForAny(clickEvent, writeonmonitor)
- mon.setBackgroundColor(colors.white)
- sleep(0.05)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement