9551

reakt beta

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