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) | |
| 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.lime) | |
| 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 | |
| 58 | selected = " [1] ACTIVATE REACTORS 1 - 3 " | |
| 59 | ||
| 60 | elseif input == 2 then | |
| 61 | selected = " [2] DEACTIVATE REACTORS 1 - 3 " | |
| 62 | ||
| 63 | elseif input == 3 then | |
| 64 | selected = " [3] ACTIVATE REACTORS 4 - 6 " | |
| 65 | ||
| 66 | elseif input == 4 then | |
| 67 | selected = " [4] DEACTIVATE REACTORS 4 - 6 " | |
| 68 | ||
| 69 | elseif input == 5 then | |
| 70 | selected = " [5] ACTIVATE BREEDER CORE 1 " | |
| 71 | ||
| 72 | elseif input == 6 then | |
| 73 | selected = " [6] DEACTIVATE BREEDER CORE 1 " | |
| 74 | ||
| 75 | elseif input == 7 then | |
| 76 | selected = " [7] ACTIVATE BREEDER CORE 2 " | |
| 77 | ||
| 78 | elseif input == 8 then | |
| 79 | selected = " [8] DEACTIVATE BREEDER CORE 2 " | |
| 80 | ||
| 81 | elseif input == 9 then | |
| 82 | selected = " [0] -EMERGENCY- CORE SHUTDOWN " | |
| 83 | end | |
| 84 | ||
| 85 | - | term.setBackgroundColor(colors.lime) |
| 85 | + | term.setBackgroundColor(colors.black) |
| 86 | drawAt(7,13," ") | |
| 87 | ||
| 88 | term.setBackgroundColor(colors.black) | |
| 89 | term.setTextColor(colors.lime) | |
| 90 | centerPrint(16,selected) | |
| 91 | term.setBackgroundColor(colors.black) | |
| 92 | ||
| 93 | ||
| 94 | ||
| 95 | ||
| 96 | options = {
| |
| 97 | " ", | |
| 98 | " [1] ACTIVATE REACTORS 1 - 3 ", | |
| 99 | " [2] DEACTIVATE REACTORS 1 - 3 ", | |
| 100 | " [3] ACTIVATE REACTORS 4 - 6 ", | |
| 101 | " [4] DEACTIVATE REACTORS 4 - 6 ", | |
| 102 | " [5] ACTIVATE BREEDER CORE 1 ", | |
| 103 | " [6] DEACTIVATE BREEDER CORE 1 ", | |
| 104 | " [7] ACTIVATE BREEDER CORE 2 ", | |
| 105 | " [8] DEACTIVATE BREEDER CORE 2 ", | |
| 106 | " [0] -EMERGENCY- CORE SHUTDOWN ", | |
| 107 | " ", | |
| 108 | } | |
| 109 | ||
| 110 | ||
| 111 | for i = 1, #options do | |
| 112 | - | term.setBackgroundColor(colors.lightGray) |
| 112 | + | term.setBackgroundColor(colors.green) |
| 113 | term.setTextColor(colors.blue) | |
| 114 | drawAt(9,i + 4,options[i]) | |
| 115 | end | |
| 116 | ||
| 117 | term.setTextColor(colors.red) | |
| 118 | drawAt(9,14," [0] -EMERGENCY- CORE SHUTDOWN") | |
| 119 | end | |
| 120 | ||
| 121 | ||
| 122 | ||
| 123 | ||
| 124 | function events() | |
| 125 | evt, but = os.pullEvent() | |
| 126 | if evt == "key" then | |
| 127 | ||
| 128 | - | if but == 208 then --Up arrow |
| 128 | + | if but == 200 then --Up arrow |
| 129 | input = input + 1 | |
| 130 | if input > 9 then | |
| 131 | input = 9 | |
| 132 | end | |
| 133 | ||
| 134 | elseif but == 200 then --Down arrow | |
| 135 | input = input - 1 | |
| 136 | if input < 1 then | |
| 137 | input = 1 | |
| 138 | end | |
| 139 | ||
| 140 | elseif but == 28 then --Enter | |
| 141 | if input == 1 then | |
| 142 | c = colors.subtract(c, colors.white) | |
| 143 | rs.setBundledOutput("back",c)
| |
| 144 | white = not white | |
| 145 | ||
| 146 | ||
| 147 | elseif input == 2 then | |
| 148 | c = colors.combine(c, colors.white) | |
| 149 | rs.setBundledOutput("back",c)
| |
| 150 | white = not white | |
| 151 | ||
| 152 | ||
| 153 | elseif input == 3 then | |
| 154 | c = colors.subtract(c, colors.black) | |
| 155 | rs.setBundledOutput("back",c)
| |
| 156 | black = not black | |
| 157 | ||
| 158 | ||
| 159 | elseif input == 4 then | |
| 160 | c = colors.combine(c, colors.black) | |
| 161 | rs.setBundledOutput("back",c)
| |
| 162 | black = not black | |
| 163 | ||
| 164 | ||
| 165 | elseif input == 5 then | |
| 166 | c = colors.subtract(c, colors.red) | |
| 167 | rs.setBundledOutput("back",c)
| |
| 168 | red = not red | |
| 169 | ||
| 170 | ||
| 171 | elseif input == 6 then | |
| 172 | c = colors.combine(c, colors.red) | |
| 173 | rs.setBundledOutput("back",c)
| |
| 174 | red = not red | |
| 175 | ||
| 176 | ||
| 177 | elseif input == 7 then | |
| 178 | c = colors.subtract(c, colors.green) | |
| 179 | rs.setBundledOutput("back",c)
| |
| 180 | green = not green | |
| 181 | ||
| 182 | ||
| 183 | elseif input == 8 then | |
| 184 | c = colors.combine(c, colors.green) | |
| 185 | rs.setBundledOutput("back", c)
| |
| 186 | green = not green | |
| 187 | ||
| 188 | ||
| 189 | elseif input == 0 then | |
| 190 | c = colors.combine(colors.green,colors.red,colors.white,colors.black) | |
| 191 | green = false | |
| 192 | red = false | |
| 193 | black = false | |
| 194 | white = false | |
| 195 | rs.setBundledOutput("back", c)
| |
| 196 | end | |
| 197 | ||
| 198 | end | |
| 199 | end | |
| 200 | end | |
| 201 | ||
| 202 | function main() | |
| 203 | while true do | |
| 204 | cleanScreen() | |
| 205 | drawArt() | |
| 206 | events() --Handles the menu stuff | |
| 207 | end | |
| 208 | end | |
| 209 | ||
| 210 | ||
| 211 | main() |