Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local loopTime = 2
- local SCREEN = nil;
- local periList = peripheral.getNames()
- for i = 1, #periList do
- print("I have a "..peripheral.getType(periList[i]).." attached as \""..periList[i].."\".")
- if peripheral.getType(periList[i]) == "monitor" then
- SCREEN = peripheral.wrap( periList[i] );
- end
- end
- if SCREEN == nil then
- write("No screen found!");
- return;
- end
- local WL_LOADED = os.loadAPI("remote_reactor.lua");
- if WL_LOADED then
- _G["RR"] = _G["remote_reactor.lua"];
- _G["remote_reactor.lua"] = nil;
- end
- write("Terrah remote API: " .. tostring( WL_LOADED ) .. "\n" );
- for k,v in pairs( _G ) do
- if k == "RR" then
- print(k.." " .. tostring(v));
- end
- end
- local function eventHandler()
- while not finished do
- event, arg1, arg2, arg3, arg4, arg5 = os.pullEvent()
- if event == "monitor_touch" then
- sideClick, xClick, yClick = arg1, math.floor(arg2), math.floor(arg3)
- elseif event == "char" then
- local ch = string.lower(arg1)
- end
- end
- end
- local function pad(start, str, x)
- if str == nil then
- return start;
- end
- str = tostring(str);
- str = str:gsub(" ", "" );
- local ret = "";
- local amount = (x-1) - ( start:len()+str:len() );
- if amount > 0 then
- for i = 0, amount do
- ret = ret .. " ";
- end
- end
- return start .. ret .. str;
- end
- local function xtonumber( str )
- if str == nil or str == "" then
- return 0;
- end
- local ret = tonumber(str);
- if ret == nil then
- return 0;
- end
- return ret;
- end
- function main()
- local x, y = SCREEN.getSize();
- print("x: " .. x);
- print("y: " .. y);
- while not finished do
- term.redirect(SCREEN);
- --SCREEN.clear();
- SCREEN.setCursorPos(x,0);
- SCREEN.setTextColor(1024);
- --print("~Terrah Swag Console");
- print( pad("FLATCHEST STATUS:", "JUSTICE!",x) );
- for i = 0, x do
- SCREEN.write("-");
- end
- local proc_f = xtonumber(RR.Call( "getFuelAmount" ));
- local proc_w = xtonumber(RR.Call( "getWasteAmount" ));
- local fuelrods = xtonumber(RR.Call( "getNumberOfControlRods" ));
- local top = proc_w+proc_f;
- local depetion = (proc_w/top)*100;
- local rodslevel = 0;
- local currentrod = 0;
- for n = 1, fuelrods do
- currentrod = RR.Call( "getControlRodLevel", n-1 );
- if currentrod == nil then
- break;
- end
- rodslevel = rodslevel + tonumber(currentrod);
- end
- local rodstaus = rodslevel/fuelrods;
- SCREEN.setTextColor(1);
- SCREEN.setTextScale(1);
- print( pad( "ENERGY:",tostring(RR.Call( "getEnergyStored" )) .. "/10000000",x) );
- print( pad("RF/t:", tostring(RR.Call( "getEnergyProducedLastTick" )),x ) );
- print( pad("Fuel/t:", tostring(RR.Call( "getFuelConsumedLastTick" )),x ) );
- print( pad("CASING HEAT:", tostring(RR.Call( "getCasingTemperature" )) .. " C",x ) );
- print( pad("CORE HEAT:", tostring(RR.Call( "getFuelTemperature" )).. " C",x ) );
- print( pad("REACTIVITY:", tostring(RR.Call( "getFuelReactivity" )) .. "%",x ) );
- print( pad("DEPLETED:", depetion .. "%",x ) );
- print( pad("FUELRODS (" ..fuelrods.. "):", rodstaus .. "%",x) );
- print( pad("ACTIVE:", tostring(RR.Call( "getActive" )):upper(),x) );
- --term.redirect(term.native);
- sleep(loopTime);
- end
- end
- --paintutils.drawImage(paintutils.loadImage("kon"),0,0);
- while not finished do
- parallel.waitForAny(eventHandler, main)
- sleep(loopTime)
- end
- term.redirect(term.native);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement