Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...};
- local screen = "monitor_16"
- local RsInSide = "right"
- local RsOutSide = "top"
- local Nreactor1="BigReactors-Reactor_3"
- local Nreactor1 = "BigReactors-Reactor_11"
- local Nreactor2 = "BigReactors-Reactor_10"
- local Nreactor3 = "BigReactors-Reactor_9"
- local Nreactor4 = "BigReactors-Reactor_7"
- local Nreactor5 = "BigReactors-Reactor_8"
- local Nreactor6 = "BigReactors-Reactor_5"
- local Nreactor7 = "BigReactors-Reactor_6"
- local Nreactor8 = "BigReactors-Reactor_12"
- local Nturbine1 = "BigReactors-Turbine_1"
- local Nturbine2 = "BigReactors-Turbine_2"
- local Nturbine3 = "BigReactors-Turbine_3"
- local Nturbine4 = "BigReactors-Turbine_4"
- local Nturbine5 = "BigReactors-Turbine_5"
- local Nturbine6 = "BigReactors-Turbine_6"
- local Nturbine7 = "BigReactors-Turbine_7"
- local Nturbine8 = "BigReactors-Turbine_8"
- rednet.open("back");
- reactor1 = peripheral.wrap(Nreactor1);
- reactor2 = peripheral.wrap(Nreactor2);
- reactor3 = peripheral.wrap(Nreactor3);
- reactor4 = peripheral.wrap(Nreactor4);
- reactor5 = peripheral.wrap(Nreactor5);
- reactor6 = peripheral.wrap(Nreactor6);
- reactor7 = peripheral.wrap(Nreactor7);
- reactor8 = peripheral.wrap(Nreactor8);
- turbine1 = peripheral.wrap(Nturbine1);
- turbine2 = peripheral.wrap(Nturbine2);
- turbine3 = peripheral.wrap(Nturbine3);
- turbine4 = peripheral.wrap(Nturbine4);
- turbine5 = peripheral.wrap(Nturbine5);
- turbine6 = peripheral.wrap(Nturbine6);
- turbine7 = peripheral.wrap(Nturbine7);
- turbine8 = peripheral.wrap(Nturbine8);
- monitor = peripheral.wrap(screen);
- monitor.setBackgroundColor( colors.black );
- monitor.clear();
- function UIprint( wd, x, y, text, color )
- local a, b = wd.getCursorPos();
- wd.setTextColor( color );
- wd.setCursorPos( x, y );
- wd.write(text);
- monitor.setBackgroundColor( colors.black );
- wd.setCursorPos( a, b );
- end
- function UIHeader( wd, x, y, wx, wy, text, clr, txtclr )
- local r = window.create( wd, x, y, wx, wy );
- px = x + (wx / 2) - (math.floor(string.len(text) / 2));
- py = y + math.floor(wy/2);
- r.setBackgroundColor( clr );
- r.clear();
- UIprint(wd, px, py, text, txtclr );
- end
- function UILaserButton( wd, xl, yl, wxl, wyl, text1, text2, clr1, clr2, txtclr1, txtclr2 )
- local r = window.create( wd, xl, yl, wxl, wyl );
- pxl = xl + (wxl / 2) - (math.floor(string.len(text1) / 2));
- pyl = yl + 1
- if redstone.getInput(RsInSide) then
- r.setBackgroundColor( clr1 );
- r.clear();
- UIprint(wd, pxl, pyl, text1, txtclr1 );
- elseif not redstone.getInput(RsInSide) then
- r.setBackgroundColor( clr2 );
- r.clear();
- UIprint(wd, pxl, pyl, text2, txtclr2 );
- end
- end
- function UIButton( wd, x, y, wx, wy, text1, text2, clr1, clr2, txtclr1, txtclr2, machine )
- local r = window.create( wd, x, y, wx, wy );
- px = x + 1;
- py = y + math.floor(wy/2);
- if machine.getActive() then
- r.setBackgroundColor( clr1 );
- r.clear();
- UIprint(wd, px, py, text1, txtclr1 );
- else
- r.setBackgroundColor( clr2 );
- r.clear();
- UIprint(wd, px, py, text2, txtclr2 );
- end
- end
- function UIFrame( wd, x, y, wx, wy, clr )
- local f = window.create( wd, x, y, wx, wy );
- f.setBackgroundColor( clr );
- f.clear();
- end
- function Setmachine( machine )
- if machine.getActive() then
- machine.setActive(false);
- else
- machine.setActive(true);
- end
- end
- function UIPos( xPos, yPos, xMin, yMin, xWidth, yWidth, Machine)
- if xPos >= xMin then
- if xPos <= (xMin - 1 + xWidth) then
- if yPos >= yMin then
- if yPos <= (yMin + yWidth - 1) then
- Setmachine( Machine );
- end
- end
- end
- end
- end
- --Setup--
- local mw, mh = monitor.getSize()
- UIHeader( monitor, 1, 1, mw, 1, "REACTOR MAIN SWITCHES", colors.gray, colors.red);
- UIFrame( monitor, 1, 2, mw, 1, colors.gray);
- UIHeader( monitor, 1, 2, 11, 1, "Block", colors.gray, colors.white);
- UIHeader( monitor, 11, 2, 10, 1, "Status", colors.gray, colors.white);
- UIHeader( monitor, 20, 2, 12, 1, "Turbine", colors.gray, colors.white);
- UIprint( monitor, 2, 4, "Block 1-A:", colors.lightGray );
- UIprint( monitor, 2, 5, "Block 1-B:", colors.lightGray );
- UIprint( monitor, 2, 6, "Block 2-A:", colors.lightGray );
- UIprint( monitor, 2, 7, "Block 2-B:", colors.lightGray );
- UIprint( monitor, 2, 8, "Block 3-A:", colors.lightGray );
- UIprint( monitor, 2, 9, "Block 3-B:", colors.lightGray );
- UIprint( monitor, 2, 10, "Block 4-A:", colors.lightGray );
- UIprint( monitor, 2, 11, "Block 4-B:", colors.lightGray );
- UIButton( monitor, 12, 4, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor1 );
- UIButton( monitor, 12, 5, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor2 );
- UIButton( monitor, 12, 6, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor3 );
- UIButton( monitor, 12, 7, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor4 );
- UIButton( monitor, 12, 8, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor5 );
- UIButton( monitor, 12, 9, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor6 );
- UIButton( monitor, 12, 10, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor7 );
- UIButton( monitor, 12, 11, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor8 );
- UIButton( monitor, 22, 4, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine1 );
- UIButton( monitor, 22, 5, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine2 );
- UIButton( monitor, 22, 6, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine3 );
- UIButton( monitor, 22, 7, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine4 );
- UIButton( monitor, 22, 8, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine5 );
- UIButton( monitor, 22, 9, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine6 );
- UIButton( monitor, 22, 10, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine7 );
- UIButton( monitor, 22, 11, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine8 );
- -- RUN --
- while true do
- event, side, xPos, yPos = os.pullEvent("monitor_touch");
- if event == "monitor_touch" then
- UIPos( xPos, yPos, 12, 4, 9, 1, reactor1 );
- UIButton( monitor, 12, 4, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor1 );
- UIPos( xPos, yPos, 12, 5, 9, 1, reactor2 );
- UIButton( monitor, 12, 5, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor2 );
- UIPos( xPos, yPos, 12, 6, 9, 1, reactor3 );
- UIButton( monitor, 12, 6, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor3 );
- UIPos( xPos, yPos, 12, 7, 9, 1, reactor4 );
- UIButton( monitor, 12, 7, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor4 );
- UIPos( xPos, yPos, 12, 8, 9, 1, reactor5 );
- UIButton( monitor, 12, 8, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor5 );
- UIPos( xPos, yPos, 12, 9, 9, 1, reactor6 );
- UIButton( monitor, 12, 9, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor6 );
- UIPos( xPos, yPos, 12, 10, 9, 1, reactor7 );
- UIButton( monitor, 12, 10, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor7 );
- UIPos( xPos, yPos, 12, 11, 9, 1, reactor8 );
- UIButton( monitor, 12, 11, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, reactor8 );
- -- Turbines
- UIPos( xPos, yPos, 22, 4, 9, 1, turbine1 );
- UIButton( monitor, 22, 4, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine1 );
- UIPos( xPos, yPos, 22, 5, 9, 1, turbine2 );
- UIButton( monitor, 22, 5, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine2 );
- UIPos( xPos, yPos, 22, 6, 9, 1, turbine3 );
- UIButton( monitor, 22, 6, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine3 );
- UIPos( xPos, yPos, 22, 7, 9, 1, turbine4 );
- UIButton( monitor, 22, 7, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine4 );
- UIPos( xPos, yPos, 22, 8, 9, 1, turbine5 );
- UIButton( monitor, 22, 8, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine5 );
- UIPos( xPos, yPos, 22, 9, 9, 1, turbine6 );
- UIButton( monitor, 22, 9, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine6 );
- UIPos( xPos, yPos, 22, 10, 9, 1, turbine7 );
- UIButton( monitor, 22, 10, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine7 );
- UIPos( xPos, yPos, 22, 11, 9, 1, turbine8 );
- UIButton( monitor, 22, 11, 9, 1, "online", "offline", colors.lime, colors.orange, colors.black, colors.black, turbine8 );
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement