Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local b = require("button")
- local m = peripheral.find("monitor")
- local r = peripheral.find("BigReactors-Reactor")
- local c = peripheral.find("minecraft:chest")
- local ins = {peripheral.find("bigreactors:tileentityreactoraccessport")}
- local rin = ins[1]
- local rout = ins[2]
- local theme = {
- ["dblack"] = colors.black,
- ["dwhite"] = colors.white,
- ["dcyan"] = colors.cyan,
- ["dgray"] = colors.gray,
- ["dred"] = colors.red,
- ["fred"] = "red",
- ["fcyan"] = "cyan",
- ["fblack"] = "black",
- ["fgray"] = "gray",
- ["fwhite"] = "white",
- ["fgreen"] = "green",
- ["borange"] = "1",
- ["bgray"] = "7",
- ["bwhite"] = "e",
- ["bred"] = "r"
- }
- ----*peripheral check(--------
- if not m then
- local otc = term.getBackgroundColor()
- term.setBackgroundColor(theme["dblack"])
- error("you dont have a monitor attached !", 0)
- term.setBackgroundColor(otc)
- end
- if not r then
- m.setCursorPos(2, 5)
- m.setTextColor(theme["dwhite"])
- m.setBackgroundColor(theme["dblack"])
- m.clear()
- m.setTextScale(2)
- m.write("you dont have a reactor attached !")
- error("no detected reactor !", 0)
- end
- if not c then
- m.setCursorPos(2, 5)
- m.setTextColor(theme["dwhite"])
- m.setBackgroundColor(theme["dblack"])
- m.clear()
- m.setTextScale(1)
- m.write("you dont have a chest attached !")
- error("no chest detected !", 0)
- end
- if not rin then
- m.setCursorPos(2, 5)
- m.setTextColor(theme["dwhite"])
- m.setBackgroundColor(theme["dblack"])
- m.clear()
- m.setTextScale(1)
- m.write("no input/output port detected !")
- error("no ports detected !", 0)
- end
- if (not rout) and rin then
- m.setCursorPos(2, 5)
- m.setTextColor(theme["dwhite"])
- m.setBackgroundColor(theme["dblack"])
- m.clear()
- m.setTextScale(1)
- m.write("no or 1 input/output port detected !")
- error("no or 1 port detected !", 0)
- end
- ----*peripheral check)--------
- local mname = peripheral.getName(m)
- m.setTextScale(0.5)
- m.clear()
- m.setBackgroundColor(theme["dcyan"])
- b.frame(mname, 3, 19, 97, 18, theme["fwhite"], theme["fcyan"], false)
- b.frame(mname, 30, 20, 40, 5, theme["fwhite"], theme["fred"], true)
- m.setCursorPos(42, 20)
- m.blit("reakt by 9551", string.rep(theme["borange"], 13), string.rep(theme["bgray"], 13))
- m.setCursorPos(37, 21)
- m.blit("reactor control program", string.rep(theme["borange"], 23), string.rep(theme["bgray"], 23))
- m.setCursorPos(38, 28)
- m.write("default peripherals used \25")
- m.setBackgroundColor(theme["dred"])
- m.setCursorPos(36, 29)
- m.write("reactor: " .. peripheral.getName(r))
- m.setCursorPos(36, 30)
- m.write("monitor: " .. peripheral.getName(m))
- m.setCursorPos(36, 31)
- m.write("chest: " .. peripheral.getName(c))
- local function topline()
- b.frame(mname, 5, 6, 70, 1, theme["fblack"], theme["fblack"])
- m.setCursorPos(6, 6)
- m.write("main")
- m.setCursorPos(11, 6)
- m.write("fuels")
- m.setCursorPos(17, 6)
- m.write("chest")
- m.setCursorPos(23, 6)
- m.write("rod control")
- m.setCursorPos(35, 6)
- m.write("energy control")
- m.setCursorPos(50, 6)
- m.write("energy info")
- end
- local function setcol(x, text)
- local oldcol = m.getBackgroundColor()
- m.setBackgroundColor(theme["dgray"])
- m.setCursorPos(x + 1, 6)
- m.write(text)
- m.setBackgroundColor(oldcol)
- end
- local function maincard(x, text)
- topline()
- local oldcol = m.getBackgroundColor()
- m.setBackgroundColor(theme["dcyan"])
- b.frame(mname, 5, 22, 70, 14, theme["fblack"], theme["fgray"], true)
- m.setBackgroundColor(theme["dgray"])
- b.frame(mname, x + 2, 8, #text - 1, 1, theme["fgray"], theme["fgray"])
- setcol(x, text)
- m.setBackgroundColor(oldcol)
- end
- local function menuButtons()
- local click = b.timetouch(1, mname)
- b.menu(mname, click, 1, 81, 7, theme["fblack"], theme["fred"], "main", "main", true, 5)
- b.menu(mname, click, 2, 81, 8, theme["fblack"], theme["fred"], "fuels", "fuels", true, 10)
- b.menu(mname, click, 3, 81, 9, theme["fblack"], theme["fred"], "chest", "chest", true, 16)
- b.menu(mname, click, 4, 81, 10, theme["fblack"], theme["fred"], "rod control", "rod control", true, 22)
- b.menu(mname, click, 5, 81, 11, theme["fblack"], theme["fred"], "energy control", "energy control", true, 34)
- b.menu(mname, click, 6, 81, 12, theme["fblack"], theme["fred"], "energy info", "energy info", true, 49)
- --------------*settings menu--------------
- b.menu(mname, click, 7, 81, 24, theme["fwhite"], theme["fgreen"], "peripherals", "peripherals", true, 49)
- local out = b.menudata()
- if (type(out[2]) == "number") and (out[1]) then
- maincard(out[2], out[1])
- end
- end
- sleep(1)
- local function clears()
- local oldcol = m.getBackgroundColor()
- m.setBackgroundColor(theme["dcyan"])
- m.clear()
- m.setBackgroundColor(oldcol)
- end
- local function basemenu()
- m.setBackgroundColor(theme["dcyan"])
- b.frame(mname, 3, 20, 97, 18, theme["fblack"], theme["fcyan"], true)
- b.frame(mname, 80, 20, 15, 15, theme["fblack"], theme["fcyan"], true)
- b.frame(mname, 80, 20, 16, 15, theme["fwhite"], theme["fcyan"], true)
- b.frame(mname, 81, 29, 14, 5, theme["fred"], theme["fblack"], false)
- m.setCursorPos(81, 24)
- m.blit("settings", string.rep(theme["bred"], 8), string.rep(theme["bwhite"], 8))
- end
- basemenu()
- topline()
- while true do
- menuButtons()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement