Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function round(num, idp)
- local mult = 10^(idp or 0);
- return math.floor(num * mult + 0.5) / mult;
- end
- function formateNumber(n) --http://richard.warburton.it
- if type(n) == "number" then
- n = string.format("%.f", tostring(n))
- else
- n = string.format("%.f", n)
- end
- local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$');
- return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right;
- end
- local monitor = peripheral.wrap("monitor_1")
- local reactor = {}
- local i = 0
- monitor.clear()
- monitor.setTextColor(colors.combine(colors.orange, colors.yellow))
- monitor.setTextScale(.75)
- for i = 0, 5, 1 do
- reactor[i] = peripheral.wrap("Reactor Logic Adapter_" .. i)
- end
- while true do
- i = 0
- local totalEnergy = 0
- for _ in pairs(reactor) do
- local Energy = reactor[i].getEnergy()
- local MaxEnergy = reactor[i].getMaxEnergy()
- local EnergyOut = reactor[i].getProducing()
- local PlasmaHeat = reactor[i].getPlasmaHeat()
- local CaseHeat = reactor[i].getCaseHeat()
- local MaxCaseHeat = reactor[i].getMaxCaseHeat()
- local MaxPlasmaHeat = reactor[i].getMaxPlasmaHeat()
- local IgnitionTemp = reactor[i].getIgnitionTemp()
- local Tritium = reactor[i].getTritium()
- local Deuterium = reactor[i].getDeuterium()
- local FuelInjectionRate = reactor[i].getInjectionRate()
- local Water = reactor[i].getWater()
- local Steam = reactor[i].getSteam()
- local isOn = reactor[i].isIgnited()
- local canStart = reactor[i].canIgnite()
- monitor.setCursorPos(1,1)
- monitor.clearLine()
- if isOn then
- monitor.setTextColor(colors.lime)
- monitor.write("Reactor " .. i+1 .. " is ON")
- else
- monitor.setTextColor(colors.red)
- monitor.write("Reactor " .. i+1 .. " is OFF")
- end
- monitor.setTextColor(colors.combine(colors.orange, colors.yellow))
- monitor.setCursorPos(1,3)
- monitor.clearLine()
- monitor.write("Case Temperature: " .. formateNumber(CaseHeat) .. " K this corresponds to " .. round((CaseHeat/MaxCaseHeat)*100,2) .. " % of the max Case Temperature.")
- monitor.setCursorPos(1,5)
- monitor.clearLine()
- monitor.write("Plasma Temperature: " .. formateNumber(PlasmaHeat) .. " K this corresponds to " .. round((PlasmaHeat/MaxPlasmaHeat)*100,2) .. " % of the max Plasma Temperature.")
- monitor.setCursorPos(1,7)
- monitor.clearLine()
- monitor.write("Need Temperature for Ignition: " .. formateNumber(IgnitionTemp) .. " K this corresponds to " .. round((PlasmaHeat/IgnitionTemp)*100,5) .. " % of the current Plasma Temperature.")
- monitor.setCursorPos(1,10)
- monitor.clearLine()
- monitor.write("Currently Producing: " .. formateNumber(EnergyOut/2.5) .. " RF/t at an Fuel Injection Rate of " .. FuelInjectionRate .. " mB/t.")
- monitor.setCursorPos(1,12)
- monitor.clearLine()
- monitor.write("Current stored Energy: " .. formateNumber(Energy/2.5) .. " RF this corresponds to " .. round((Energy/MaxEnergy)*100,4) .. " % of the max storable Energy.")
- monitor.setCursorPos(1,14)
- monitor.clearLine()
- monitor.write("Current stored Tritium: " .. formateNumber(Tritium) .. " mB.")
- monitor.setCursorPos(1,16)
- monitor.clearLine()
- monitor.write("Current stored Deuterium: " .. formateNumber(Deuterium) .. " mB.")
- monitor.setCursorPos(1,18)
- monitor.clearLine()
- monitor.write("Current stored Water: " .. formateNumber(Water) .. " mB.")
- monitor.setCursorPos(1,20)
- monitor.clearLine()
- monitor.write("Current stored Steam: " .. formateNumber(Steam) .. " mB.")
- monitor.setCursorPos(1,23)
- monitor.clearLine()
- if canStart then
- monitor.setTextColor(colors.lime)
- monitor.write("Reactor could be re- started.")
- else
- monitor.setTextColor(colors.red)
- monitor.write("Reactor could NOT be re- started without a Laser Impuls.")
- end
- monitor.setTextColor(colors.combine(colors.orange, colors.yellow))
- i = i + 1
- totalEnergy = totalEnergy + EnergyOut
- os.sleep(3.5)
- end
- monitor.setCursorPos(1,25)
- monitor.clearLine()
- monitor.write("Total Energy Production: " .. formateNumber(totalEnergy/2.5) .. " RF/t")
- end
Add Comment
Please, Sign In to add comment