--Basic Control System reactor = peripheral.wrap("BigReactors-Reactor_1") reactorStatus = false m = peripheral.wrap("monitor_0") m.setTextScale(1) local textcolor = colors.cyan function getEnergyPer() return (reactor.getFuelAmount()/reactor.getFuelAmountMax())*100 end function getPerColor (perc) local colorTable = { colors.red, colors.orange, colors.yellow, colors.green, colors.lime } return colorTable[math.floor(perc * #colorTable / 100)] end term.clear() term.setCursorPos(1,1) term.write("NCP Is Running See Monitor For Stats.") while true do --This is the main control loop if reactor.getEnergyStored() > 9900000 then reactor.setActive(false) elseif reactor.getEnergyStored() < 5000000 then reactor.setActive(true) end --Output stats to monitor m.clear() m.setTextColor(textcolor) m.setCursorPos(1,1) m.write("NoiroCraft Reactor Control Panel") m.setCursorPos(1,3) rStoragePer = math.floor((reactor.getEnergyStored()/10000000)*100) m.write("Energy Storage: ") m.setTextColor(getPerColor(rStoragePer)) m.write(tostring(rStoragePer.."%")) m.setTextColor(textcolor) m.setCursorPos(1,4) m.write("Reactor Active: "..tostring(reactor.getActive())) m.setCursorPos(1,5) m.write("Loaded Fuel Amount: "..tostring(math.floor(reactor.getFuelAmount()/reactor.getFuelAmountMax()*100)).."%") m.setCursorPos(1,6) m.write("Energy Produced (RF/last tick): "..tostring(math.floor(reactor.getEnergyProducedLastTick()))) -- Pause for life sleep(.1) end