Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local r --reactor
- local m --monitor
- function startup()
- r = peripheral.wrap('back')
- m = peripheral.wrap('monitor_0')
- --~ m.setTextScale(0.5)
- term.clear()
- term.setCursorPos(1, 1)
- print ('Redirecting to monitor...')
- term.redirect(m)
- end
- function displayData(data)
- term.clear()
- term.setCursorPos(1, 1)
- print("Active: ".. tostring(data["active"]))
- print("Fuel: "..tostring(data["fuel"]).."mb")
- print("Fuel Temp: "..tostring(data["fuelTemp"]))
- print("Casing Temp: "..tostring(data["casingTemp"]))
- print("Energy produced: "..tostring(data["energy"]))
- print("Energy stored: "..tostring(data["storedEnergy"]))
- print("Rod level: "..tostring(data["rodLevel"]))
- end
- function getData()
- local data = {}
- data["active"] = r.getActive()
- data["fuel"] = r.getFuelAmount()
- data["fuelTemp"] = r.getFuelTemperature()
- data["casingTemp"] = r.getCasingTemperature()
- data["energy"] = r.getEnergyProducedLastTick()
- data["storedEnergy"] = r.getEnergyStored()
- data["rodLevel"] = r.getControlRodLevel(1)
- return data
- end
- function controlRods(data)
- local rodLevel = data["rodLevel"]
- local fuelTemp = data["fuelTemp"]
- local storedEnergy = data["storedEnergy"]
- local active = data["active"]
- if storedEnergy > 8000000 then
- r.setActive(false)
- elseif not active and storedEnergy < 200000 then
- r.setActive(true)
- elseif active and fuelTemp > 1000 then
- r.setAllControlRodLevels(rodLevel-1)
- elseif active and fuelTemp < 800 then
- end
- end
- startup()
- while true do
- local data = getData()
- controlRods(data)
- displayData(data)
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment