Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Abaddon16
- --Big Reactors Lua
- --initialization/rough draft
- local monitor=peripheral.find("monitor")
- local reactor=peripheral.find("BigReactors-Reactor")
- local monSize=monitor.getSize()
- local engThreshold=5000000
- function isOn()
- return reactor.getActive()
- end
- function rMon()
- monitor.clear()
- monitor.setCursorPos(1,1)
- end
- function newLine()
- local _, cY=monitor.getCursorPos()
- monitor.setCursorPos(1, cY+1)
- end
- function fueltemp()
- return reactor.getFuelTemperature()
- end
- function casetemp()
- return reactor.getCasingTemperature()
- end
- function energyStored()
- return reactor.getEnergyStored()
- end
- function fuel()
- return reactor.getFuelAmount()
- end
- function rodLevel(percent)
- --further insertion results in lower power
- reactor.setAllControlRodLevels(percent)
- end
- function turnOn()
- reactor.setActive(true)
- end
- function checkSetLevels()
- if energyStored()<3500000 and reactor.getControlRodLevel(0)>0 then
- rodLevel(0)
- elseif energyStored()>6000000 then
- rodLevel(60)
- elseif energyStored()>8000000 then
- rodLevel(100)
- end
- end
- function writeMonitor()
- rMon()
- if isOn() then
- monitor.setCursorPos(1, 1)
- monitor.setTextColor(colors.green)
- monitor.write("Reactor is ON")
- newLine()
- local eng=energyStored()
- if eng<engThreshold then
- monitor.setTextColor(colors.red)
- else
- monitor.setTextColor(colors.green)
- end
- monitor.write(eng)
- monitor.setTextColor(colors.orange)
- monitor.write()
- else
- monitor.setTextScale(2)
- monitor.setCursorPos(1,monSize/3)
- monitor.write("Turning on...")
- monitor.setTextScale(1)
- turnOn()
- end
- end
- rMon()
- while 1 do
- if reactor.getConnected() then
- checkSetLevels()
- writeMonitor()
- else
- rMon()
- monitor.setCursorPos(1, 1)
- monitor.setTextColor(colors.red)
- monitor.write("NON-VALID REACTOR")
- end
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement