SHOW:
|
|
- or go back to the newest paste.
| 1 | -- BigReactor Control | |
| 2 | -- by SparkyBearBomb | |
| 3 | -- Original by jaranvil aka jared314 | |
| 4 | -- | |
| 5 | -- feel free to use and/or modify this code | |
| 6 | -- | |
| 7 | ----------------------------------------------- | |
| 8 | --Reactor Control - Version History | |
| 9 | -- | |
| 10 | - | -- Version 2.2 - 20 DEC 20 |
| 10 | + | |
| 11 | - | -- - Updated to permit use with Minecraft 1.16.4 |
| 11 | + | |
| 12 | - | -- - Created Legacy offshoot of turbine and reactor programs |
| 12 | + | |
| 13 | -- | |
| 14 | - | -- Version 2.1 - 28 JUL 19 |
| 14 | + | |
| 15 | - | -- - Fixed Auto Power Increase/Decrease Alignment |
| 15 | + | |
| 16 | -- | |
| 17 | - | -- Version 2.0 - 02 JUN 19 |
| 17 | + | |
| 18 | - | -- - Fixed Okay button in auto menu |
| 18 | + | |
| 19 | -- | |
| 20 | - | -- Version 1.9 - 02 JUN 19 |
| 20 | + | |
| 21 | - | -- - Added Control rod auto to auto screen |
| 21 | + | |
| 22 | -- | |
| 23 | - | -- Version 1.8 - 24 MAR 17 |
| 23 | + | |
| 24 | - | -- - ROLLBACK TO VERSION 1.5 due to error with disabling periodic update checking |
| 24 | + | |
| 25 | -- - Put fuel consumption on main screen | |
| 26 | -- | |
| 27 | -- Version 1.2 - 17 MAR 16 | |
| 28 | -- - First Release | |
| 29 | -- | |
| 30 | -- Version 1.1 - UNKN | |
| 31 | -- - original program made by jaranvil | |
| 32 | -- | |
| 33 | ||
| 34 | ----------------------------------------------- | |
| 35 | ||
| 36 | local version = 1.7 | |
| 37 | --is auto power enabled | |
| 38 | local auto_string = false | |
| 39 | --auto on value | |
| 40 | local on = 0 | |
| 41 | --auto off value | |
| 42 | local off = 99 | |
| 43 | --is auto control rods enabled | |
| 44 | local auto_rods = true | |
| 45 | --control rod auto value | |
| 46 | local auto_rf = 0 | |
| 47 | local updateSeconds = 30 | |
| 48 | local updateTimer = 0 | |
| 49 | local UpdateAvailable = false | |
| 50 | local newVersion = 0 | |
| 51 | ||
| 52 | --peripherals | |
| 53 | local reactor | |
| 54 | - | local version = 2.1 |
| 54 | + | |
| 55 | ||
| 56 | --monitor size | |
| 57 | local monX | |
| 58 | local monY | |
| 59 | ||
| 60 | term.clear() | |
| 61 | -------------------FORMATTING------------------------------- | |
| 62 | function clear() | |
| 63 | mon.setBackgroundColor(colors.black) | |
| 64 | mon.clear() | |
| 65 | mon.setCursorPos(1,1) | |
| 66 | end | |
| 67 | ||
| 68 | --display text on computer's terminal screen | |
| 69 | function draw_text_term(x, y, text, text_color, bg_color) | |
| 70 | term.setTextColor(text_color) | |
| 71 | term.setBackgroundColor(bg_color) | |
| 72 | term.setCursorPos(x,y) | |
| 73 | write(text) | |
| 74 | end | |
| 75 | ||
| 76 | --display text text on monitor, "mon" peripheral | |
| 77 | function draw_text(x, y, text, text_color, bg_color) | |
| 78 | mon.setBackgroundColor(bg_color) | |
| 79 | mon.setTextColor(text_color) | |
| 80 | mon.setCursorPos(x,y) | |
| 81 | mon.write(text) | |
| 82 | end | |
| 83 | ||
| 84 | --draw line on computer terminal | |
| 85 | function draw_line(x, y, length, color) | |
| 86 | mon.setBackgroundColor(color) | |
| 87 | mon.setCursorPos(x,y) | |
| 88 | mon.write(string.rep(" ", length))
| |
| 89 | end | |
| 90 | ||
| 91 | --draw line on computer terminal | |
| 92 | function draw_line_term(x, y, length, color) | |
| 93 | term.setBackgroundColor(color) | |
| 94 | term.setCursorPos(x,y) | |
| 95 | term.write(string.rep(" ", length))
| |
| 96 | end | |
| 97 | ||
| 98 | -- Round Decimal Numbers | |
| 99 | function roundNumber(num, n) | |
| 100 | - | mon.setBackgroundColor(color) |
| 100 | + | |
| 101 | - | mon.setCursorPos(x,y) |
| 101 | + | |
| 102 | - | mon.write(string.rep(" ", length))
|
| 102 | + | |
| 103 | ||
| 104 | --create progress bar | |
| 105 | --draws two overlapping lines | |
| 106 | --background line of bg_color | |
| 107 | - | term.setBackgroundColor(color) |
| 107 | + | |
| 108 | - | term.setCursorPos(x,y) |
| 108 | + | |
| 109 | - | term.write(string.rep(" ", length))
|
| 109 | + | |
| 110 | local barSize = math.floor((minVal/maxVal) * length) | |
| 111 | draw_line(x, y, barSize, bar_color) --progress so far | |
| 112 | end | |
| 113 | ||
| 114 | --create status bar | |
| 115 | --draws three overlapping lines | |
| 116 | --background line of bg_color | |
| 117 | function status_bar(x, y, length, minVal, medVal, maxVal, bar_color1, bar_color2, bg_color) | |
| 118 | draw_line(x, y, length, bg_color) --backgoround bar | |
| 119 | local barSize1 = math.floor((medVal/maxVal) * length) | |
| 120 | local barSize2 = math.floor((minVal/maxVal) * length) | |
| 121 | draw_line(x, y, barSize1, bar_color1) --progress so far | |
| 122 | draw_line(x, y, barSize2, bar_color2) --progress so far | |
| 123 | end | |
| 124 | ||
| 125 | --same as above but on the computer terminal | |
| 126 | function progress_bar_term(x, y, length, minVal, maxVal, bar_color, bg_color) | |
| 127 | draw_line_term(x, y, length, bg_color) --backgoround bar | |
| 128 | local barSize = math.floor((minVal/maxVal) * length) | |
| 129 | draw_line_term(x, y, barSize, bar_color) --progress so far | |
| 130 | end | |
| 131 | ||
| 132 | --create button on monitor | |
| 133 | function button(x, y, length, text, txt_color, bg_color) | |
| 134 | draw_line(x, y, length, bg_color) | |
| 135 | draw_text((x+2), y, text, txt_color, bg_color) | |
| 136 | end | |
| 137 | ||
| 138 | --header and footer bars on monitor | |
| 139 | function menu_bar() | |
| 140 | if UpdateAvailable == true then | |
| 141 | draw_line(1, 1, monX, colors.blue) | |
| 142 | draw_line(4, 1, monX, colors.gold) | |
| 143 | - | draw_line_term(x, y, barSize, bar_color) --progress so far |
| 143 | + | |
| 144 | draw_line(1, 1, monX, colors.blue) | |
| 145 | end | |
| 146 | draw_text(2, 1, "Power Tools Settings", colors.white, colors.blue) | |
| 147 | draw_line(1, 26, monX, colors.blue) | |
| 148 | draw_text(2, 26, " Reactor Control", colors.white, colors.blue) | |
| 149 | end | |
| 150 | ||
| 151 | --dropdown menu for power options | |
| 152 | function power_menu() | |
| 153 | draw_line(1, 2, 9, colors.gray) | |
| 154 | draw_line(1, 3, 9, colors.gray) | |
| 155 | - | draw_text(2, 1, "Power Tools Settings", colors.white, colors.blue) |
| 155 | + | |
| 156 | if active then | |
| 157 | - | draw_text(2, 26, " Reactor Control", colors.white, colors.blue) |
| 157 | + | draw_text(2, 2, "ON", colors.lightGray, colors.gray) |
| 158 | draw_text(2, 3, "OFF", colors.white, colors.gray) | |
| 159 | else | |
| 160 | draw_text(2, 2, "ON", colors.white, colors.gray) | |
| 161 | draw_text(2, 3, "OFF", colors.lightGray, colors.gray) | |
| 162 | end | |
| 163 | draw_text(2, 4, "Auto", colors.white, colors.gray) | |
| 164 | end | |
| 165 | ||
| 166 | - | draw_text(2, 2, "ON", colors.lightGray, colors.gray) |
| 166 | + | --periodically check for updates |
| 167 | - | draw_text(2, 3, "OFF", colors.white, colors.gray) |
| 167 | + | function updateCheck() |
| 168 | if updateTimer > updateSeconds then | |
| 169 | - | draw_text(2, 2, "ON", colors.white, colors.gray) |
| 169 | + | if (fs.exists("version.txt")) == true then
|
| 170 | - | draw_text(2, 3, "OFF", colors.lightGray, colors.gray) |
| 170 | + | fs.delete("version.txt")
|
| 171 | end | |
| 172 | currentVer = fs.open("version.txt","w")
| |
| 173 | currentVer.write(version) | |
| 174 | currentVer.close() | |
| 175 | if (multishell.getCount()) < 2 then | |
| 176 | multishell.launch({shell-shell},"reactor_control_updater")
| |
| 177 | end | |
| 178 | if fs.exists("updater.txt") then
| |
| 179 | local ver = fs.open("updater", "r")
| |
| 180 | updateAvaliable = ver.readline() | |
| 181 | end | |
| 182 | updateTimer = 0 | |
| 183 | else | |
| 184 | updateTimer = updateTimer + 1 | |
| 185 | end | |
| 186 | end | |
| 187 | ||
| 188 | --dropbox menu for tools | |
| 189 | function tools_menu() | |
| 190 | draw_line(10, 2, 14, colors.gray) | |
| 191 | draw_line(10, 3, 14, colors.gray) | |
| 192 | draw_line(10, 4, 14, colors.gray) | |
| 193 | draw_line(10, 5, 14, colors.gray) | |
| 194 | draw_text(11, 2, "Control Rods", colors.white, colors.gray) | |
| 195 | draw_text(11, 3, "Efficiency", colors.white, colors.gray) | |
| 196 | draw_text(11, 4, "Fuel", colors.white, colors.gray) | |
| 197 | draw_text(11, 5, "Waste", colors.white, colors.gray) | |
| 198 | end | |
| 199 | ||
| 200 | --dropdown menu for settings | |
| 201 | function settings_menu() | |
| 202 | if UpdateAvailable == true then | |
| 203 | draw_line(12, 2, 18, colors.gold) | |
| 204 | - | draw_line(4, counter, 22, colors.white) |
| 204 | + | |
| 205 | draw_line(12, 2, 18, colors.gray) | |
| 206 | end | |
| 207 | draw_line(12, 3, 18, colors.gray) | |
| 208 | draw_text(13, 2, "Check for Updates", colors.white, colors.gray) | |
| 209 | draw_text(13, 3, "Reset peripherals", colors.white, colors.gray) | |
| 210 | end | |
| 211 | ||
| 212 | --basic popup screen with title bar and exit button | |
| 213 | - | sw = fs.open("config.txt", "w")
|
| 213 | + | |
| 214 | - | sw.writeLine(version) |
| 214 | + | |
| 215 | - | sw.writeLine(auto_string) |
| 215 | + | |
| 216 | - | sw.writeLine(on) |
| 216 | + | |
| 217 | - | sw.writeLine(off) |
| 217 | + | |
| 218 | - | sw.writeLine(auto_rods) |
| 218 | + | |
| 219 | - | sw.writeLine(auto_rf) |
| 219 | + | |
| 220 | for counter = y+1, height+y do | |
| 221 | draw_line(4, counter, 22, colors.white) | |
| 222 | end | |
| 223 | ||
| 224 | draw_text(25, y, "X", colors.white, colors.red) | |
| 225 | draw_text(5, y, title, colors.white, colors.blue) | |
| 226 | - | version = tonumber(sr.readLine()) |
| 226 | + | |
| 227 | - | auto_string = sr.readLine() |
| 227 | + | |
| 228 | - | on = tonumber(sr.readLine()) |
| 228 | + | |
| 229 | - | off = tonumber(sr.readLine()) |
| 229 | + | |
| 230 | - | auto_rods = sr.readLine() |
| 230 | + | sw = fs.open("config.txt", "w")
|
| 231 | - | auto_rf = tonumber(sr.readLine()) |
| 231 | + | sw.writeLine(version) |
| 232 | sw.writeLine(auto_string) | |
| 233 | sw.writeLine(on) | |
| 234 | sw.writeLine(off) | |
| 235 | sw.writeLine(auto_rods) | |
| 236 | sw.writeLine(auto_rf) | |
| 237 | sw.close() | |
| 238 | end | |
| 239 | ||
| 240 | - | clear() |
| 240 | + | |
| 241 | - | menu_bar() |
| 241 | + | |
| 242 | - | terminal_screen() |
| 242 | + | |
| 243 | version = tonumber(sr.readLine()) | |
| 244 | - | energy_stored = reactor.getEnergyStored() |
| 244 | + | auto_string = sr.readLine() |
| 245 | - | |
| 245 | + | on = tonumber(sr.readLine()) |
| 246 | - | --------POWER STAT-------------- |
| 246 | + | off = tonumber(sr.readLine()) |
| 247 | - | draw_text(2, 3, "Power:", colors.yellow, colors.black) |
| 247 | + | auto_rods = sr.readLine() |
| 248 | - | active = reactor.getActive() |
| 248 | + | auto_rf = tonumber(sr.readLine()) |
| 249 | - | if active then |
| 249 | + | |
| 250 | - | draw_text(10, 3, "ONLINE", colors.lime, colors.black) |
| 250 | + | |
| 251 | - | else |
| 251 | + | |
| 252 | - | draw_text(10, 3, "OFFLINE", colors.red, colors.black) |
| 252 | + | --check for updates |
| 253 | - | end |
| 253 | + | |
| 254 | ------------------------END FORMATTING-------------------------- | |
| 255 | ||
| 256 | - | -----------FUEL--------------------- |
| 256 | + | |
| 257 | - | draw_text(2, 5, "Fuel Level:", colors.yellow, colors.black) |
| 257 | + | |
| 258 | - | local maxVal = reactor.getFuelAmountMax() |
| 258 | + | |
| 259 | - | local waste = reactor.getWasteAmount() |
| 259 | + | |
| 260 | - | local minVal = reactor.getFuelAmount() |
| 260 | + | |
| 261 | - | local medVal = waste + minVal |
| 261 | + | |
| 262 | - | local percent = math.floor((minVal/maxVal)*100) |
| 262 | + | --updateCheck() |
| 263 | - | draw_text(15, 5, percent.."%", colors.white, colors.black) |
| 263 | + | |
| 264 | energy_stored = reactor.getEnergyStored() | |
| 265 | - | if percent < 25 then |
| 265 | + | |
| 266 | - | status_bar(2, 6, monX-2, minVal, medVal, maxVal, colors.blue, colors.red, colors.gray) |
| 266 | + | --------POWER STAT-------------- |
| 267 | - | else if percent < 50 then |
| 267 | + | draw_text(2, 3, "Power:", colors.yellow, colors.black) |
| 268 | - | status_bar(2, 6, monX-2, minVal, medVal, maxVal, colors.blue, colors.orange, colors.gray) |
| 268 | + | active = reactor.getActive() |
| 269 | - | else if percent < 75 then |
| 269 | + | |
| 270 | - | status_bar(2, 6, monX-2, minVal, medVal, maxVal, colors.blue, colors.yellow, colors.gray) |
| 270 | + | draw_text(10, 3, "ONLINE", colors.lime, colors.black) |
| 271 | - | else if percent <= 100 then |
| 271 | + | |
| 272 | - | status_bar(2, 6, monX-2, minVal, medVal, maxVal, colors.blue, colors.lime, colors.gray) |
| 272 | + | draw_text(10, 3, "OFFLINE", colors.red, colors.black) |
| 273 | - | end |
| 273 | + | |
| 274 | - | end |
| 274 | + | |
| 275 | - | end |
| 275 | + | |
| 276 | - | end |
| 276 | + | -----------FUEL--------------------- |
| 277 | draw_text(2, 5, "Fuel Level:", colors.yellow, colors.black) | |
| 278 | - | -----------ROD HEAT--------------- |
| 278 | + | local maxVal = reactor.getFuelAmountMax() |
| 279 | - | draw_text(2, 8, "Fuel Temp:", colors.yellow, colors.black) |
| 279 | + | local waste = reactor.getWasteAmount() |
| 280 | - | local maxVal = 2000 |
| 280 | + | local minVal = reactor.getFuelAmount() |
| 281 | - | local minVal = math.floor(reactor.getFuelTemperature()) |
| 281 | + | local medVal = waste + minVal |
| 282 | local percent = math.floor((minVal/maxVal)*100) | |
| 283 | - | if minVal < 500 then |
| 283 | + | draw_text(15, 5, percent.."%", colors.white, colors.black) |
| 284 | - | progress_bar(2, 9, monX-2, minVal, maxVal, colors.cyan, colors.gray) |
| 284 | + | |
| 285 | - | else if minVal < 1000 then |
| 285 | + | if percent < 25 then |
| 286 | - | progress_bar(2, 9, monX-2, minVal, maxVal, colors.lime, colors.gray) |
| 286 | + | status_bar(2, 6, monX-2, minVal, medVal, maxVal, colors.blue, colors.red, colors.gray) |
| 287 | - | else if minVal < 1500 then |
| 287 | + | else if percent < 50 then |
| 288 | - | progress_bar(2, 9, monX-2, minVal, maxVal, colors.yellow, colors.gray) |
| 288 | + | status_bar(2, 6, monX-2, minVal, medVal, maxVal, colors.blue, colors.orange, colors.gray) |
| 289 | - | else if minVal < 2000 then |
| 289 | + | else if percent < 75 then |
| 290 | - | progress_bar(2, 9, monX-2, minVal, maxVal, colors.orange, colors.gray) |
| 290 | + | status_bar(2, 6, monX-2, minVal, medVal, maxVal, colors.blue, colors.yellow, colors.gray) |
| 291 | - | else if minVal >= 2000 then |
| 291 | + | else if percent <= 100 then |
| 292 | - | progress_bar(2, 9, monX-2, 2000, maxVal, colors.red, colors.gray) |
| 292 | + | status_bar(2, 6, monX-2, minVal, medVal, maxVal, colors.blue, colors.lime, colors.gray) |
| 293 | - | end |
| 293 | + | |
| 294 | - | end |
| 294 | + | |
| 295 | - | end |
| 295 | + | |
| 296 | - | end |
| 296 | + | |
| 297 | - | end |
| 297 | + | |
| 298 | -----------ROD HEAT--------------- | |
| 299 | - | draw_text(15, 8, math.floor(minVal).." C", colors.white, colors.black) |
| 299 | + | draw_text(2, 8, "Fuel Temp:", colors.yellow, colors.black) |
| 300 | local maxVal = 2000 | |
| 301 | - | -----------CASING HEAT--------------- |
| 301 | + | local minVal = math.floor(reactor.getFuelTemperature()) |
| 302 | - | draw_text(2, 11, "Casing Temp:", colors.yellow, colors.black) |
| 302 | + | |
| 303 | - | local maxVal = 2000 |
| 303 | + | if minVal < 500 then |
| 304 | - | local minVal = math.floor(reactor.getCasingTemperature()) |
| 304 | + | progress_bar(2, 9, monX-2, minVal, maxVal, colors.cyan, colors.gray) |
| 305 | - | if minVal < 500 then |
| 305 | + | else if minVal < 1000 then |
| 306 | - | progress_bar(2, 12, monX-2, minVal, maxVal, colors.cyan, colors.gray) |
| 306 | + | progress_bar(2, 9, monX-2, minVal, maxVal, colors.lime, colors.gray) |
| 307 | - | else if minVal < 1000 then |
| 307 | + | else if minVal < 1500 then |
| 308 | - | progress_bar(2, 12, monX-2, minVal, maxVal, colors.lime, colors.gray) |
| 308 | + | progress_bar(2, 9, monX-2, minVal, maxVal, colors.yellow, colors.gray) |
| 309 | - | else if minVal < 1500 then |
| 309 | + | else if minVal < 2000 then |
| 310 | - | progress_bar(2, 12, monX-2, minVal, maxVal, colors.yellow, colors.gray) |
| 310 | + | progress_bar(2, 9, monX-2, minVal, maxVal, colors.orange, colors.gray) |
| 311 | - | else if minVal < 2000 then |
| 311 | + | else if minVal >= 2000 then |
| 312 | - | progress_bar(2, 12, monX-2, minVal, maxVal, colors.orange, colors.gray) |
| 312 | + | progress_bar(2, 9, monX-2, 2000, maxVal, colors.red, colors.gray) |
| 313 | - | else if minVal >= 2000 then |
| 313 | + | |
| 314 | - | progress_bar(2, 12, monX-2, 2000, maxVal, colors.red, colors.gray) |
| 314 | + | |
| 315 | - | end |
| 315 | + | |
| 316 | - | end |
| 316 | + | |
| 317 | - | end |
| 317 | + | |
| 318 | - | end |
| 318 | + | |
| 319 | - | end |
| 319 | + | draw_text(15, 8, math.floor(minVal).." C", colors.white, colors.black) |
| 320 | - | draw_text(15, 11, math.floor(minVal).." C", colors.white, colors.black) |
| 320 | + | |
| 321 | -----------CASING HEAT--------------- | |
| 322 | - | -------------FUEL CONSUMPTION------------------- |
| 322 | + | draw_text(2, 11, "Casing Temp:", colors.yellow, colors.black) |
| 323 | local maxVal = 2000 | |
| 324 | - | draw_text(2, 14, "Fuel/Tick:", colors.yellow, colors.black) |
| 324 | + | local minVal = math.floor(reactor.getCasingTemperature()) |
| 325 | - | fuel_usage = reactor.getFuelConsumedLastTick() |
| 325 | + | if minVal < 500 then |
| 326 | - | fuelConsumed = roundNumber(fuel_usage, 5) |
| 326 | + | progress_bar(2, 12, monX-2, minVal, maxVal, colors.cyan, colors.gray) |
| 327 | - | draw_text(13, 14, fuelConsumed.." mB/T", colors.white, colors.black) |
| 327 | + | else if minVal < 1000 then |
| 328 | progress_bar(2, 12, monX-2, minVal, maxVal, colors.lime, colors.gray) | |
| 329 | - | -------------OUTPUT------------------- |
| 329 | + | else if minVal < 1500 then |
| 330 | - | if reactor.isActivelyCooled() then |
| 330 | + | progress_bar(2, 12, monX-2, minVal, maxVal, colors.yellow, colors.gray) |
| 331 | else if minVal < 2000 then | |
| 332 | - | draw_text(2, 16, "mB/tick:", colors.yellow, colors.black) |
| 332 | + | progress_bar(2, 12, monX-2, minVal, maxVal, colors.orange, colors.gray) |
| 333 | - | mbt = math.floor(reactor.getHotFluidProducedLastTick()) |
| 333 | + | else if minVal >= 2000 then |
| 334 | - | draw_text(13, 16, mbt.." mB/t", colors.white, colors.black) |
| 334 | + | progress_bar(2, 12, monX-2, 2000, maxVal, colors.red, colors.gray) |
| 335 | end | |
| 336 | - | else |
| 336 | + | |
| 337 | end | |
| 338 | - | draw_text(2, 16, "RF/Tick:", colors.yellow, colors.black) |
| 338 | + | |
| 339 | - | rft = math.floor(reactor.getEnergyProducedLastTick()) |
| 339 | + | |
| 340 | - | draw_text(13, 16, rft.." RF/T", colors.white, colors.black) |
| 340 | + | draw_text(15, 11, math.floor(minVal).." C", colors.white, colors.black) |
| 341 | ||
| 342 | - | end |
| 342 | + | -------------FUEL CONSUMPTION------------------- |
| 343 | ||
| 344 | - | ------------STORAGE------------ |
| 344 | + | draw_text(2, 14, "Fuel/Tick:", colors.yellow, colors.black) |
| 345 | - | if reactor.isActivelyCooled() then |
| 345 | + | |
| 346 | fuelConsumed = roundNumber(fuel_usage, 5) | |
| 347 | - | draw_text(2, 18, "mB Stored:", colors.yellow, colors.black) |
| 347 | + | draw_text(13, 14, fuelConsumed.." mB/T", colors.white, colors.black) |
| 348 | - | fluid_stored = reactor.getHotFluidAmount() |
| 348 | + | |
| 349 | - | fluid_max = reactor.getHotFluidAmountMax() |
| 349 | + | -------------OUTPUT------------------- |
| 350 | - | fluid_stored_percent = math.floor((fluid_stored/fluid_max)*100) |
| 350 | + | |
| 351 | - | draw_text(13, 18, fluid_stored_percent.."% ("..fluid_stored.." mB)", colors.white, colors.black)
|
| 351 | + | |
| 352 | draw_text(2, 16, "mB/tick:", colors.yellow, colors.black) | |
| 353 | - | else |
| 353 | + | mbt = math.floor(reactor.getHotFluidProducedLastTick()) |
| 354 | draw_text(13, 16, mbt.." mB/t", colors.white, colors.black) | |
| 355 | - | draw_text(2, 18, "RF Stored:", colors.yellow, colors.black) |
| 355 | + | |
| 356 | - | energy_stored_percent = math.floor((energy_stored/10000000)*100) |
| 356 | + | |
| 357 | - | local maxVal = 100 |
| 357 | + | |
| 358 | - | local minVal = energy_stored_percent |
| 358 | + | draw_text(2, 16, "RF/Tick:", colors.yellow, colors.black) |
| 359 | - | draw_text(13, 18, energy_stored_percent.."% ("..energy_stored.." RF)", colors.white, colors.black)
|
| 359 | + | |
| 360 | - | |
| 360 | + | draw_text(13, 16, rft.." RF/T", colors.white, colors.black) |
| 361 | - | progress_bar(2, 19, monX-2, minVal, maxVal, colors.lime, colors.gray) |
| 361 | + | |
| 362 | - | end |
| 362 | + | |
| 363 | ||
| 364 | ------------STORAGE------------ | |
| 365 | - | -------------AUTO CONTROL RODS----------------------- |
| 365 | + | |
| 366 | - | auto_rods_bool = auto_rods == "true" |
| 366 | + | |
| 367 | - | insertion_percent = reactor.getControlRodLevel(0) |
| 367 | + | draw_text(2, 18, "mB Stored:", colors.yellow, colors.black) |
| 368 | fluid_stored = reactor.getHotFluidAmount() | |
| 369 | - | if reactor.isActivelyCooled() then |
| 369 | + | fluid_max = reactor.getHotFluidAmountMax() |
| 370 | - | draw_text(2, 21, "Control Rods:", colors.yellow, colors.black) |
| 370 | + | fluid_stored_percent = math.floor((fluid_stored/fluid_max)*100) |
| 371 | - | draw_text(16, 21, insertion_percent.."%", colors.white, colors.black) |
| 371 | + | draw_text(13, 18, fluid_stored_percent.."% ("..fluid_stored.." mB)", colors.white, colors.black)
|
| 372 | - | else |
| 372 | + | |
| 373 | else | |
| 374 | - | if auto_rods_bool then |
| 374 | + | |
| 375 | - | if active then |
| 375 | + | draw_text(2, 18, "RF Stored:", colors.yellow, colors.black) |
| 376 | - | reactor.setAllControlRodLevels(energy_stored_percent) |
| 376 | + | energy_stored_percent = math.floor((energy_stored/10000000)*100) |
| 377 | - | end |
| 377 | + | local maxVal = 100 |
| 378 | local minVal = energy_stored_percent | |
| 379 | - | draw_text(2, 21, "Control Rods:", colors.yellow, colors.black) |
| 379 | + | draw_text(13, 18, energy_stored_percent.."% ("..energy_stored.." RF)", colors.white, colors.black)
|
| 380 | - | draw_text(16, 21, insertion_percent.."%", colors.white, colors.black) |
| 380 | + | |
| 381 | - | local maxVal = 100 |
| 381 | + | progress_bar(2, 19, monX-2, minVal, maxVal, colors.lime, colors.gray) |
| 382 | - | local minVal = insertion_percent |
| 382 | + | |
| 383 | ||
| 384 | - | progress_bar(2, 22, monX-2, minVal, maxVal, colors.cyan, colors.gray) |
| 384 | + | |
| 385 | - | |
| 385 | + | -------------AUTO CONTROL RODS----------------------- |
| 386 | - | else |
| 386 | + | auto_rods_bool = auto_rods == "true" |
| 387 | - | draw_text(2, 21, "Control Rods:", colors.yellow, colors.black) |
| 387 | + | insertion_percent = reactor.getControlRodLevel(0) |
| 388 | - | draw_text(16, 21, insertion_percent.."%", colors.white, colors.black) local maxVal = 100 |
| 388 | + | |
| 389 | - | local minVal = insertion_percent |
| 389 | + | |
| 390 | draw_text(2, 21, "Control Rods:", colors.yellow, colors.black) | |
| 391 | - | progress_bar(2, 22, monX-2, minVal, maxVal, colors.yellow, colors.gray) |
| 391 | + | draw_text(16, 21, insertion_percent.."%", colors.white, colors.black) |
| 392 | else | |
| 393 | - | end |
| 393 | + | |
| 394 | - | end |
| 394 | + | if auto_rods_bool then |
| 395 | if active then | |
| 396 | reactor.setAllControlRodLevels(energy_stored_percent) | |
| 397 | - | -------------AUTO SHUTOFF-------------------------- |
| 397 | + | |
| 398 | - | if reactor.isActivelyCooled() then |
| 398 | + | |
| 399 | draw_text(2, 21, "Control Rods:", colors.yellow, colors.black) | |
| 400 | - | --i dont know what I should do here |
| 400 | + | draw_text(16, 21, insertion_percent.."%", colors.white, colors.black) |
| 401 | draw_text(21, 21, "(Auto)", colors.red, colors.black) | |
| 402 | local maxVal = 100 | |
| 403 | - | else |
| 403 | + | local minVal = insertion_percent |
| 404 | - | auto = auto_string == "true" |
| 404 | + | |
| 405 | - | if auto_rods == "true" then |
| 405 | + | progress_bar(2, 22, monX-2, minVal, maxVal, colors.cyan, colors.gray) |
| 406 | - | draw_text(2, 24, "Auto:", colors.yellow, colors.black) |
| 406 | + | |
| 407 | - | draw_text(13, 24, "Control Rods", colors.white, colors.black) |
| 407 | + | |
| 408 | - | else |
| 408 | + | draw_text(2, 21, "Control Rods:", colors.yellow, colors.black) |
| 409 | - | if auto then |
| 409 | + | draw_text(16, 21, insertion_percent.."%", colors.white, colors.black) local maxVal = 100 |
| 410 | - | if active then |
| 410 | + | local minVal = insertion_percent |
| 411 | - | draw_text(2, 24, "Auto off:", colors.yellow, colors.black) |
| 411 | + | |
| 412 | - | draw_text(13, 24, off.."% RF Stored", colors.white, colors.black) |
| 412 | + | progress_bar(2, 22, monX-2, minVal, maxVal, colors.yellow, colors.gray) |
| 413 | - | if energy_stored_percent >= off then |
| 413 | + | |
| 414 | - | reactor.setActive(false) |
| 414 | + | |
| 415 | - | call_homepage() |
| 415 | + | |
| 416 | - | end |
| 416 | + | |
| 417 | - | else |
| 417 | + | |
| 418 | - | draw_text(2, 24, "Auto on:", colors.yellow, colors.black) |
| 418 | + | -------------AUTO SHUTOFF-------------------------- |
| 419 | - | draw_text(13, 24, on.."% RF Stored", colors.white, colors.black) |
| 419 | + | |
| 420 | - | if energy_stored_percent <= on then |
| 420 | + | |
| 421 | - | reactor.setActive(true) |
| 421 | + | --i dont know what I should do here |
| 422 | - | call_homepage() |
| 422 | + | |
| 423 | - | end |
| 423 | + | |
| 424 | - | end |
| 424 | + | |
| 425 | - | else |
| 425 | + | |
| 426 | - | draw_text(2, 24, "Auto power:", colors.yellow, colors.black) |
| 426 | + | if auto then |
| 427 | - | draw_text(14, 24, "disabled", colors.red, colors.black) |
| 427 | + | |
| 428 | - | end |
| 428 | + | draw_text(2, 24, "Auto off:", colors.yellow, colors.black) |
| 429 | - | end |
| 429 | + | draw_text(13, 24, off.."% RF Stored", colors.white, colors.black) |
| 430 | - | end |
| 430 | + | if energy_stored_percent >= off then |
| 431 | reactor.setActive(false) | |
| 432 | - | sleep(0.5) |
| 432 | + | call_homepage() |
| 433 | end | |
| 434 | else | |
| 435 | draw_text(2, 24, "Auto on:", colors.yellow, colors.black) | |
| 436 | draw_text(13, 24, on.."% RF Stored", colors.white, colors.black) | |
| 437 | if energy_stored_percent <= on then | |
| 438 | reactor.setActive(true) | |
| 439 | call_homepage() | |
| 440 | end | |
| 441 | end | |
| 442 | else | |
| 443 | draw_text(2, 24, "Auto power:", colors.yellow, colors.black) | |
| 444 | - | popup_screen(3, "Auto Management", 13) |
| 444 | + | draw_text(14, 24, "disabled", colors.red, colors.black) |
| 445 | - | draw_text(5, 5, "Energy", colors.red, colors.white) |
| 445 | + | |
| 446 | - | draw_text(15, 5, " enable ", colors.white, colors.gray) |
| 446 | + | |
| 447 | - | draw_text(5, 7, "Power", colors.lime, colors.white) |
| 447 | + | |
| 448 | - | draw_text(15, 7, " disable ", colors.white, colors.black) |
| 448 | + | |
| 449 | - | |
| 449 | + | |
| 450 | - | draw_text(5, 9, "ON when storage =", colors.gray, colors.white) |
| 450 | + | |
| 451 | - | draw_text(5, 10, " - ", colors.white, colors.black) |
| 451 | + | |
| 452 | - | draw_text(13, 10, on.."% RF", colors.black, colors.white) |
| 452 | + | |
| 453 | - | draw_text(22, 10, " + ", colors.white, colors.black) |
| 453 | + | |
| 454 | --auto power menu | |
| 455 | - | draw_text(5, 12, "OFF when storage =", colors.gray, colors.white) |
| 455 | + | |
| 456 | - | draw_text(5, 13, " - ", colors.white, colors.black) |
| 456 | + | |
| 457 | - | draw_text(13, 13, off.."% RF", colors.black, colors.white) |
| 457 | + | |
| 458 | - | draw_text(22, 13, " + ", colors.white, colors.black) |
| 458 | + | |
| 459 | ||
| 460 | - | draw_text(11, 15, " Save ", colors.white, colors.black) |
| 460 | + | popup_screen(3, "Auto Power", 11) |
| 461 | draw_text(5, 5, "Enabled", colors.lime, colors.white) | |
| 462 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 462 | + | draw_text(15, 5, " disable ", colors.white, colors.black) |
| 463 | ||
| 464 | draw_text(5, 7, "ON when storage =", colors.gray, colors.white) | |
| 465 | - | --enable rods |
| 465 | + | draw_text(5, 8, " - ", colors.white, colors.black) |
| 466 | - | if yPos == 5 then |
| 466 | + | draw_text(13, 8, on.."% RF", colors.black, colors.white) |
| 467 | - | if xPos >= 15 and xPos <= 21 then |
| 467 | + | draw_text(22, 8, " + ", colors.white, colors.black) |
| 468 | - | auto_string = "false" |
| 468 | + | |
| 469 | - | auto_rods = "true" |
| 469 | + | draw_text(5, 10, "OFF when storage =", colors.gray, colors.white) |
| 470 | - | reactor.setActive(true) |
| 470 | + | draw_text(5, 11, " - ", colors.white, colors.black) |
| 471 | - | save_config() |
| 471 | + | draw_text(13, 11, off.."% RF", colors.black, colors.white) |
| 472 | - | auto_off() |
| 472 | + | draw_text(22, 11, " + ", colors.white, colors.black) |
| 473 | - | control_rods() |
| 473 | + | |
| 474 | - | else |
| 474 | + | draw_text(11, 13, " Save ", colors.white, colors.black) |
| 475 | - | auto_off() |
| 475 | + | |
| 476 | - | control_rods() |
| 476 | + | |
| 477 | - | end |
| 477 | + | |
| 478 | - | end |
| 478 | + | --disable auto |
| 479 | if yPos == 5 then | |
| 480 | - | --disable auto |
| 480 | + | if xPos >= 15 and xPos <= 21 then |
| 481 | - | if yPos == 7 then |
| 481 | + | auto_string = "false" |
| 482 | - | if xPos >= 15 and xPos <= 21 then |
| 482 | + | save_config() |
| 483 | - | auto_string = "false" |
| 483 | + | auto_off() |
| 484 | - | save_config() |
| 484 | + | |
| 485 | - | auto_off() |
| 485 | + | auto_off() |
| 486 | - | else |
| 486 | + | |
| 487 | - | auto_off() |
| 487 | + | |
| 488 | - | end |
| 488 | + | |
| 489 | - | end |
| 489 | + | --increase/decrease auto on % |
| 490 | - | |
| 490 | + | if yPos == 8 then |
| 491 | if xPos >= 5 and xPos <= 8 then | |
| 492 | - | --increase/decrease auto on % |
| 492 | + | previous_on = on |
| 493 | - | if yPos == 10 then |
| 493 | + | on = on-1 |
| 494 | - | if xPos >= 5 and xPos <= 8 then |
| 494 | + | |
| 495 | - | previous_on = on |
| 495 | + | if xPos >= 22 and xPos <= 25 then |
| 496 | - | on = on-1 |
| 496 | + | previous_on = on |
| 497 | - | end |
| 497 | + | on = on+1 |
| 498 | - | if xPos >= 22 and xPos <= 25 then |
| 498 | + | |
| 499 | - | previous_on = on |
| 499 | + | |
| 500 | - | on = on+1 |
| 500 | + | |
| 501 | - | end |
| 501 | + | --increase/decrease auto off % |
| 502 | - | end |
| 502 | + | if yPos == 11 then |
| 503 | if xPos >= 5 and xPos <= 8 then | |
| 504 | - | --increase/decrease auto off % |
| 504 | + | previous_off = off |
| 505 | - | if yPos == 13 then |
| 505 | + | off = off-1 |
| 506 | - | if xPos >= 5 and xPos <= 8 then |
| 506 | + | |
| 507 | - | previous_off = off |
| 507 | + | if xPos >= 22 and xPos <= 25 then |
| 508 | - | off = off-1 |
| 508 | + | previous_off = off |
| 509 | - | end |
| 509 | + | off = off+1 |
| 510 | - | if xPos >= 22 and xPos <= 25 then |
| 510 | + | |
| 511 | - | previous_off = off |
| 511 | + | |
| 512 | - | off = off+1 |
| 512 | + | |
| 513 | - | end |
| 513 | + | if on < 0 then on = 0 end |
| 514 | - | end |
| 514 | + | if off >99 then off = 99 end |
| 515 | ||
| 516 | - | if on < 0 then on = 0 end |
| 516 | + | if on == off or on > off then |
| 517 | - | if off >99 then off = 99 end |
| 517 | + | on = previous_on |
| 518 | off = previous_off | |
| 519 | - | if on == off or on > off then |
| 519 | + | popup_screen(5, "Error", 6) |
| 520 | - | on = previous_on |
| 520 | + | draw_text(5, 7, "Auto On value must be", colors.black, colors.white) |
| 521 | - | off = previous_off |
| 521 | + | draw_text(5, 8, "lower then auto off", colors.black, colors.white) |
| 522 | - | popup_screen(5, "Error", 6) |
| 522 | + | draw_text(11, 10, "Okay", colors.white, colors.black) |
| 523 | - | draw_text(5, 7, "Auto On value must be", colors.black, colors.white) |
| 523 | + | |
| 524 | - | draw_text(5, 8, "lower then auto off", colors.black, colors.white) |
| 524 | + | |
| 525 | - | draw_text(11, 10, "Okay", colors.white, colors.black) |
| 525 | + | auto_off() |
| 526 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 526 | + | |
| 527 | ||
| 528 | - | auto_off() |
| 528 | + | |
| 529 | - | end |
| 529 | + | if yPos == 13 and xPos >= 11 and xPos <= 17 then |
| 530 | save_config() | |
| 531 | - | --Okay button |
| 531 | + | call_homepage() |
| 532 | - | if yPos == 15 and xPos >= 11 and xPos <= 17 then |
| 532 | + | |
| 533 | - | save_config() |
| 533 | + | |
| 534 | - | call_homepage() |
| 534 | + | |
| 535 | - | end |
| 535 | + | |
| 536 | call_homepage() | |
| 537 | - | --Exit button |
| 537 | + | |
| 538 | - | if yPos == 3 and xPos == 25 then |
| 538 | + | |
| 539 | - | call_homepage() |
| 539 | + | auto_off() |
| 540 | - | end |
| 540 | + | |
| 541 | popup_screen(3, "Auto Power", 5) | |
| 542 | - | auto_off() |
| 542 | + | draw_text(5, 5, "Disabled", colors.red, colors.white) |
| 543 | - | |
| 543 | + | draw_text(15, 5, " enable ", colors.white, colors.gray) |
| 544 | - | elseif auto_rods == "true" then --auto rods enabled |
| 544 | + | draw_text(11, 7, "Okay", colors.white, colors.black) |
| 545 | ||
| 546 | - | popup_screen(3, "Auto Management", 7) |
| 546 | + | |
| 547 | - | draw_text(5, 5, "Energy", colors.lime, colors.white) |
| 547 | + | |
| 548 | - | draw_text(15, 5, " disable ", colors.white, colors.black) |
| 548 | + | |
| 549 | - | draw_text(5, 7, "Power", colors.red, colors.white) |
| 549 | + | if yPos == 7 and xPos >= 11 and xPos <= 17 then |
| 550 | - | draw_text(15, 7, " enable ", colors.white, colors.gray) |
| 550 | + | call_homepage() |
| 551 | - | draw_text(11, 9, "Okay", colors.white, colors.black) |
| 551 | + | |
| 552 | - | |
| 552 | + | |
| 553 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 553 | + | if yPos == 5 then |
| 554 | if xPos >= 15 and xPos <= 21 then | |
| 555 | - | --Okay button |
| 555 | + | auto_string = "true" |
| 556 | - | if yPos == 9 and xPos >= 11 and xPos <= 17 then |
| 556 | + | save_config() |
| 557 | - | call_homepage() |
| 557 | + | auto_off() |
| 558 | - | end |
| 558 | + | |
| 559 | auto_off() | |
| 560 | - | if yPos == 5 then |
| 560 | + | |
| 561 | - | if xPos >= 15 and xPos <= 21 then |
| 561 | + | |
| 562 | - | auto_string = "false" |
| 562 | + | auto_off() |
| 563 | - | auto_rods = "false" |
| 563 | + | |
| 564 | - | reactor.setAllControlRodLevels(0) |
| 564 | + | |
| 565 | - | save_config() |
| 565 | + | |
| 566 | - | auto_off() |
| 566 | + | |
| 567 | - | control_rods() |
| 567 | + | |
| 568 | - | else |
| 568 | + | |
| 569 | - | auto_off() |
| 569 | + | |
| 570 | - | control_rods() |
| 570 | + | |
| 571 | - | end |
| 571 | + | |
| 572 | - | end |
| 572 | + | |
| 573 | rfmb = rft / fuel_usage | |
| 574 | - | if yPos == 7 then |
| 574 | + | |
| 575 | - | if xPos >= 15 and xPos <= 21 then |
| 575 | + | |
| 576 | - | auto_string = "true" |
| 576 | + | |
| 577 | - | auto_rods = "false" |
| 577 | + | |
| 578 | - | reactor.setAllControlRodLevels(0) |
| 578 | + | |
| 579 | - | save_config() |
| 579 | + | |
| 580 | - | auto_off() |
| 580 | + | |
| 581 | - | control_rods() |
| 581 | + | |
| 582 | - | else |
| 582 | + | |
| 583 | - | auto_off() |
| 583 | + | |
| 584 | - | control_rods() |
| 584 | + | |
| 585 | - | end |
| 585 | + | |
| 586 | - | else |
| 586 | + | |
| 587 | - | auto_off() |
| 587 | + | |
| 588 | - | control_rods() |
| 588 | + | |
| 589 | - | end |
| 589 | + | call_homepage() |
| 590 | - | |
| 590 | + | |
| 591 | ||
| 592 | - | popup_screen(3, "Auto Management", 7) |
| 592 | + | |
| 593 | - | draw_text(5, 5, "Energy", colors.red, colors.white) |
| 593 | + | |
| 594 | - | draw_text(15, 5, " enable ", colors.white, colors.gray) |
| 594 | + | call_homepage() |
| 595 | - | draw_text(5, 7, "Power", colors.red, colors.white) |
| 595 | + | |
| 596 | - | draw_text(15, 7, " enable ", colors.white, colors.gray) |
| 596 | + | |
| 597 | - | draw_text(11, 9, "Okay", colors.white, colors.black) |
| 597 | + | |
| 598 | end | |
| 599 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 599 | + | |
| 600 | ||
| 601 | - | --Okay button |
| 601 | + | |
| 602 | - | if yPos == 9 and xPos >= 11 and xPos <= 17 then |
| 602 | + | |
| 603 | - | call_homepage() |
| 603 | + | |
| 604 | - | end |
| 604 | + | |
| 605 | fuel_level = reactor.getFuelAmount() | |
| 606 | - | if yPos == 5 then |
| 606 | + | |
| 607 | - | if xPos >= 15 and xPos <= 21 then |
| 607 | + | |
| 608 | - | auto_string = "false" |
| 608 | + | |
| 609 | - | auto_rods = "true" |
| 609 | + | |
| 610 | - | reactor.setActive(true) |
| 610 | + | |
| 611 | - | save_config() |
| 611 | + | |
| 612 | - | auto_off() |
| 612 | + | |
| 613 | - | control_rods() |
| 613 | + | |
| 614 | - | else |
| 614 | + | |
| 615 | - | auto_off() |
| 615 | + | |
| 616 | - | control_rods() |
| 616 | + | |
| 617 | - | end |
| 617 | + | |
| 618 | - | end |
| 618 | + | |
| 619 | --Okay button | |
| 620 | - | if yPos == 7 then |
| 620 | + | |
| 621 | - | if xPos >= 15 and xPos <= 21 then |
| 621 | + | call_homepage() |
| 622 | - | auto_string = "true" |
| 622 | + | |
| 623 | - | auto_rods = "false" |
| 623 | + | |
| 624 | - | reactor.setAllControlRodLevels(0) |
| 624 | + | |
| 625 | - | save_config() |
| 625 | + | |
| 626 | - | auto_off() |
| 626 | + | call_homepage() |
| 627 | - | control_rods() |
| 627 | + | |
| 628 | - | else |
| 628 | + | |
| 629 | - | auto_off() |
| 629 | + | |
| 630 | - | control_rods() |
| 630 | + | |
| 631 | - | end |
| 631 | + | |
| 632 | - | else |
| 632 | + | |
| 633 | - | auto_off() |
| 633 | + | |
| 634 | - | control_rods() |
| 634 | + | |
| 635 | - | end |
| 635 | + | |
| 636 | draw_text(5, 5, "Waste Amount: ", colors.lime, colors.white) | |
| 637 | draw_text(5, 6, waste_amount.." mB", colors.black, colors.white) | |
| 638 | draw_text(8, 8, " Eject Waste ", colors.white, colors.red) | |
| 639 | draw_text(11, 10, " Close ", colors.white, colors.black) | |
| 640 | ||
| 641 | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
| |
| 642 | ||
| 643 | --eject button | |
| 644 | if yPos == 8 and xPos >= 8 and xPos <= 21 then | |
| 645 | reactor.doEjectWaste() | |
| 646 | popup_screen(5, "Waste Eject", 5) | |
| 647 | draw_text(5, 7, "Waste Ejeceted.", colors.black, colors.white) | |
| 648 | draw_text(11, 9, " Close ", colors.white, colors.black) | |
| 649 | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
| |
| 650 | --Okay button | |
| 651 | if yPos == 7 and xPos >= 11 and xPos <= 17 then | |
| 652 | call_homepage() | |
| 653 | end | |
| 654 | ||
| 655 | --Exit button | |
| 656 | if yPos == 3 and xPos == 25 then | |
| 657 | call_homepage() | |
| 658 | end | |
| 659 | end | |
| 660 | ||
| 661 | - | call_homepage() |
| 661 | + | |
| 662 | if yPos == 10 and xPos >= 11 and xPos <= 17 then | |
| 663 | call_homepage() | |
| 664 | end | |
| 665 | ||
| 666 | - | call_homepage() |
| 666 | + | |
| 667 | if yPos == 3 and xPos == 25 then | |
| 668 | call_homepage() | |
| 669 | end | |
| 670 | waste() | |
| 671 | end | |
| 672 | ||
| 673 | function set_auto_rf() | |
| 674 | popup_screen(5, "Auto Adjust", 11) | |
| 675 | draw_text(5, 7, "Try to maintain:", colors.black, colors.white) | |
| 676 | ||
| 677 | draw_text(13, 9, " ^ ", colors.white, colors.gray) | |
| 678 | draw_text(10, 11, auto_rf.." RF/t", colors.black, colors.white) | |
| 679 | draw_text(13, 13, " v ", colors.white, colors.gray) | |
| 680 | draw_text(11, 15, " Okay ", colors.white, colors.gray) | |
| 681 | ||
| 682 | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
| |
| 683 | ||
| 684 | --increase button | |
| 685 | if yPos == 9 then | |
| 686 | auto_rf = auto_rf + 100 | |
| 687 | save_config() | |
| 688 | set_auto_rf() | |
| 689 | end | |
| 690 | ||
| 691 | --decrease button | |
| 692 | if yPos == 13 then | |
| 693 | - | call_homepage() |
| 693 | + | auto_rf = auto_rf - 100 |
| 694 | if auto_rf < 0 then auto_rf = 0 end | |
| 695 | save_config() | |
| 696 | set_auto_rf() | |
| 697 | end | |
| 698 | - | call_homepage() |
| 698 | + | |
| 699 | if yPos == 15 then | |
| 700 | control_rods() | |
| 701 | end | |
| 702 | ||
| 703 | set_auto_rf() | |
| 704 | end | |
| 705 | ||
| 706 | function control_rods() | |
| 707 | ||
| 708 | if reactor.isActivelyCooled() then | |
| 709 | ||
| 710 | popup_screen(3, "Control Rods", 13) | |
| 711 | insertion_percent = reactor.getControlRodLevel(0) | |
| 712 | ||
| 713 | draw_text(5, 5, "Inserted: "..insertion_percent.."%", colors.black, colors.white) | |
| 714 | progress_bar(5, 7, 20, insertion_percent, 100, colors.yellow, colors.gray) | |
| 715 | ||
| 716 | draw_text(5, 9, " << ", colors.white, colors.black) | |
| 717 | - | reactor.doEjectWaste() |
| 717 | + | draw_text(10, 9, " < ", colors.white, colors.black) |
| 718 | - | popup_screen(5, "Waste Eject", 5) |
| 718 | + | draw_text(17, 9, " > ", colors.white, colors.black) |
| 719 | - | draw_text(5, 7, "Waste Ejeceted.", colors.black, colors.white) |
| 719 | + | draw_text(21, 9, " >> ", colors.white, colors.black) |
| 720 | - | draw_text(11, 9, " Close ", colors.white, colors.black) |
| 720 | + | |
| 721 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 721 | + | draw_text(5, 11, "Auto:", colors.black, colors.white) |
| 722 | - | --Okay button |
| 722 | + | draw_text(5, 13, "unavilable for", colors.red, colors.white) |
| 723 | - | if yPos == 7 and xPos >= 11 and xPos <= 17 then |
| 723 | + | draw_text(5, 14, "active cooling", colors.red, colors.white) |
| 724 | - | call_homepage() |
| 724 | + | |
| 725 | - | end |
| 725 | + | draw_text(11, 16, " Close ", colors.white, colors.gray) |
| 726 | ||
| 727 | - | --Exit button |
| 727 | + | |
| 728 | - | if yPos == 3 and xPos == 25 then |
| 728 | + | |
| 729 | - | call_homepage() |
| 729 | + | if yPos == 9 and xPos >= 5 and xPos <= 15 then |
| 730 | - | end |
| 730 | + | reactor.setAllControlRodLevels(insertion_percent-10) |
| 731 | end | |
| 732 | ||
| 733 | if yPos == 9 and xPos >= 10 and xPos <= 13 then | |
| 734 | reactor.setAllControlRodLevels(insertion_percent-1) | |
| 735 | - | call_homepage() |
| 735 | + | |
| 736 | ||
| 737 | if yPos == 9 and xPos >= 17 and xPos <= 20 then | |
| 738 | reactor.setAllControlRodLevels(insertion_percent+1) | |
| 739 | end | |
| 740 | - | call_homepage() |
| 740 | + | |
| 741 | if yPos == 9 and xPos >= 21 and xPos <= 25 then | |
| 742 | reactor.setAllControlRodLevels(insertion_percent+10) | |
| 743 | end | |
| 744 | ||
| 745 | ------Close button------- | |
| 746 | if yPos == 16 and xPos >= 11 and xPos <= 17 then | |
| 747 | - | draw_text(5, 7, "Try to maintain:", colors.black, colors.white) |
| 747 | + | call_homepage() |
| 748 | end | |
| 749 | - | draw_text(13, 9, " ^ ", colors.white, colors.gray) |
| 749 | + | |
| 750 | - | draw_text(10, 11, auto_rf.." RF/t", colors.black, colors.white) |
| 750 | + | ------Exit button------------ |
| 751 | - | draw_text(13, 13, " v ", colors.white, colors.gray) |
| 751 | + | if yPos == 5 and xPos == 25 then |
| 752 | - | draw_text(11, 15, " Okay ", colors.white, colors.gray) |
| 752 | + | call_homepage() |
| 753 | end | |
| 754 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 754 | + | control_rods() |
| 755 | ||
| 756 | - | --increase button |
| 756 | + | |
| 757 | - | if yPos == 9 then |
| 757 | + | |
| 758 | - | auto_rf = auto_rf + 100 |
| 758 | + | popup_screen(3, "Control Rods", 13) |
| 759 | - | save_config() |
| 759 | + | insertion_percent = reactor.getControlRodLevel(0) |
| 760 | - | set_auto_rf() |
| 760 | + | |
| 761 | - | end |
| 761 | + | draw_text(5, 5, "Inserted: "..insertion_percent.."%", colors.black, colors.white) |
| 762 | progress_bar(5, 7, 20, insertion_percent, 100, colors.yellow, colors.gray) | |
| 763 | - | --decrease button |
| 763 | + | |
| 764 | - | if yPos == 13 then |
| 764 | + | draw_text(5, 9, " << ", colors.white, colors.black) |
| 765 | - | auto_rf = auto_rf - 100 |
| 765 | + | draw_text(10, 9, " < ", colors.white, colors.black) |
| 766 | - | if auto_rf < 0 then auto_rf = 0 end |
| 766 | + | draw_text(17, 9, " > ", colors.white, colors.black) |
| 767 | - | save_config() |
| 767 | + | draw_text(21, 9, " >> ", colors.white, colors.black) |
| 768 | - | set_auto_rf() |
| 768 | + | |
| 769 | - | end |
| 769 | + | draw_text(5, 11, "Auto:", colors.black, colors.white) |
| 770 | draw_text(16, 11, " disable ", colors.white, colors.black) | |
| 771 | - | if yPos == 15 then |
| 771 | + | |
| 772 | - | control_rods() |
| 772 | + | auto_rods_bool = auto_rods == "true" |
| 773 | - | end |
| 773 | + | if auto_rods_bool then |
| 774 | ||
| 775 | - | set_auto_rf() |
| 775 | + | draw_text(16, 11, " enable ", colors.white, colors.black) |
| 776 | draw_text(5, 13, "enabled", colors.green, colors.white) | |
| 777 | else | |
| 778 | draw_text(16, 11, " enable ", colors.white, colors.black) | |
| 779 | draw_text(5, 13, "disabled", colors.red, colors.white) | |
| 780 | end | |
| 781 | ||
| 782 | - | popup_screen(3, "Control Rods", 13) |
| 782 | + | draw_text(11, 15, " Close ", colors.white, colors.gray) |
| 783 | - | insertion_percent = reactor.getControlRodLevel(0) |
| 783 | + | |
| 784 | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
| |
| 785 | - | draw_text(5, 5, "Inserted: "..insertion_percent.."%", colors.black, colors.white) |
| 785 | + | |
| 786 | - | progress_bar(5, 7, 20, insertion_percent, 100, colors.yellow, colors.gray) |
| 786 | + | -----manual adjust buttons------------ |
| 787 | if yPos == 9 and xPos >= 5 and xPos <= 15 then | |
| 788 | - | draw_text(5, 9, " << ", colors.white, colors.black) |
| 788 | + | reactor.setAllControlRodLevels(insertion_percent-10) |
| 789 | - | draw_text(10, 9, " < ", colors.white, colors.black) |
| 789 | + | |
| 790 | - | draw_text(17, 9, " > ", colors.white, colors.black) |
| 790 | + | |
| 791 | - | draw_text(21, 9, " >> ", colors.white, colors.black) |
| 791 | + | if yPos == 9 and xPos >= 10 and xPos <= 13 then |
| 792 | reactor.setAllControlRodLevels(insertion_percent-1) | |
| 793 | - | draw_text(5, 11, "Auto:", colors.black, colors.white) |
| 793 | + | |
| 794 | - | draw_text(5, 13, "unavilable for", colors.red, colors.white) |
| 794 | + | |
| 795 | - | draw_text(5, 14, "active cooling", colors.red, colors.white) |
| 795 | + | if yPos == 9 and xPos >= 17 and xPos <= 20 then |
| 796 | reactor.setAllControlRodLevels(insertion_percent+1) | |
| 797 | - | draw_text(11, 16, " Close ", colors.white, colors.gray) |
| 797 | + | |
| 798 | ||
| 799 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 799 | + | if yPos == 9 and xPos >= 21 and xPos <= 25 then |
| 800 | reactor.setAllControlRodLevels(insertion_percent+10) | |
| 801 | - | if yPos == 9 and xPos >= 5 and xPos <= 15 then |
| 801 | + | |
| 802 | - | reactor.setAllControlRodLevels(insertion_percent-10) |
| 802 | + | |
| 803 | - | end |
| 803 | + | |
| 804 | ------auto buttons----------------- | |
| 805 | - | if yPos == 9 and xPos >= 10 and xPos <= 13 then |
| 805 | + | if yPos == 11 and xPos >= 16 then |
| 806 | - | reactor.setAllControlRodLevels(insertion_percent-1) |
| 806 | + | if auto_rods_bool then |
| 807 | - | end |
| 807 | + | auto_rods = "false" |
| 808 | save_config() | |
| 809 | - | if yPos == 9 and xPos >= 17 and xPos <= 20 then |
| 809 | + | control_rods() |
| 810 | - | reactor.setAllControlRodLevels(insertion_percent+1) |
| 810 | + | |
| 811 | - | end |
| 811 | + | auto_rods = "true" |
| 812 | save_config() | |
| 813 | - | if yPos == 9 and xPos >= 21 and xPos <= 25 then |
| 813 | + | control_rods() |
| 814 | - | reactor.setAllControlRodLevels(insertion_percent+10) |
| 814 | + | |
| 815 | - | end |
| 815 | + | |
| 816 | ||
| 817 | - | ------Close button------- |
| 817 | + | ------Close button------- |
| 818 | - | if yPos == 16 and xPos >= 11 and xPos <= 17 then |
| 818 | + | if yPos == 15 and xPos >= 11 and xPos <= 17 then |
| 819 | - | call_homepage() |
| 819 | + | call_homepage() |
| 820 | - | end |
| 820 | + | |
| 821 | ||
| 822 | - | ------Exit button------------ |
| 822 | + | ------Exit button------------ |
| 823 | - | if yPos == 5 and xPos == 25 then |
| 823 | + | if yPos == 5 and xPos == 25 then |
| 824 | - | call_homepage() |
| 824 | + | call_homepage() |
| 825 | - | end |
| 825 | + | |
| 826 | - | control_rods() |
| 826 | + | control_rods() |
| 827 | ||
| 828 | end | |
| 829 | end | |
| 830 | - | popup_screen(3, "Control Rods", 13) |
| 830 | + | |
| 831 | - | insertion_percent = reactor.getControlRodLevel(0) |
| 831 | + | |
| 832 | ||
| 833 | - | draw_text(5, 5, "Inserted: "..insertion_percent.."%", colors.black, colors.white) |
| 833 | + | |
| 834 | - | progress_bar(5, 7, 20, insertion_percent, 100, colors.yellow, colors.gray) |
| 834 | + | |
| 835 | wait = read() | |
| 836 | - | draw_text(5, 9, " << ", colors.white, colors.black) |
| 836 | + | |
| 837 | - | draw_text(10, 9, " < ", colors.white, colors.black) |
| 837 | + | |
| 838 | - | draw_text(17, 9, " > ", colors.white, colors.black) |
| 838 | + | |
| 839 | - | draw_text(21, 9, " >> ", colors.white, colors.black) |
| 839 | + | |
| 840 | end | |
| 841 | - | draw_text(5, 11, "Auto:", colors.black, colors.white) |
| 841 | + | |
| 842 | - | draw_text(16, 11, " disable ", colors.white, colors.black) |
| 842 | + | |
| 843 | clear() | |
| 844 | - | auto_rods_bool = auto_rods == "true" |
| 844 | + | |
| 845 | - | if auto_rods_bool then |
| 845 | + | |
| 846 | - | |
| 846 | + | |
| 847 | - | draw_text(16, 11, " enable ", colors.white, colors.black) |
| 847 | + | draw_line(4, counter, 22, colors.white) |
| 848 | - | draw_text(5, 13, "enabled", colors.green, colors.white) |
| 848 | + | |
| 849 | - | else |
| 849 | + | |
| 850 | - | draw_text(16, 11, " enable ", colors.white, colors.black) |
| 850 | + | draw_text(5, 5, "Updating...", colors.white, colors.blue) |
| 851 | - | draw_text(5, 13, "disabled", colors.red, colors.white) |
| 851 | + | |
| 852 | - | end |
| 852 | + | |
| 853 | ||
| 854 | - | draw_text(11, 15, " Close ", colors.white, colors.gray) |
| 854 | + | if fs.exists("install") then fs.delete("install") end
|
| 855 | shell.run("pastebin get ELJptBRk install")
| |
| 856 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 856 | + | shell.run("install")
|
| 857 | end | |
| 858 | - | -----manual adjust buttons------------ |
| 858 | + | |
| 859 | - | if yPos == 9 and xPos >= 5 and xPos <= 15 then |
| 859 | + | |
| 860 | - | reactor.setAllControlRodLevels(insertion_percent-10) |
| 860 | + | |
| 861 | - | end |
| 861 | + | |
| 862 | draw_text(5, 8, "pastebin...", colors.black, colors.white) | |
| 863 | - | if yPos == 9 and xPos >= 10 and xPos <= 13 then |
| 863 | + | |
| 864 | - | reactor.setAllControlRodLevels(insertion_percent-1) |
| 864 | + | |
| 865 | - | end |
| 865 | + | |
| 866 | shell.run("pastebin get KWdzfSbG current_version.txt")
| |
| 867 | - | if yPos == 9 and xPos >= 17 and xPos <= 20 then |
| 867 | + | |
| 868 | - | reactor.setAllControlRodLevels(insertion_percent+1) |
| 868 | + | |
| 869 | - | end |
| 869 | + | |
| 870 | fs.delete("current_version.txt")
| |
| 871 | - | if yPos == 9 and xPos >= 21 and xPos <= 25 then |
| 871 | + | |
| 872 | - | reactor.setAllControlRodLevels(insertion_percent+10) |
| 872 | + | |
| 873 | - | end |
| 873 | + | |
| 874 | ||
| 875 | popup_screen(5, "Updates", 7) | |
| 876 | - | ------auto buttons----------------- |
| 876 | + | draw_text(5, 7, "Update Available!", colors.black, colors.white) |
| 877 | - | if yPos == 11 and xPos >= 16 then |
| 877 | + | draw_text(11, 9, " Install ", colors.white, colors.black) |
| 878 | - | if auto_rods_bool then |
| 878 | + | draw_text(11, 11, " Ignore ", colors.white, colors.black) |
| 879 | - | auto_rods = "false" |
| 879 | + | |
| 880 | - | save_config() |
| 880 | + | |
| 881 | - | control_rods() |
| 881 | + | |
| 882 | - | else |
| 882 | + | --Instatll button |
| 883 | - | auto_rods = "true" |
| 883 | + | if yPos == 9 and xPos >= 11 and xPos <= 17 then |
| 884 | - | save_config() |
| 884 | + | install_update() |
| 885 | - | control_rods() |
| 885 | + | |
| 886 | - | end |
| 886 | + | |
| 887 | - | end |
| 887 | + | |
| 888 | if yPos == 5 and xPos == 25 then | |
| 889 | - | ------Close button------- |
| 889 | + | call_homepage() |
| 890 | - | if yPos == 15 and xPos >= 11 and xPos <= 17 then |
| 890 | + | |
| 891 | - | call_homepage() |
| 891 | + | call_homepage() |
| 892 | - | end |
| 892 | + | |
| 893 | else | |
| 894 | - | ------Exit button------------ |
| 894 | + | popup_screen(5, "Updates", 5) |
| 895 | - | if yPos == 5 and xPos == 25 then |
| 895 | + | draw_text(5, 7, "You are up to date!", colors.black, colors.white) |
| 896 | - | call_homepage() |
| 896 | + | draw_text(11, 9, " Okay ", colors.white, colors.black) |
| 897 | - | end |
| 897 | + | |
| 898 | - | control_rods() |
| 898 | + | |
| 899 | ||
| 900 | --Okay button | |
| 901 | if yPos == 9 and xPos >= 11 and xPos <= 17 then | |
| 902 | call_homepage() | |
| 903 | end | |
| 904 | ||
| 905 | --Exit button | |
| 906 | if yPos == 5 and xPos == 25 then | |
| 907 | call_homepage() | |
| 908 | end | |
| 909 | call_homepage() | |
| 910 | end | |
| 911 | ||
| 912 | ||
| 913 | ||
| 914 | end | |
| 915 | - | clear() |
| 915 | + | |
| 916 | - | draw_line(4, 5, 22, colors.blue) |
| 916 | + | |
| 917 | clear() | |
| 918 | - | for counter = 6, 10 do |
| 918 | + | |
| 919 | - | draw_line(4, counter, 22, colors.white) |
| 919 | + | |
| 920 | - | end |
| 920 | + | |
| 921 | draw_line(4, counter, 22, colors.white) | |
| 922 | - | draw_text(5, 5, "Updating...", colors.white, colors.blue) |
| 922 | + | |
| 923 | - | draw_text(5, 7, "Open computer", colors.black, colors.white) |
| 923 | + | |
| 924 | - | draw_text(5, 8, "terminal.", colors.black, colors.white) |
| 924 | + | |
| 925 | draw_text(5, 7, "Open computer", colors.black, colors.white) | |
| 926 | - | if fs.exists("install") then fs.delete("install") end
|
| 926 | + | |
| 927 | - | shell.run("pastebin get ELJptBRk install")
|
| 927 | + | |
| 928 | - | shell.run("install")
|
| 928 | + | |
| 929 | end | |
| 930 | ||
| 931 | --stop running status screen if monitors was touched | |
| 932 | function stop() | |
| 933 | while true do | |
| 934 | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
| |
| 935 | x = xPos | |
| 936 | y = yPos | |
| 937 | stop_function = "monitor_touch" | |
| 938 | return | |
| 939 | end | |
| 940 | end | |
| 941 | ||
| 942 | function mon_touch() | |
| 943 | --when the monitor is touch on the homepage | |
| 944 | if y == 1 then | |
| 945 | if x < monX/3 then | |
| 946 | power_menu() | |
| 947 | - | popup_screen(5, "Updates", 7) |
| 947 | + | |
| 948 | - | draw_text(5, 7, "Update Available!", colors.black, colors.white) |
| 948 | + | if xPos < 9 then |
| 949 | - | draw_text(11, 9, " Install ", colors.white, colors.black) |
| 949 | + | if yPos == 2 then |
| 950 | - | draw_text(11, 11, " Ignore ", colors.white, colors.black) |
| 950 | + | reactor.setActive(true) |
| 951 | timer = 0 --reset anytime the reactor is turned on/off | |
| 952 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 952 | + | call_homepage() |
| 953 | else if yPos == 3 then | |
| 954 | - | --Instatll button |
| 954 | + | reactor.setActive(false) |
| 955 | - | if yPos == 9 and xPos >= 11 and xPos <= 17 then |
| 955 | + | timer = 0 --reset anytime the reactor is turned on/off |
| 956 | - | install_update() |
| 956 | + | call_homepage() |
| 957 | - | end |
| 957 | + | else if yPos == 4 then |
| 958 | auto_off() | |
| 959 | - | --Exit button |
| 959 | + | |
| 960 | - | if yPos == 5 and xPos == 25 then |
| 960 | + | call_homepage() |
| 961 | - | call_homepage() |
| 961 | + | |
| 962 | - | end |
| 962 | + | |
| 963 | - | call_homepage() |
| 963 | + | |
| 964 | else | |
| 965 | call_homepage() | |
| 966 | - | popup_screen(5, "Updates", 5) |
| 966 | + | |
| 967 | - | draw_text(5, 7, "You are up to date!", colors.black, colors.white) |
| 967 | + | |
| 968 | - | draw_text(11, 9, " Okay ", colors.white, colors.black) |
| 968 | + | else if x < 20 then |
| 969 | tools_menu() | |
| 970 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 970 | + | |
| 971 | if xPos < 25 and xPos > 10 then | |
| 972 | - | --Okay button |
| 972 | + | if yPos == 2 then |
| 973 | - | if yPos == 9 and xPos >= 11 and xPos <= 17 then |
| 973 | + | control_rods() |
| 974 | - | call_homepage() |
| 974 | + | else if yPos == 3 then |
| 975 | - | end |
| 975 | + | |
| 976 | else if yPos == 4 then | |
| 977 | - | --Exit button |
| 977 | + | |
| 978 | - | if yPos == 5 and xPos == 25 then |
| 978 | + | else if yPos == 5 then |
| 979 | - | call_homepage() |
| 979 | + | |
| 980 | - | end |
| 980 | + | |
| 981 | - | call_homepage() |
| 981 | + | call_homepage() |
| 982 | end | |
| 983 | end | |
| 984 | end | |
| 985 | end | |
| 986 | else | |
| 987 | call_homepage() | |
| 988 | end | |
| 989 | else if x < monX then | |
| 990 | settings_menu() | |
| 991 | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
| |
| 992 | if xPos > 13 then | |
| 993 | - | draw_line(4, counter, 22, colors.white) |
| 993 | + | if yPos == 2 then |
| 994 | update() | |
| 995 | else if yPos == 3 then | |
| 996 | reset_peripherals() | |
| 997 | else | |
| 998 | call_homepage() | |
| 999 | end | |
| 1000 | end | |
| 1001 | else | |
| 1002 | call_homepage() | |
| 1003 | end | |
| 1004 | end | |
| 1005 | end | |
| 1006 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 1006 | + | |
| 1007 | - | x = xPos |
| 1007 | + | |
| 1008 | - | y = yPos |
| 1008 | + | call_homepage() |
| 1009 | - | stop_function = "monitor_touch" |
| 1009 | + | |
| 1010 | - | return |
| 1010 | + | |
| 1011 | ||
| 1012 | function terminal_screen() | |
| 1013 | term.clear() | |
| 1014 | draw_line_term(1, 1, 55, colors.blue) | |
| 1015 | draw_text_term(13, 1, "BigReactor Controls", colors.white, colors.blue) | |
| 1016 | draw_line_term(1, 19, 55, colors.blue) | |
| 1017 | - | if x < monX/3 then |
| 1017 | + | |
| 1018 | - | power_menu() |
| 1018 | + | |
| 1019 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 1019 | + | |
| 1020 | - | if xPos < 9 then |
| 1020 | + | |
| 1021 | - | if yPos == 2 then |
| 1021 | + | |
| 1022 | - | reactor.setActive(true) |
| 1022 | + | |
| 1023 | - | timer = 0 --reset anytime the reactor is turned on/off |
| 1023 | + | |
| 1024 | - | call_homepage() |
| 1024 | + | |
| 1025 | - | else if yPos == 3 then |
| 1025 | + | |
| 1026 | - | reactor.setActive(false) |
| 1026 | + | |
| 1027 | - | timer = 0 --reset anytime the reactor is turned on/off |
| 1027 | + | |
| 1028 | - | call_homepage() |
| 1028 | + | |
| 1029 | - | else if yPos == 4 then |
| 1029 | + | |
| 1030 | - | auto_off() |
| 1030 | + | |
| 1031 | - | else |
| 1031 | + | |
| 1032 | - | call_homepage() |
| 1032 | + | |
| 1033 | - | end |
| 1033 | + | |
| 1034 | - | end |
| 1034 | + | |
| 1035 | - | end |
| 1035 | + | |
| 1036 | - | else |
| 1036 | + | |
| 1037 | - | call_homepage() |
| 1037 | + | stop_function = "nothing" |
| 1038 | - | end |
| 1038 | + | |
| 1039 | - | |
| 1039 | + | |
| 1040 | - | else if x < 20 then |
| 1040 | + | stop_function = "nothing" |
| 1041 | - | tools_menu() |
| 1041 | + | mon_touch() |
| 1042 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 1042 | + | |
| 1043 | - | if xPos < 25 and xPos > 10 then |
| 1043 | + | |
| 1044 | - | if yPos == 2 then |
| 1044 | + | |
| 1045 | - | control_rods() |
| 1045 | + | |
| 1046 | - | else if yPos == 3 then |
| 1046 | + | |
| 1047 | - | efficiency() |
| 1047 | + | |
| 1048 | - | else if yPos == 4 then |
| 1048 | + | |
| 1049 | - | fuel() |
| 1049 | + | |
| 1050 | - | else if yPos == 5 then |
| 1050 | + | |
| 1051 | - | waste() |
| 1051 | + | |
| 1052 | - | else |
| 1052 | + | |
| 1053 | - | call_homepage() |
| 1053 | + | |
| 1054 | - | end |
| 1054 | + | |
| 1055 | - | end |
| 1055 | + | |
| 1056 | - | end |
| 1056 | + | |
| 1057 | - | end |
| 1057 | + | |
| 1058 | - | else |
| 1058 | + | |
| 1059 | - | call_homepage() |
| 1059 | + | |
| 1060 | - | end |
| 1060 | + | |
| 1061 | - | else if x < monX then |
| 1061 | + | |
| 1062 | - | settings_menu() |
| 1062 | + | |
| 1063 | - | local event, side, xPos, yPos = os.pullEvent("monitor_touch")
|
| 1063 | + | |
| 1064 | - | if xPos > 13 then |
| 1064 | + | |
| 1065 | - | if yPos == 2 then |
| 1065 | + | |
| 1066 | - | update() |
| 1066 | + | draw_text_term(1, 8, "Error:", colors.red, colors.black) |
| 1067 | - | else if yPos == 3 then |
| 1067 | + | draw_text_term(1, 9, "Could not connect to reactor", colors.red, colors.black) |
| 1068 | - | reset_peripherals() |
| 1068 | + | draw_text_term(1, 10, "Reactor must be connected with networking cable", colors.white, colors.black) |
| 1069 | - | else |
| 1069 | + | draw_text_term(1, 11, "and modems or the computer is directly beside", colors.white, colors.black) |
| 1070 | - | call_homepage() |
| 1070 | + | draw_text_term(1, 12,"the reactors computer port.", colors.white, colors.black) |
| 1071 | - | end |
| 1071 | + | draw_text_term(1, 14, "Press Enter to continue...", colors.gray, colors.black) |
| 1072 | - | end |
| 1072 | + | |
| 1073 | - | else |
| 1073 | + | |
| 1074 | - | call_homepage() |
| 1074 | + | |
| 1075 | - | end |
| 1075 | + | draw_text_term(27, 5, "success", colors.lime, colors.black) |
| 1076 | - | end |
| 1076 | + | |
| 1077 | - | end |
| 1077 | + | |
| 1078 | - | end |
| 1078 | + | |
| 1079 | - | else |
| 1079 | + | |
| 1080 | - | call_homepage() |
| 1080 | + | |
| 1081 | - | end |
| 1081 | + | |
| 1082 | draw_text_term(1, 7, "Error:", colors.red, colors.black) | |
| 1083 | draw_text_term(1, 8, "Could not connect to a monitor. Place a 3x4 advanced monitor", colors.red, colors.black) | |
| 1084 | draw_text_term(1, 11, "Press Enter to continue...", colors.gray, colors.black) | |
| 1085 | wait = read() | |
| 1086 | setup_wizard() | |
| 1087 | else | |
| 1088 | monX, monY = mon.getSize() | |
| 1089 | draw_text_term(27, 6, "success", colors.lime, colors.black) | |
| 1090 | sleep(0.5) | |
| 1091 | end | |
| 1092 | draw_text_term(2, 7, "saving configuration...", colors.white, colors.black) | |
| 1093 | ||
| 1094 | save_config() | |
| 1095 | ||
| 1096 | sleep(0.1) | |
| 1097 | draw_text_term(1, 9, "Setup Complete!", colors.lime, colors.black) | |
| 1098 | sleep(1) | |
| 1099 | ||
| 1100 | auto = auto_string == "true" | |
| 1101 | call_homepage() | |
| 1102 | ||
| 1103 | end | |
| 1104 | ----------------SETUP------------------------------- | |
| 1105 | ||
| 1106 | function setup_wizard() | |
| 1107 | ||
| 1108 | term.clear() | |
| 1109 | - | stop_function = "nothing" |
| 1109 | + | |
| 1110 | - | setup_wizard() |
| 1110 | + | |
| 1111 | draw_text_term(1, 1, "BigReactor Controls v"..version, colors.lime, colors.black) | |
| 1112 | - | stop_function = "nothing" |
| 1112 | + | draw_text_term(1, 2, "Peripheral setup", colors.white, colors.black) |
| 1113 | - | mon_touch() |
| 1113 | + | draw_text_term(1, 4, "Step 1:", colors.lime, colors.black) |
| 1114 | draw_text_term(1, 5, "-Place 3 wide x 4 tall advanced monitors next to computer.", colors.white, colors.black) | |
| 1115 | draw_text_term(1, 7, "Step 2:", colors.lime, colors.black) | |
| 1116 | draw_text_term(1, 8, "-Place a wired modem on this computer and on the ", colors.white, colors.black) | |
| 1117 | draw_text_term(1, 9, " computer port of the reactor.", colors.white, colors.black) | |
| 1118 | draw_text_term(1, 10, "-connect modems with network cable.", colors.white, colors.black) | |
| 1119 | draw_text_term(1, 11, "-right click modems to activate.", colors.white, colors.black) | |
| 1120 | draw_text_term(1, 13, "Press Enter when ready...", colors.gray, colors.black) | |
| 1121 | ||
| 1122 | wait = read() | |
| 1123 | test_configs() | |
| 1124 | ||
| 1125 | ||
| 1126 | end | |
| 1127 | ||
| 1128 | -- peripheral searching thanks to /u/kla_sch | |
| 1129 | function reactorSearch() | |
| 1130 | local names = peripheral.getNames() | |
| 1131 | local i, name | |
| 1132 | for i, name in pairs(names) do | |
| 1133 | if peripheral.getType(name) == "BigReactors-Reactor" then | |
| 1134 | return peripheral.wrap(name) | |
| 1135 | else | |
| 1136 | --return null | |
| 1137 | end | |
| 1138 | - | draw_text_term(1, 8, "Error:", colors.red, colors.black) |
| 1138 | + | |
| 1139 | - | draw_text_term(1, 9, "Could not connect to reactor", colors.red, colors.black) |
| 1139 | + | |
| 1140 | - | draw_text_term(1, 10, "Reactor must be connected with networking cable", colors.white, colors.black) |
| 1140 | + | |
| 1141 | - | draw_text_term(1, 11, "and modems or the computer is directly beside", colors.white, colors.black) |
| 1141 | + | |
| 1142 | - | draw_text_term(1, 12,"the reactors computer port.", colors.white, colors.black) |
| 1142 | + | local names = peripheral.getNames() |
| 1143 | - | draw_text_term(1, 14, "Press Enter to continue...", colors.gray, colors.black) |
| 1143 | + | local i, name |
| 1144 | - | wait = read() |
| 1144 | + | for i, name in pairs(names) do |
| 1145 | - | setup_wizard() |
| 1145 | + | if peripheral.getType(name) == "monitor" then |
| 1146 | test = name | |
| 1147 | - | draw_text_term(27, 5, "success", colors.lime, colors.black) |
| 1147 | + | return peripheral.wrap(name) |
| 1148 | - | sleep(0.5) |
| 1148 | + | |
| 1149 | --return null | |
| 1150 | end | |
| 1151 | end | |
| 1152 | end | |
| 1153 | ||
| 1154 | - | draw_text_term(1, 7, "Error:", colors.red, colors.black) |
| 1154 | + | |
| 1155 | - | draw_text_term(1, 8, "Could not connect to a monitor. Place a 3x4 advanced monitor", colors.red, colors.black) |
| 1155 | + | |
| 1156 | - | draw_text_term(1, 11, "Press Enter to continue...", colors.gray, colors.black) |
| 1156 | + | |
| 1157 | - | wait = read() |
| 1157 | + | load_config() |
| 1158 | - | setup_wizard() |
| 1158 | + | test_configs() |
| 1159 | else | |
| 1160 | - | monX, monY = mon.getSize() |
| 1160 | + | |
| 1161 | - | draw_text_term(27, 6, "success", colors.lime, colors.black) |
| 1161 | + | |
| 1162 | - | sleep(0.5) |
| 1162 | + | |
| 1163 | ||
| 1164 | - | draw_text_term(2, 7, "saving configuration...", colors.white, colors.black) |
| 1164 | + |