Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local term = require("term")
- local unicode = require("unicode")
- local timeapi = require("timeapi")
- local pr = component.openprinter
- local icr = component.reactor_chamber
- local function round(num, idp)
- local mult = 10^(idp or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- local function checkBatt()
- local curr = 0
- for addr in component.list("mfsu") do
- battcheck = component.proxy(addr).getStored()
- curr = curr + battcheck
- end
- return curr
- end
- local function checkCapacity()
- local currCap = 0
- for addr in component.list("mfsu") do
- capCheck = component.proxy(addr).getCapacity()
- currCap = currCap + capCheck
- end
- return currCap
- end
- local function checkOutput()
- local ertpert = 0
- for addr in component.list("mfsu") do
- ertpertCheck = component.proxy(addr).getOutput()
- ertpert = ertpert + ertpertCheck
- end
- return ertpert
- end
- local function checkOffered()
- local offered = 0
- for addr in component.list("mfsu") do
- offerCheck = component.proxy(addr).getOfferedEnergy()
- offered = offered + offerCheck
- end
- return offered
- end
- local function easynum(num, places)
- local ret
- local placeValue = ("%%.%df"):format(places or 0)
- if not num then
- return 0
- elseif num >= 1000000000000 then
- ret = placeValue:format(num / 1000000000000) .. "T" -- trillion
- elseif num >= 1000000000 then
- ret = placeValue:format(num / 1000000000) .. "B" -- billion
- elseif num >= 1000000 then
- ret = placeValue:format(num / 1000000) .. "M" -- million
- elseif num >= 1000 then
- ret = placeValue:format(num / 1000) .. "k" -- thousand
- else
- ret = num -- hundreds
- end
- return ret
- end
- pr.setTitle("Reactor Status")
- pr.writeln("Current Heat:")
- pr.writeln(tostring(icr.getHeat()))
- pr.writeln("Critical Mass Heat:")
- pr.writeln(tostring(icr.getMaxHeat()))
- pr.writeln("Current EU/t Value:")
- pr.writeln(tostring(icr.getReactorEUOutput()))
- pr.writeln("Current Energy Output:")
- pr.writeln(tostring(icr.getReactorEnergyOutput()))
- pr.writeln("Current Energy Stored:")
- pr.writeln(tostring(easynum(checkBatt())))
- pr.writeln("Current Energy Capacity:")
- pr.writeln(tostring(easynum(checkCapacity())))
- pr.writeln("Current Energy Output:")
- pr.writeln(tostring(easynum(checkOutput())))
- pr.writeln("Maximum Energy Output:")
- pr.writeln(tostring(easynum(checkOffered())))
- pr.writeln(" ")
- pr.writeln("Pretend Timestamp") -- Make sure you comment this one out
- -- if using the timeapi timestamp.
- -- pr.writeln(timeapi.date("%25m-%25d-%25Y%20%25R") .. " UTC")
- local prnt, err = pr.print()
- if not prnt then
- io.stderr:write(err)
- end
- pr.clear()
- pr.setTitle(" ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement