Advertisement
9551

Untitled

Jun 21st, 2021
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.36 KB | None | 0 0
  1. local b = require("button")
  2. local m = peripheral.find("monitor")
  3. local r = peripheral.find("BigReactors-Reactor")
  4. local c = peripheral.find("minecraft:chest")
  5. local ins = {peripheral.find("bigreactors:tileentityreactoraccessport")}
  6. local rin = ins[1]
  7. local rout = ins[2]
  8. local theme = {
  9.     ["dblack"] = colors.black,
  10.     ["dwhite"] = colors.white,
  11.     ["dcyan"] = colors.cyan,
  12.     ["dgray"] = colors.gray,
  13.     ["dred"] = colors.red,
  14.     ["fred"] = "red",
  15.     ["fcyan"] = "cyan",
  16.     ["fblack"] = "black",
  17.     ["fgray"] = "gray",
  18.     ["fwhite"] = "white",
  19.     ["fgreen"] = "green",
  20.     ["borange"] = "1",
  21.     ["bgray"] = "7",
  22.     ["bwhite"] = "e",
  23.     ["bred"] = "r"
  24. }
  25. ----*peripheral check(--------
  26. if not m then
  27.     local otc = term.getBackgroundColor()
  28.     term.setBackgroundColor(theme["dblack"])
  29.     error("you dont have a monitor attached !", 0)
  30.     term.setBackgroundColor(otc)
  31. end
  32. if not r then
  33.     m.setCursorPos(2, 5)
  34.     m.setTextColor(theme["dwhite"])
  35.     m.setBackgroundColor(theme["dblack"])
  36.     m.clear()
  37.     m.setTextScale(2)
  38.     m.write("you dont have a reactor attached !")
  39.     error("no detected reactor !", 0)
  40. end
  41. if not c then
  42.     m.setCursorPos(2, 5)
  43.     m.setTextColor(theme["dwhite"])
  44.     m.setBackgroundColor(theme["dblack"])
  45.     m.clear()
  46.     m.setTextScale(1)
  47.     m.write("you dont have a chest attached !")
  48.     error("no chest detected !", 0)
  49. end
  50. if not rin then
  51.     m.setCursorPos(2, 5)
  52.     m.setTextColor(theme["dwhite"])
  53.     m.setBackgroundColor(theme["dblack"])
  54.     m.clear()
  55.     m.setTextScale(1)
  56.     m.write("no input/output port detected !")
  57.     error("no ports detected !", 0)
  58. end
  59. if (not rout) and rin then
  60.     m.setCursorPos(2, 5)
  61.     m.setTextColor(theme["dwhite"])
  62.     m.setBackgroundColor(theme["dblack"])
  63.     m.clear()
  64.     m.setTextScale(1)
  65.     m.write("no or 1 input/output port detected !")
  66.     error("no or 1 port detected !", 0)
  67. end
  68. ----*peripheral check)--------
  69. local mname = peripheral.getName(m)
  70. m.setTextScale(0.5)
  71. m.clear()
  72. m.setBackgroundColor(theme["dcyan"])
  73. b.frame(mname, 3, 19, 97, 18, theme["fwhite"], theme["fcyan"], false)
  74. b.frame(mname, 30, 20, 40, 5, theme["fwhite"], theme["fred"], true)
  75. m.setCursorPos(42, 20)
  76. m.blit("reakt by 9551", string.rep(theme["borange"], 13), string.rep(theme["bgray"], 13))
  77. m.setCursorPos(37, 21)
  78. m.blit("reactor control program", string.rep(theme["borange"], 23), string.rep(theme["bgray"], 23))
  79. m.setCursorPos(38, 28)
  80. m.write("default peripherals used \25")
  81. m.setBackgroundColor(theme["dred"])
  82. m.setCursorPos(36, 29)
  83. m.write("reactor: " .. peripheral.getName(r))
  84. m.setCursorPos(36, 30)
  85. m.write("monitor: " .. peripheral.getName(m))
  86. m.setCursorPos(36, 31)
  87. m.write("chest: " .. peripheral.getName(c))
  88. local function topline()
  89.     b.frame(mname, 5, 6, 70, 1, theme["fblack"], theme["fblack"])
  90.     m.setCursorPos(6, 6)
  91.     m.write("main")
  92.     m.setCursorPos(11, 6)
  93.     m.write("fuels")
  94.     m.setCursorPos(17, 6)
  95.     m.write("chest")
  96.     m.setCursorPos(23, 6)
  97.     m.write("rod control")
  98.     m.setCursorPos(35, 6)
  99.     m.write("energy control")
  100.     m.setCursorPos(50, 6)
  101.     m.write("energy info")
  102. end
  103. local function setcol(x, text)
  104.     local oldcol = m.getBackgroundColor()
  105.     m.setBackgroundColor(theme["dgray"])
  106.     m.setCursorPos(x + 1, 6)
  107.     m.write(text)
  108.     m.setBackgroundColor(oldcol)
  109. end
  110. local function maincard(x, text)
  111.     topline()
  112.     local oldcol = m.getBackgroundColor()
  113.     m.setBackgroundColor(theme["dcyan"])
  114.     b.frame(mname, 5, 22, 70, 14, theme["fblack"], theme["fgray"], true)
  115.     m.setBackgroundColor(theme["dgray"])
  116.     b.frame(mname, x + 2, 8, #text - 1, 1, theme["fgray"], theme["fgray"])
  117.     setcol(x, text)
  118.     m.setBackgroundColor(oldcol)
  119. end
  120. local function menuButtons()
  121.     local click = b.timetouch(1, mname)
  122.     b.menu(mname, click, 1, 81, 7, theme["fblack"], theme["fred"], "main", "main", true, 5)
  123.     b.menu(mname, click, 2, 81, 8, theme["fblack"], theme["fred"], "fuels", "fuels", true, 10)
  124.     b.menu(mname, click, 3, 81, 9, theme["fblack"], theme["fred"], "chest", "chest", true, 16)
  125.     b.menu(mname, click, 4, 81, 10, theme["fblack"], theme["fred"], "rod control", "rod control", true, 22)
  126.     b.menu(mname, click, 5, 81, 11, theme["fblack"], theme["fred"], "energy control", "energy control", true, 34)
  127.     b.menu(mname, click, 6, 81, 12, theme["fblack"], theme["fred"], "energy info", "energy info", true, 49)
  128.     --------------*settings menu--------------
  129.     b.menu(mname, click, 7, 81, 24, theme["fwhite"], theme["fgreen"], "peripherals", "peripherals", true, 49)
  130.  
  131.     local out = b.menudata()
  132.     if (type(out[2]) == "number") and (out[1]) then
  133.         maincard(out[2], out[1])
  134.     end
  135. end
  136. sleep(1)
  137.  
  138. local function clears()
  139.     local oldcol = m.getBackgroundColor()
  140.     m.setBackgroundColor(theme["dcyan"])
  141.     m.clear()
  142.     m.setBackgroundColor(oldcol)
  143. end
  144.  
  145. local function basemenu()
  146.     m.setBackgroundColor(theme["dcyan"])
  147.     b.frame(mname, 3, 20, 97, 18, theme["fblack"], theme["fcyan"], true)
  148.     b.frame(mname, 80, 20, 15, 15, theme["fblack"], theme["fcyan"], true)
  149.     b.frame(mname, 80, 20, 16, 15, theme["fwhite"], theme["fcyan"], true)
  150.     b.frame(mname, 81, 29, 14, 5, theme["fred"], theme["fblack"], false)
  151.     m.setCursorPos(81, 24)
  152.     m.blit("settings", string.rep(theme["bred"], 8), string.rep(theme["bwhite"], 8))
  153. end
  154. basemenu()
  155. topline()
  156. while true do
  157.     menuButtons()
  158. end
  159.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement