SHOW:
|
|
- or go back to the newest paste.
1 | ||
2 | --Screen/Drawing functions | |
3 | ----------------------------- | |
4 | w,h = term.getSize() | |
5 | hW = w/2 | |
6 | hH = h/2 | |
7 | ||
8 | function centerPrint(y,text) | |
9 | term.setCursorPos(w/2 - #text/2, y) | |
10 | term.write(text) | |
11 | end | |
12 | ||
13 | function drawAt(x,y,text) | |
14 | term.setCursorPos(x,y) | |
15 | write(text) | |
16 | end | |
17 | ||
18 | function cleanScreen() | |
19 | term.clear() | |
20 | term.setCursorPos(1,1) | |
21 | end | |
22 | ||
23 | ||
24 | input = 1 | |
25 | ||
26 | ||
27 | function drawArt() | |
28 | ||
29 | c = colors.combine(colors.red,colors.black,colors.white,colors.green) | |
30 | white = false | |
31 | black = false | |
32 | green = false | |
33 | red = false | |
34 | rs.setBundledOutput("back", c) | |
35 | ||
36 | cleanScreen() | |
37 | term.setTextColor(colors.lime) | |
38 | term.setBackgroundColor(colors.black) --title and title background color | |
39 | print[[ | |
40 | ||
41 | VAULT-TEC REACTOR MK 4 CONTROL STATION | |
42 | AUTHORIZED PERSONEL ONLY! | |
43 | ||
44 | ]] | |
45 | ||
46 | ||
47 | for i = 5,19 do | |
48 | term.setBackgroundColor(colors.black) -- MAIN BACKGROUND SPAM COLOR | |
49 | drawAt(1,i," ") | |
50 | term.setBackgroundColor(colors.black) | |
51 | end | |
52 | ||
53 | if input == nil then | |
54 | input = 1 | |
55 | end | |
56 | ||
57 | - | if input == 1 then |
57 | + | |
58 | - | selected = "[1] ACTIVATE REACTORS 1 - 3 " |
58 | + | |
59 | term.setCursorPos(11,input + 5) | |
60 | print("[") | |
61 | - | selected = " [2] DEACTIVATE REACTORS 1 - 3 " |
61 | + | |
62 | print("]") | |
63 | term.setBackgroundColor(colors.black) | |
64 | - | selected = " [3] ACTIVATE REACTORS 4 - 6 " |
64 | + | |
65 | ||
66 | ||
67 | - | selected = " [4] DEACTIVATE REACTORS 4 - 6 " |
67 | + | |
68 | options = { | |
69 | " ", | |
70 | - | selected = " [5] ACTIVATE BREEDER CORE 1 " |
70 | + | |
71 | " DEACTIVATE REACTORS 1 - 3 ", | |
72 | " ACTIVATE REACTORS 4 - 6 ", | |
73 | - | selected = " [6] DEACTIVATE BREEDER CORE 1 " |
73 | + | |
74 | " ACTIVATE BREEDER CORE 1 ", | |
75 | " DEACTIVATE BREEDER CORE 1 ", | |
76 | - | selected = " [7] ACTIVATE BREEDER CORE 2 " |
76 | + | |
77 | " DEACTIVATE BREEDER CORE 2 ", | |
78 | " -EMERGENCY- CORE SHUTDOWN ", | |
79 | - | selected = " [8] DEACTIVATE BREEDER CORE 2 " |
79 | + | " ", |
80 | } | |
81 | - | elseif input == 9 then |
81 | + | |
82 | - | selected = " [0] -EMERGENCY- CORE SHUTDOWN " |
82 | + | |
83 | for i = 1, #options do | |
84 | term.setBackgroundColor(colors.black) -- options background color | |
85 | - | term.setBackgroundColor(colors.black) --selection cover? |
85 | + | |
86 | - | drawAt(7,13," ") |
86 | + | |
87 | end | |
88 | ||
89 | term.setTextColor(colors.red) -- option text color optional | |
90 | drawAt(12,14," -EMERGENCY- CORE SHUTDOWN ") | |
91 | end | |
92 | ||
93 | ||
94 | ||
95 | ||
96 | function events() | |
97 | evt, but = os.pullEvent() | |
98 | if evt == "key" then | |
99 | ||
100 | - | " ", |
100 | + | |
101 | input = input + 1 | |
102 | if input > 9 then | |
103 | input = 9 | |
104 | end | |
105 | ||
106 | elseif but == 200 then --up arrow | |
107 | input = input - 1 | |
108 | if input < 1 then | |
109 | input = 1 | |
110 | - | " ", |
110 | + | |
111 | ||
112 | elseif but == 28 then --Enter | |
113 | if input == 1 then | |
114 | c = colors.subtract(c, colors.white) | |
115 | rs.setBundledOutput("back",c) | |
116 | white = not white | |
117 | ||
118 | ||
119 | elseif input == 2 then | |
120 | c = colors.combine(c, colors.white) | |
121 | rs.setBundledOutput("back",c) | |
122 | white = not white | |
123 | ||
124 | ||
125 | elseif input == 3 then | |
126 | c = colors.subtract(c, colors.black) | |
127 | rs.setBundledOutput("back",c) | |
128 | black = not black | |
129 | ||
130 | ||
131 | elseif input == 4 then | |
132 | c = colors.combine(c, colors.black) | |
133 | rs.setBundledOutput("back",c) | |
134 | black = not black | |
135 | ||
136 | ||
137 | elseif input == 5 then | |
138 | c = colors.subtract(c, colors.red) | |
139 | rs.setBundledOutput("back",c) | |
140 | red = not red | |
141 | ||
142 | ||
143 | elseif input == 6 then | |
144 | c = colors.combine(c, colors.red) | |
145 | rs.setBundledOutput("back",c) | |
146 | red = not red | |
147 | ||
148 | ||
149 | elseif input == 7 then | |
150 | c = colors.subtract(c, colors.green) | |
151 | rs.setBundledOutput("back",c) | |
152 | green = not green | |
153 | ||
154 | ||
155 | elseif input == 8 then | |
156 | c = colors.combine(c, colors.green) | |
157 | rs.setBundledOutput("back", c) | |
158 | green = not green | |
159 | ||
160 | ||
161 | elseif input == 0 then | |
162 | c = colors.combine(colors.green,colors.red,colors.white,colors.black) | |
163 | green = false | |
164 | red = false | |
165 | black = false | |
166 | white = false | |
167 | rs.setBundledOutput("back", c) | |
168 | end | |
169 | ||
170 | end | |
171 | end | |
172 | end | |
173 | ||
174 | function main() | |
175 | while true do | |
176 | cleanScreen() | |
177 | drawArt() | |
178 | events() --Handles the menu stuff | |
179 | end | |
180 | end | |
181 | ||
182 | ||
183 | main() |