--Screen/Drawing functions
-----------------------------
w,h = term.getSize()
hW = w/2
hH = h/2
function centerPrint(y,text)
term.setCursorPos(w/2 - #text/2, y)
term.write(text)
end
function drawAt(x,y,text)
term.setCursorPos(x,y)
write(text)
end
function cleanScreen()
term.clear()
term.setCursorPos(1,1)
end
input = 1
function drawArt()
c = colors.combine(colors.red,colors.black,colors.white,colors.green)
white = false
black = false
green = false
red = false
rs.setBundledOutput("back", c)
cleanScreen()
term.setTextColor(colors.yellow)
term.setBackgroundColor(colors.lime)
print[[
VAULT-TEC REACTOR MK 4 CONTROL STATION
AUTHORIZED PERSONEL ONLY!
]]
for i = 5,19 do
term.setBackgroundColor(colors.lime)
drawAt(1,i," ")
term.setBackgroundColor(colors.black)
end
if input == nil then
input = 1
end
if input == 1 then
selected = " [1] ACTIVATE REACTORS 1 - 3 "
elseif input == 2 then
selected = " [2] DEACTIVATE REACTORS 1 - 3 "
elseif input == 3 then
selected = " [3] ACTIVATE REACTORS 4 - 6 "
elseif input == 4 then
selected = " [4] DEACTIVATE REACTORS 4 - 6 "
elseif input == 5 then
selected = " [5] ACTIVATE BREEDER CORE 1 "
elseif input == 6 then
selected = " [6] DEACTIVATE BREEDER CORE 1 "
elseif input == 7 then
selected = " [7] ACTIVATE BREEDER CORE 2 "
elseif input == 8 then
selected = " [8] DEACTIVATE BREEDER CORE 2 "
elseif input == 9 then
selected = " [0] -EMERGENCY- CORE SHUTDOWN "
end
term.setBackgroundColor(colors.lime)
drawAt(7,13," ")
term.setBackgroundColor(colors.gray)
term.setTextColor(colors.yellow)
centerPrint(16,selected)
term.setBackgroundColor(colors.black)
options = {
" ",
" [1] ACTIVATE REACTORS 1 - 3 ",
" [2] DEACTIVATE REACTORS 1 - 3 ",
" [3] ACTIVATE REACTORS 4 - 6 ",
" [4] DEACTIVATE REACTORS 4 - 6 ",
" [5] ACTIVATE BREEDER CORE 1 ",
" [6] DEACTIVATE BREEDER CORE 1 ",
" [7] ACTIVATE BREEDER CORE 2 ",
" [8] DEACTIVATE BREEDER CORE 2 ",
" [0] -EMERGENCY- CORE SHUTDOWN ",
" ",
}
for i = 1, #options do
term.setBackgroundColor(colors.lightGray)
term.setTextColor(colors.blue)
drawAt(9,i + 4,options[i])
end
term.setTextColor(colors.red)
drawAt(9,14," [0] -EMERGENCY- CORE SHUTDOWN")
end
function events()
evt, but = os.pullEvent()
if evt == "key" then
if but == 200 then --Up arrow
input = input + 1
if input > 9 then
input = 9
end
elseif but == 208 then --Down arrow
input = input - 1
if input < 1 then
input = 1
end
elseif but == 28 then --Enter
if input == 1 then
c = colors.subtract(c, colors.white)
rs.setBundledOutput("back",c)
white = not white
elseif input == 2 then
c = colors.combine(c, colors.white)
rs.setBundledOutput("back",c)
white = not white
elseif input == 3 then
c = colors.subtract(c, colors.black)
rs.setBundledOutput("back",c)
black = not black
elseif input == 4 then
c = colors.combine(c, colors.black)
rs.setBundledOutput("back",c)
black = not black
elseif input == 5 then
c = colors.subtract(c, colors.red)
rs.setBundledOutput("back",c)
red = not red
elseif input == 6 then
c = colors.combine(c, colors.red)
rs.setBundledOutput("back",c)
red = not red
elseif input == 7 then
c = colors.subtract(c, colors.green)
rs.setBundledOutput("back",c)
green = not green
elseif input == 8 then
c = colors.combine(c, colors.green)
rs.setBundledOutput("back", c)
green = not green
elseif input == 0 then
c = colors.combine(colors.green,colors.red,colors.white,colors.black)
green = false
red = false
black = false
white = false
rs.setBundledOutput("back", c)
end
end
end
end
function main()
while true do
cleanScreen()
drawArt()
events() --Handles the menu stuff
end
end
main()