Advertisement
9551

Untitled

Jun 21st, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.15 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. ----*peripheral check(--------
  9. if not m then
  10.     local otc = term.getBackgroundColor()
  11.     term.setBackgroundColor(colors.black)
  12.     error("you dont have a monitor attached !", 0)
  13.     term.setBackgroundColor(otc)
  14. end
  15. if not r then
  16.     m.setCursorPos(2, 5)
  17.     m.setTextColor(colors.white)
  18.     m.setBackgroundColor(colors.black)
  19.     m.clear()
  20.     m.setTextScale(2)
  21.     m.write("you dont have a reactor attached !")
  22.     error("no detected reactor !", 0)
  23. end
  24. if not c then
  25.     m.setCursorPos(2, 5)
  26.     m.setTextColor(colors.white)
  27.     m.setBackgroundColor(colors.black)
  28.     m.clear()
  29.     m.setTextScale(1)
  30.     m.write("you dont have a chest attached !")
  31.     error("no chest detected !", 0)
  32. end
  33. if not rin then
  34.     m.setCursorPos(2, 5)
  35.     m.setTextColor(colors.white)
  36.     m.setBackgroundColor(colors.black)
  37.     m.clear()
  38.     m.setTextScale(1)
  39.     m.write("no input/output port detected !")
  40.     error("no ports detected !", 0)
  41. end
  42. if (not rout) and rin then
  43.     m.setCursorPos(2, 5)
  44.     m.setTextColor(colors.white)
  45.     m.setBackgroundColor(colors.black)
  46.     m.clear()
  47.     m.setTextScale(1)
  48.     m.write("no or 1 input/output port detected !")
  49.     error("no or 1 port detected !", 0)
  50. end
  51. ----*peripheral check)--------
  52. local mname = peripheral.getName(m)
  53. m.setTextScale(0.5)
  54. m.clear()
  55. m.setBackgroundColor(colors.cyan)
  56. b.frame(mname, 3, 19, 97, 18, "white", "cyan", false)
  57. b.frame(mname, 30, 20, 40, 5, "white", "red", true)
  58. m.setCursorPos(42, 20)
  59. m.blit("reakt by 9551", string.rep("1", 13), string.rep("7", 13))
  60. m.setCursorPos(37, 21)
  61. m.blit("reactor control program", string.rep("1", 23), string.rep("7", 23))
  62. m.setCursorPos(38, 28)
  63. m.write("default peripherals used \25")
  64. m.setBackgroundColor(colors.red)
  65. m.setCursorPos(36, 29)
  66. m.write("reactor: " .. peripheral.getName(r))
  67. m.setCursorPos(36, 30)
  68. m.write("monitor: " .. peripheral.getName(m))
  69. m.setCursorPos(36, 31)
  70. m.write("chest: " .. peripheral.getName(c))
  71. local function topline()
  72.     b.frame(mname, 5, 6, 70, 1, "black", "black")
  73.     m.setCursorPos(6, 6)
  74.     m.write("yes")
  75.     m.setCursorPos(10, 6)
  76.     m.write("test")
  77. end
  78. local function setcol(x, text)
  79.     local oldcol = m.getBackgroundColor()
  80.     m.setBackgroundColor(colors.gray)
  81.     m.setCursorPos(x + 1, 6)
  82.     m.write(text)
  83.     m.setBackgroundColor(oldcol)
  84. end
  85. local function maincard(x, text)
  86.     topline()
  87.     local oldcol = m.getBackgroundColor()
  88.     m.setBackgroundColor(colors.cyan)
  89.     b.frame(mname, 5, 22, 70, 14, "black", "gray", true)
  90.     m.setBackgroundColor(colors.gray)
  91.     b.frame(mname, x + 2, 8, #text - 1, 1, "gray", "gray")
  92.     setcol(x, text)
  93.     m.setBackgroundColor(oldcol)
  94. end
  95. local function menuButtons()
  96.     local click = b.timetouch(1, mname)
  97.     b.menu(mname, click, 1, 81, 7, "black", "red", "yes", "yes", true, 5)
  98.     b.menu(mname, click, 2, 81, 8, "black", "red", "test", "test", true, 9)
  99.     b.menu(mname, click, 3, 81, 9, "black", "red", "idk", "idk", true, 1)
  100.     b.menu(mname, click, 4, 81, 10, "black", "red", "idk", "idk", true, 1)
  101.     b.menu(mname, click, 5, 81, 11, "black", "red", "idk", "idk", true, 1)
  102.     b.menu(mname, click, 6, 81, 12, "black", "red", "idk", "idk", true, 1)
  103.     local out = b.menudata()
  104.     if (type(out[2]) == "number") and (out[1]) then
  105.         maincard(out[2], out[1])
  106.     end
  107. end
  108. sleep(1)
  109.  
  110. local function clears()
  111.     local oldcol = m.getBackgroundColor()
  112.     m.setBackgroundColor(colors.cyan)
  113.     m.clear()
  114.     m.setBackgroundColor(oldcol)
  115. end
  116.  
  117. local function basemenu()
  118.     m.setBackgroundColor(colors.cyan)
  119.     b.frame(mname, 3, 20, 97, 18, "black", "cyan", true)
  120.     b.frame(mname, 80, 20, 15, 15, "black", "cyan", true)
  121.     b.frame(mname, 80, 20, 15, 15, "white", "cyan", true)
  122.     b.frame(mname, 81, 29, 13, 5, "red", "black", false)
  123.     m.setCursorPos(81, 24)
  124.     m.blit("settings", "rrrrrrrr", "eeeeeeee")
  125. end
  126. basemenu()
  127. topline()
  128. while true do
  129.     menuButtons()
  130. end
  131.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement