Advertisement
9551

Untitled

Jun 29th, 2021 (edited)
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 21.90 KB | None | 0 0
  1. local arg = ...
  2. if arg ~= "noreq" then
  3.     b = require("button")
  4.     s = require("strings")
  5. end
  6. local m = peripheral.find("monitor")
  7. local r = peripheral.find("BigReactors-Reactor")
  8. local c = peripheral.find("minecraft:chest")
  9. local ins = {peripheral.find("bigreactors:tileentityreactoraccessport")}
  10. local rin = ins[1]
  11. local rout = ins[2]
  12. local tArgs = { ... }
  13. local updatespeed = 1 --*higher speeds look better but buttons are less responsive #default = 1 max = ~,min = 0.08
  14. local bootime = 1
  15. local theme = {
  16.     ["dblack"] = colors.black,
  17.     ["dwhite"] = colors.white,
  18.     ["dcyan"] = colors.cyan,
  19.     ["dgray"] = colors.gray,
  20.     ["dred"] = colors.red,
  21.     ["dgreen"] = colors.green,
  22.     ["dblue"] = colors.blue,
  23.     ["dyellow"] = colors.yellow,
  24.     ["dorange"] = colors.orange,
  25.     ["fred"] = "red",
  26.     ["fcyan"] = "cyan",
  27.     ["fblack"] = "black",
  28.     ["fgray"] = "gray",
  29.     ["fwhite"] = "white",
  30.     ["fgreen"] = "green",
  31.     ["fblue"] = "blue",
  32.     ["fyellow"] = "yellow",
  33.     ["forange"] = "orange",
  34.     ["borange"] = "1",
  35.     ["bgray"] = "7",
  36.     ["bwhite"] = "0",
  37.     ["bred"] = "e",
  38.     ["bblack"] = "f"
  39. }
  40.  
  41. local bcols = {
  42.     "white",
  43.     "orange",
  44.     "magenta",
  45.     "light_blue",
  46.     "yellow",
  47.     "lime",
  48.     "pink",
  49.     "gray"
  50. }
  51. if tArgs[2] then
  52.     m = peripheral.wrap(tArgs[1])
  53.     r = peripheral.wrap(tArgs[2])
  54.     c = peripheral.wrap(tArgs[3])
  55.     rin = peripheral.wrap(tArgs[4])
  56.     rout = peripheral.wrap(tArgs[5])
  57. else
  58. if arg ~= nil then
  59.     print("entered configuration mode press enter to exit")
  60.     print("to skip peripheral just write s\n")
  61.     print("peripherals list:")
  62.     textutils.pagedTabulate(peripheral.getNames())
  63.     print("")
  64.     print("enter your monitor")
  65.     local ins = read()
  66.     if ins ~= "s" then
  67.         m = peripheral.wrap(ins)
  68.     end
  69.     local function cancel()
  70.         if ins == "" then
  71.             error("canceled", 0)
  72.         end
  73.     end
  74.     cancel()
  75.     print("enter your reactor")
  76.     local ins = read()
  77.     if ins ~= "s" then
  78.         r = peripheral.wrap(ins)
  79.     end
  80.     print("enter your chest")
  81.     local ins = read()
  82.     if ins ~= "s" then
  83.         c = peripheral.wrap(ins)
  84.     end
  85.     print("enter your input reactor port")
  86.     local ins = read()
  87.     if ins ~= "s" then
  88.         rin = peripheral.wrap(ins)
  89.     end
  90.     print("enter your output reactor port")
  91.     local ins = read()
  92.     if ins ~= "s" then
  93.         rout = peripheral.wrap(ins)
  94.     end
  95.     end
  96. end
  97. ----*peripheral check(--------
  98. if not m then
  99.     local otc = term.getBackgroundColor()
  100.     term.setBackgroundColor(theme["dblack"])
  101.     error("you dont have a monitor attached !", 0)
  102.     term.setBackgroundColor(otc)
  103. end
  104. m.setBackgroundColor(theme["dcyan"])
  105. if not r then
  106.     m.setCursorPos(2, 5)
  107.     m.setTextColor(theme["dwhite"])
  108.     m.setBackgroundColor(theme["dblack"])
  109.     m.clear()
  110.     m.setTextScale(2)
  111.     m.write("you dont have a reactor attached !")
  112.     error("no detected reactor !", 0)
  113. end
  114. if not c then
  115.     m.setCursorPos(2, 5)
  116.     m.setTextColor(theme["dwhite"])
  117.     m.setBackgroundColor(theme["dblack"])
  118.     m.clear()
  119.     m.setTextScale(1)
  120.     m.write("you dont have a chest attached !")
  121.     error("no chest detected !", 0)
  122. end
  123. if not rin then
  124.     m.setCursorPos(2, 5)
  125.     m.setTextColor(theme["dwhite"])
  126.     m.setBackgroundColor(theme["dblack"])
  127.     m.clear()
  128.     m.setTextScale(1)
  129.     m.write("no input/output port detected !")
  130.     error("no ports detected !", 0)
  131. end
  132. if (not rout) and rin then
  133.     m.setCursorPos(2, 5)
  134.     m.setTextColor(theme["dwhite"])
  135.     m.setBackgroundColor(theme["dblack"])
  136.     m.clear()
  137.     m.setTextScale(1)
  138.     m.write("no or 1 input/output port detected !")
  139.     error("no or 1 port detected !", 0)
  140. end
  141. ----*peripheral check)--------
  142. local mname = peripheral.getName(m)
  143. m.setTextScale(0.5)
  144. m.clear()
  145. m.setBackgroundColor(theme["dcyan"])
  146. m.setTextColor(theme["dcyan"])
  147. b.frame(mname, 3, 19, 97, 18, theme["fwhite"], theme["fcyan"], false)
  148. b.frame(mname, 30, 20, 40, 5, theme["fwhite"], theme["fred"], true)
  149. m.setCursorPos(42, 20)
  150. m.blit("reakt by 9551", string.rep(theme["borange"], 13), string.rep(theme["bgray"], 13))
  151. m.setCursorPos(37, 21)
  152. m.setBackgroundColor(theme["dred"])
  153. m.setTextColor(theme["dblack"])
  154. m.blit("reactor control program", string.rep(theme["borange"], 23), string.rep(theme["bgray"], 23))
  155. m.setCursorPos(38, 28)
  156. m.write("default peripherals used \25")
  157. m.setCursorPos(36, 29)
  158. m.write("reactor: " .. peripheral.getName(r))
  159. m.setCursorPos(36, 30)
  160. m.write("monitor: " .. peripheral.getName(m))
  161. m.setCursorPos(36, 31)
  162. m.write("chest: " .. peripheral.getName(c))
  163. m.setCursorPos(36, 32)
  164. m.write("r. in: " .. peripheral.getName(rin))
  165. m.setCursorPos(36, 33)
  166. m.write("r. out: " .. peripheral.getName(rout))
  167. local function topline()
  168.     b.frame(mname, 5, 6, 70, 1, theme["fblack"], theme["fblack"])
  169.     m.setTextColor(theme["dblack"])
  170.     m.setCursorPos(6, 6)
  171.     m.write("main")
  172.     m.setCursorPos(11, 6)
  173.     m.write("fuels")
  174.     m.setCursorPos(17, 6)
  175.     m.write("chest")
  176.     m.setCursorPos(23, 6)
  177.     m.write("rod control")
  178.     m.setCursorPos(35, 6)
  179.     m.write("energy control")
  180.     m.setCursorPos(50, 6)
  181.     m.write("energy info")
  182.     m.setCursorPos(62, 6)
  183.     m.write("settings")
  184. end
  185. local function setcol(x, text)
  186.     local oldcol = m.getBackgroundColor()
  187.     m.setBackgroundColor(theme["dgray"])
  188.     m.setCursorPos(x + 1, 6)
  189.     m.write(text)
  190.     m.setBackgroundColor(oldcol)
  191. end
  192. local function maincard(x, text)
  193.     topline()
  194.     local oldcol = m.getBackgroundColor()
  195.     m.setBackgroundColor(theme["dcyan"])
  196.     b.frame(mname, 5, 22, 70, 14, theme["fblack"], theme["fgray"], true)
  197.     m.setBackgroundColor(theme["dgray"])
  198.     m.setCursorPos(x+1,8)
  199.     m.blit(string.rep(" ",#text),string.rep(theme["bgray"],#text),string.rep(theme["bgray"],#text))
  200.     m.setCursorPos(x+1,7)
  201.     m.blit(string.rep(" ",#text),string.rep(theme["bgray"],#text),string.rep(theme["bgray"],#text))
  202.     m.setTextColor(theme["dblack"])
  203.     m.setCursorPos(x+#text,7)
  204.     m.write("\149")
  205.     setcol(x, text)
  206.     m.setBackgroundColor(oldcol)
  207. end
  208. local function basemenu()
  209.     m.setBackgroundColor(theme["dcyan"])
  210.     b.frame(mname, 3, 20, 97, 18, theme["fblack"], theme["fcyan"], true)
  211.     b.frame(mname, 80, 20, 15, 15, theme["fblack"], theme["fcyan"], true)
  212.     b.frame(mname, 80, 20, 16, 15, theme["fblack"], theme["fcyan"], true)
  213.     b.frame(mname, 81, 18, 14, 5, theme["fred"], theme["fblack"], false)
  214.     m.setCursorPos(81, 13)
  215.     m.blit("system", string.rep(theme["bwhite"], 6), string.rep(theme["bred"], 6))
  216.  
  217.     b.frame(mname, 81, 29, 14, 5, theme["fred"], theme["fblack"], false)
  218.     m.setCursorPos(81, 24)
  219.     m.blit("settings", string.rep(theme["bwhite"], 8), string.rep(theme["bred"], 8))
  220. end
  221. local function menuButtons(click)
  222.     local oci = m.getBackgroundColor()
  223.     local ocii = m.getTextColor()
  224.     m.setBackgroundColor(theme["dblack"])
  225.     m.setTextColor(theme["dwhite"])
  226.     m.setCursorPos(81, 6)
  227.     m.write("TABS \25")
  228.     m.setBackgroundColor(oci)
  229.     m.setTextColor(ocii)
  230.     b.menu(mname, click, 1, 81, 7, theme["fblack"], theme["fred"], "main", "main", true, 5)
  231.     b.menu(mname, click, 2, 81, 8, theme["fblack"], theme["fred"], "fuels", "fuels", true, 10)
  232.     b.menu(mname, click, 3, 81, 9, theme["fblack"], theme["fred"], "chest", "chest", true, 16)
  233.     b.menu(mname, click, 4, 81, 10, theme["fblack"], theme["fred"], "rod control", "rod control", true, 22)
  234.     b.menu(mname, click, 5, 81, 11, theme["fblack"], theme["fred"], "energy control", "energy control", true, 34)
  235.     b.menu(mname, click, 6, 81, 12, theme["fblack"], theme["fred"], "energy info", "energy info", true, 49)
  236.  
  237.     --------------*settings menu--------------
  238.     m.setBackgroundColor(theme["dblack"])
  239.     b.menu(mname, click, 7, 81, 25, theme["fwhite"], theme["fgreen"], "peripherals", "peripherals", true, 61)
  240.     b.menu(mname, click, 8, 81, 26, theme["fwhite"], theme["fgreen"], "reactor set.", "reactor set.", true, 61)
  241.     --*---------------------------------------
  242.     m.setTextColor(theme["dwhite"])
  243.     if b.button(mname, click, 81, 14, ">shutdown<") then
  244.         m.setBackgroundColor(theme["dblack"])
  245.         m.setTextColor(theme["dwhite"])
  246.         m.clear()
  247.         m.setCursorPos(70, 14)
  248.         m.write("shutting down.")
  249.         sleep(bootime / 3)
  250.         m.setCursorPos(70, 14)
  251.         m.write("shutting down..")
  252.         sleep(bootime / 3)
  253.         m.setCursorPos(70, 14)
  254.         m.write("shutting down...")
  255.         sleep(bootime / 3)
  256.         m.clear()
  257.         os.shutdown()
  258.     end
  259.     if b.button(mname, click, 81, 15, ">reboot<") then
  260.         m.setBackgroundColor(theme["dblack"])
  261.         m.setTextColor(theme["dwhite"])
  262.         m.clear()
  263.         m.setCursorPos(70, 14)
  264.         m.write("rebooting.")
  265.         sleep(bootime / 3)
  266.         m.setCursorPos(70, 14)
  267.         m.write("rebooting..")
  268.         sleep(bootime / 3)
  269.         m.setCursorPos(70, 14)
  270.         m.write("rebooting...")
  271.         sleep(bootime / 3)
  272.         m.clear()
  273.         os.reboot()
  274.     end
  275.     if b.button(mname, click, 81, 16, ">upd. reakt<") then
  276.         shell.run("rename reactor.lua oldreakt")
  277.         shell.run("pastebin get 9kNdJ0DH reactor.lua")
  278.         shell.run("rm oldreakt")
  279.         os.reboot()
  280.     end
  281.     if b.button(mname, click, 81, 17, ">multi reakt<") then
  282.         _G.b = {}
  283.         _G.s = {}
  284.         for k,v in pairs(b) do
  285.             _G.b[k] = v
  286.         end
  287.         for k,v in pairs(s) do
  288.             _G.s[k] = v
  289.         end
  290.         multishell.launch({},"./reactor.lua","noreq")
  291.         m.clear()
  292.         m.setBackgroundColor(theme["dred"])
  293.         m.setTextColor(theme["dwhite"])
  294.         m.setCursorPos(65,18)
  295.         m.write("continue the setup in the computer")
  296.         sleep(3)
  297.         basemenu()
  298.         topline()
  299.         menuButtons({"monitor_touch",mname,1000,1000})
  300.     end
  301.     m.setBackgroundColor(theme["dcyan"])
  302.     local out = b.menudata()
  303.     if (type(out[2]) == "number") and (out[1]) then
  304.         maincard(out[2], out[1])
  305.     end
  306. end
  307. sleep(bootime)
  308. basemenu()
  309. topline()
  310. --*-----------------main programs----------------
  311. local function mmain(click)
  312.     m.setBackgroundColor(theme["dgray"])
  313.     b.frame(mname,9,13,42,3,theme["fblack"],theme["fblue"],false)
  314.     m.setCursorPos(9,10)
  315.     m.blit("power (control rods)", string.rep(theme["bwhite"], 20), string.rep(theme["bblack"], 20))
  316.     b.sliderHor(mname,click,1,11,13,37,theme["fblue"],theme["fwhite"])
  317.     if (b.sliderHor("db",1)*2.75)-30 >= 0 then
  318.         local rods = (math.ceil(b.sliderHor("db",1)*2.75)-30)
  319.         r.setAllControlRodLevels(100-rods)
  320.         if rods < 20 then
  321.             m.setBackgroundColor(theme["dred"])
  322.         elseif rods < 40 then
  323.             m.setBackgroundColor(theme["dorange"])
  324.         elseif rods < 60 then
  325.             m.setBackgroundColor(theme["dyellow"])
  326.         elseif rods < 80 then
  327.         m.setBackgroundColor(theme["dcyan"])
  328.         else
  329.             m.setBackgroundColor(theme["dgreen"])
  330.         end
  331.         m.setCursorPos(b.sliderHor("db",1),12)
  332.         m.write(tostring(rods))
  333.     else
  334.         b.sliderHor("setdb",1,11)
  335.     end
  336.     local temp = math.floor(r.getFuelTemperature())
  337.     local energy = math.floor(r.getEnergyProducedLastTick()*10)
  338.     if maxtemp then
  339.         maxtemp = math.max(maxtemp,temp)
  340.     else
  341.         maxtemp = 0
  342.         maxtemp = math.max(maxtemp,temp)
  343.     end
  344.     if maxenergy then
  345.         maxenergy = math.max(maxenergy,energy)
  346.     else
  347.         maxenergy = 1
  348.         maxenergy = math.max(maxenergy,energy)
  349.     end
  350.     m.setBackgroundColor(theme["dgray"])
  351.     b.frame(mname,58,14,15,2,theme["fblack"],theme["fred"],false)
  352.     m.setTextColor(theme["dwhite"])
  353.     m.setBackgroundColor(theme["dred"])
  354.     if b.button(mname,click,62,13,"heat/C") then
  355.         maxtemp = math.floor(r.getFuelTemperature())
  356.     end
  357.     if b.button(mname,click,62,14,"energy") then
  358.         maxenergy =  math.floor(r.getEnergyProducedLastTick()*10)
  359.     end
  360.     if b.button(mname,click,62,15,"power") then
  361.         b.sliderHor("setdb",1,10)
  362.     end
  363.     m.setBackgroundColor(theme["dgray"])
  364.     m.setCursorPos(58,12)
  365.     m.blit("resets", string.rep(theme["bwhite"], 6), string.rep(theme["bblack"], 6))
  366.     m.setTextColor(theme["dwhite"])
  367.     m.setCursorPos(61,10)
  368.     m.write("reactor:")
  369.     b.frame(mname,70,10,4,1,theme["fblack"],theme["fblue"])
  370.     b.switchn(mname,1,click,70,10,theme["fred"],theme["fgreen"],theme["fwhite"],"off","on")
  371.     r.setActive(b.switchn("db",1))
  372.     b.bar(mname,9,25,12,8,temp,maxtemp,theme["fgray"],theme["fred"],theme["fblack"],true,true,"",false,true,false)
  373.     b.bar(mname,23,25,14,8,energy,maxenergy,theme["fgray"],theme["fyellow"],theme["fblack"],true,true,"",false,true,false)
  374.     b.bar(mname,39,25,12,8,math.floor((r.getFuelAmount()/1000)),math.floor(r.getFuelAmountMax()/1000),theme["fgray"],theme["fgreen"],theme["fblack"],true,true,"B",false,true,false)
  375.     m.setCursorPos(9,17)
  376.     m.blit("heat", string.rep(theme["bwhite"], 4), string.rep(theme["bblack"], 4))
  377.     m.setCursorPos(23,17)
  378.     m.blit("RF/S", string.rep(theme["bwhite"], 4), string.rep(theme["bblack"], 4))
  379.     m.setCursorPos(39,17)
  380.     m.blit("fuel", string.rep(theme["bwhite"], 4), string.rep(theme["bblack"], 4))
  381.    
  382.  
  383.     b.frame(mname,52,22,22,5,theme["fblack"],theme["fred"],false)
  384.     m.setCursorPos(52,17)
  385.     m.blit("main info", string.rep(theme["bwhite"], 9), string.rep(theme["bblack"], 9))
  386.     m.setBackgroundColor(theme["dred"])
  387.     m.setTextColor(theme["dwhite"])
  388.     m.setCursorPos(52,18)
  389.     m.write("reactivity: "..math.floor(r.getFuelReactivity()).."%")
  390.     m.setCursorPos(52,19)
  391.     m.write("energy out: "..math.floor(r.getEnergyProducedLastTick()).."rf/t")
  392.     m.setCursorPos(52,20)
  393.     m.write("fuel: "..math.floor(r.getFuelAmount()).."mb")
  394.     m.setCursorPos(52,21)
  395.     m.write("fuel temp: "..math.floor(r.getFuelTemperature()).."C")
  396.     m.setCursorPos(52,22)
  397.     m.write("casing temp: "..math.floor(r.getCasingTemperature()).."C")
  398.     m.setCursorPos(52,23)
  399.     m.write("terp diff: "..math.floor(r.getFuelTemperature()-r.getCasingTemperature()).."C")
  400.     m.setCursorPos(52,24)
  401.     m.write("waste out: "..s.ensure_width(tostring(r.getFuelConsumedLastTick()),6).."mb/t")
  402.     m.setCursorPos(52,25)
  403.     m.write("waste: "..math.floor(r.getWasteAmount()).."mb")
  404.     m.setBackgroundColor(theme["dgray"])
  405.     b.bar(mname,52,31,22,3,r.getEnergyStored(),r.getEnergyCapacity(),"gray","red","black",true,true,"",false,true,false)
  406.     m.setCursorPos(52,28)
  407.     m.blit("energy storage", string.rep(theme["bwhite"], 14), string.rep(theme["bblack"], 14))
  408. end
  409. local function mpers(click)
  410.     local function selection(ins)
  411.         while true do
  412.             local click = b.timetouch(updatespeed, mname)
  413.             m.setBackgroundColor(theme["dgray"])
  414.             b.frame(mname, 8, 22, 63, 12, theme["fblack"], theme["fblue"], false)
  415.             m.setBackgroundColor(theme["dred"])
  416.             m.setCursorPos(22, 10)
  417.             m.write("what kind of peripheral is this ?")
  418.             m.setCursorPos(20, 11)
  419.             m.write(ins)
  420.             if b.button(mname, click, 35, 21, "|BACK|") then
  421.                 break
  422.             end
  423.             m.setBackgroundColor(theme["dgreen"])
  424.             if b.button(mname, click, 28, 15, "monitor") then
  425.                 m.setBackgroundColor(theme["dblack"])
  426.                 m.clear()
  427.                 m.setBackgroundColor(theme["dcyan"])
  428.                 m = peripheral.wrap(ins)
  429.                 m.setTextScale(0.5)
  430.                 mname = ins
  431.                 menuButtons(click)
  432.                 basemenu()
  433.                 topline()
  434.                 break
  435.             end
  436.             if b.button(mname, click, 36, 15, "reactor") then
  437.                 r = peripheral.wrap(ins)
  438.                 break
  439.             end
  440.             if b.button(mname, click, 40, 17, "r. input <") then
  441.                 rin = peripheral.wrap(ins)
  442.                 break
  443.             end
  444.             if b.button(mname, click, 28, 17, "r. output >") then
  445.                 rout = peripheral.wrap(rout)
  446.                 break
  447.             end
  448.             if b.button(mname, click, 44, 15, "chest") then
  449.                 c = peripheral.wrap(ins)
  450.                 break
  451.             end
  452.         end
  453.     end
  454.     m.setBackgroundColor(theme["dgray"])
  455.     b.frame(mname, 8, 22, 30, 12, theme["fblack"], theme["fgreen"], false)
  456.     b.frame(mname, 41, 22, 30, 12, theme["fblack"], theme["fred"], false)
  457.     m.setBackgroundColor(theme["dgreen"])
  458.     b.frame(mname, 10, 14, 26, 2, theme["fblack"], theme["fblue"], false)
  459.     m.setCursorPos(10, 12)
  460.     m.blit("monitor :", string.rep(theme["bwhite"], 9), string.rep(theme["bblack"], 9))
  461.     b.frame(mname, 10, 19, 26, 2, theme["fblack"], theme["fblue"], false)
  462.     m.setCursorPos(10, 17)
  463.     m.blit("reactor :", string.rep(theme["bwhite"], 9), string.rep(theme["bblack"], 9))
  464.     b.frame(mname, 10, 24, 26, 2, theme["fblack"], theme["fblue"], false)
  465.     m.setCursorPos(10, 22)
  466.     m.blit("chest :", string.rep(theme["bwhite"], 7), string.rep(theme["bblack"], 7))
  467.     b.frame(mname, 10, 30, 26, 3, theme["fblack"], theme["fblue"], false)
  468.     m.setCursorPos(10, 27)
  469.     m.blit("input/output :", string.rep(theme["bwhite"], 14), string.rep(theme["bblack"], 14))
  470.  
  471.     m.setCursorPos(8, 10)
  472.     m.blit("active :", string.rep(theme["bwhite"], 8), string.rep(theme["bblack"], 8))
  473.     m.setCursorPos(41, 10)
  474.     m.blit("all found :", string.rep(theme["bwhite"], 11), string.rep(theme["bblack"], 11))
  475.     m.setBackgroundColor(theme["dblue"])
  476.     m.setCursorPos(11, 14)
  477.     m.write(peripheral.getName(m))
  478.     m.setCursorPos(11, 19)
  479.     m.write(peripheral.getName(r))
  480.     m.setCursorPos(11, 24)
  481.     m.write(peripheral.getName(c))
  482.     m.setCursorPos(11, 29)
  483.     m.write("I: " .. string.sub(peripheral.getName(rin), 23))
  484.     m.setCursorPos(11, 31)
  485.     m.write("O: " .. string.sub(peripheral.getName(rout), 23))
  486.     local pers = peripheral.getNames()
  487.     local sc = 11
  488.     m.setTextColor(theme["dblack"])
  489.     m.setBackgroundColor(theme["dred"])
  490.     for i = 1, #pers do
  491.         if peripheral.getType(pers[i]) == "bigreactors:tileentityreactoraccessport" then
  492.             pers[i] = string.sub(pers[i], 23)
  493.         end
  494.         if b.button(mname, click, 42, sc + i, pers[i]) then
  495.             if s.ensure_width(pers[i], 18) == "reactoraccessport_" then
  496.                 pers[i] = "bigreactors:tileentityreactoraccessport_" .. string.sub(pers[i], 19)
  497.             end
  498.             selection(pers[i])
  499.         end
  500.     end
  501. end
  502. local function mfuel(click)
  503.     b.frame(mname, 30, 20, 10, 5, theme["fblack"], theme["fgray"], true)
  504. end
  505. local function mchest(click)
  506.     b.frame(mname, 30, 20, 10, 5, theme["fblack"], theme["fgray"], true)
  507. end
  508. local function mrod(click)
  509.     b.frame(mname, 30, 20, 10, 5, theme["fblack"], theme["fgray"], true)
  510. end
  511. local function menergyc(click)
  512.     b.frame(mname, 30, 20, 10, 5, theme["fblack"], theme["fgray"], true)
  513. end
  514. local function menergyi(click)
  515.     b.frame(mname, 30, 20, 10, 5, theme["fblack"], theme["fgray"], true)
  516. end
  517. local function mreactor(click)
  518.     b.frame(mname, 30, 20, 10, 5, theme["fblack"], theme["fgray"], true)
  519. end
  520. --*----------------------------------------------
  521. local function peripheralsmenu()
  522.     local oc = m.getBackgroundColor()
  523.     repeat
  524.         local ins = b.menudata()
  525.         local click = b.timetouch(updatespeed, mname)
  526.         menuButtons(click)
  527.         mpers(click)
  528.     until ins ~= "peripherals"
  529.     m.setBackgroundColor(oc)
  530. end
  531. local function main()
  532.     local oc = m.getBackgroundColor()
  533.     repeat
  534.         local ins = b.menudata()
  535.         local click = b.timetouch(updatespeed, mname)
  536.         menuButtons(click)
  537.         mmain(click)
  538.     until ins ~= "main"
  539.     m.setBackgroundColor(oc)
  540. end
  541. local function fuels()
  542.     local oc = m.getBackgroundColor()
  543.     repeat
  544.         local ins = b.menudata()
  545.         local click = b.timetouch(updatespeed, mname)
  546.         menuButtons(click)
  547.         mfuel(click)
  548.     until ins ~= "fuels"
  549.     m.setBackgroundColor(oc)
  550. end
  551. local function chest()
  552.     local oc = m.getBackgroundColor()
  553.     repeat
  554.         local ins = b.menudata()
  555.         local click = b.timetouch(updatespeed, mname)
  556.         menuButtons(click)
  557.         mchest(click)
  558.     until ins ~= "chest"
  559.     m.setBackgroundColor(oc)
  560. end
  561. local function rodcontrol()
  562.     local oc = m.getBackgroundColor()
  563.     repeat
  564.         local ins = b.menudata()
  565.         local click = b.timetouch(updatespeed, mname)
  566.         menuButtons(click)
  567.         mrod(click)
  568.     until ins ~= "rod control"
  569.     m.setBackgroundColor(oc)
  570. end
  571. local function energyc()
  572.     local oc = m.getBackgroundColor()
  573.     repeat
  574.         local ins = b.menudata()
  575.         local click = b.timetouch(updatespeed, mname)
  576.         menuButtons(click)
  577.         menergyc(click)
  578.     until ins ~= "energy control"
  579.     m.setBackgroundColor(oc)
  580. end
  581. local function energyinf()
  582.     local oc = m.getBackgroundColor()
  583.     repeat
  584.         local ins = b.menudata()
  585.         local click = b.timetouch(updatespeed, mname)
  586.         menuButtons(click)
  587.         menergyi(click)
  588.     until ins ~= "energy info"
  589.     m.setBackgroundColor(oc)
  590. end
  591. local function reactorsettings()
  592.     local oc = m.getBackgroundColor()
  593.     repeat
  594.         local ins = b.menudata()
  595.         local click = b.timetouch(updatespeed, mname)
  596.         menuButtons(click)
  597.         mreactor(click)
  598.     until ins ~= "reactor set."
  599.     m.setBackgroundColor(oc)
  600. end
  601.  
  602. menuButtons({"monitor_touch", mname, 83, 7})
  603. while true do
  604.     local menuout = b.menudata()
  605.     if menuout[1] == "peripherals" then
  606.         peripheralsmenu()
  607.     end
  608.     if menuout[1] == "main" then
  609.         main()
  610.     end
  611.     if menuout[1] == "fuels" then
  612.         fuels()
  613.     end
  614.     if menuout[1] == "chest" then
  615.         chest()
  616.     end
  617.     if menuout[1] == "rod control" then
  618.         rodcontrol()
  619.     end
  620.     if menuout[1] == "energy control" then
  621.         energyc()
  622.     end
  623.     if menuout[1] == "energy info" then
  624.         energyinf()
  625.     end
  626.     if menuout[1] == "reactor set." then
  627.         reactorsettings()
  628.     end
  629. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement