Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Reactor Control Software
- -- V 1.0.0
- --First time configuration
- if not fs.exists("ReactorControl.cfg") then
- print("Configuration file not found, creating new configuration file")
- Writes={}
- --Selecting Reactor Peripheral
- print("Peripherals Found:")
- AllPeripherals = peripheral.getNames()
- for i in ipairs(AllPeripherals) do
- print("["..i.."] "..AllPeripherals[i])
- end
- print("Please enter the the position of the reactor (BigReactors-Reactor_n)")
- ReactorName = AllPeripherals[tonumber(read())]
- print(ReactorName)
- --Writing To Config
- config = fs.open("ReactorControl.cfg","w")
- config.writeLine(ReactorName)
- config.close()
- print("If you ever need to change these settings, delete ReactorControl.cfg")
- end
- --Reading Config
- config=fs.open("ReactorControl.cfg","r")
- ReactorName = config.readLine()
- config.close()
- --Wrapping Reactor
- print("Reactor Name: "..ReactorName)
- reactor = peripheral.wrap(ReactorName)
- --Monitoring Loop
- while true do
- EnergyStats=reactor.getEnergyStats()
- FillPercentage= (EnergyStats.energyStored / EnergyStats.energyCapacity)*100
- reactor.setAllControlRodLevels(math.min(FillPercentage+10,100))
- term.clear()
- print("Energy Stored: "..EnergyStats.energyStored)
- print("Energy Capacity: "..EnergyStats.energyCapacity)
- print("Current Generation: "..EnergyStats.energyProducedLastTick.."RF/t")
- print("Control Rod Level: "..math.min(FillPercentage+10,100))
- os.sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement