SHOW:
|
|
- or go back to the newest paste.
| 1 | while true do | |
| 2 | local reactor1 = peripheral.wrap("BigReactors-Reactor_0")
| |
| 3 | - | local mon = peripheral.wrap("monitor_0")
|
| 3 | + | local monitors = {
|
| 4 | - | mon.clear() |
| 4 | + | peripheral.wrap("monitor_0"),
|
| 5 | peripheral.wrap("monitor_1"),
| |
| 6 | - | mon.setTextScale(2) |
| 6 | + | } |
| 7 | ||
| 8 | -- Funktionen fΓΌr mehrere Monitore | |
| 9 | ||
| 10 | - | mon.setCursorPos(1,1) |
| 10 | + | local function clear() |
| 11 | - | mon.setTextColor(colors.white) |
| 11 | + | for _,mon in pairs(monitors) do |
| 12 | - | mon.write("Reaktor aktiv: ")
|
| 12 | + | mon.clear() |
| 13 | end | |
| 14 | - | mon.setTextColor(colors.lime) |
| 14 | + | |
| 15 | - | mon.write("Ja")
|
| 15 | + | |
| 16 | local function textScale() | |
| 17 | - | mon.setTextColor(colors.red) |
| 17 | + | for _,mon in pairs(monitors) do |
| 18 | - | mon.write("Nein")
|
| 18 | + | mon.setTextScale(2) |
| 19 | end | |
| 20 | end | |
| 21 | - | mon.setCursorPos(1,4) |
| 21 | + | |
| 22 | - | mon.setTextColor(colors.white) |
| 22 | + | local function cursorPos(left, top) |
| 23 | - | mon.write("Temperatur: ")
|
| 23 | + | for _,mon in pairs(monitors) do |
| 24 | - | mon.setTextColor(colors.lime) |
| 24 | + | mon.setCursorPos(left, top) |
| 25 | - | mon.write(math.floor(reactor1.getTemperature())) |
| 25 | + | end |
| 26 | - | mon.write(" C")
|
| 26 | + | |
| 27 | ||
| 28 | - | mon.setCursorPos(1,5) |
| 28 | + | local function textColor(color) |
| 29 | - | mon.setTextColor(colors.white) |
| 29 | + | for _,mon in pairs(monitors) do |
| 30 | - | mon.write("Control-Rods: ")
|
| 30 | + | mon.setTextColor(color) |
| 31 | - | mon.setTextColor(colors.lime) |
| 31 | + | end |
| 32 | - | mon.write(math.floor(reactor1.getNumberOfControlRods())) |
| 32 | + | |
| 33 | ||
| 34 | - | mon.setCursorPos(1,6) |
| 34 | + | local function print_on_screen(text) |
| 35 | - | mon.setTextColor(colors.white) |
| 35 | + | for _,mon in pairs(monitors) do |
| 36 | - | mon.write("Gespeicherte Energie: ")
|
| 36 | + | mon.write(text) |
| 37 | end | |
| 38 | - | mon.setTextColor(colors.red) |
| 38 | + | |
| 39 | ||
| 40 | - | mon.setTextColor(colors.lime) |
| 40 | + | |
| 41 | ||
| 42 | - | mon.write(math.floor(reactor1.getEnergyStored())) |
| 42 | + | clear() |
| 43 | textScale() | |
| 44 | - | mon.setCursorPos(1,7) |
| 44 | + | cursorPos(1,1) |
| 45 | - | mon.setTextColor(colors.white) |
| 45 | + | textColor(colors.white) |
| 46 | - | mon.write("Verschwendung in mB: ")
|
| 46 | + | print_on_screen("Reaktor aktiv: ")
|
| 47 | if reactor1.getActive() == true then | |
| 48 | - | mon.setTextColor(colors.red) |
| 48 | + | textColor(colors.lime) |
| 49 | print_on_screen("Ja")
| |
| 50 | - | mon.setTextColor(colors.lime) |
| 50 | + | |
| 51 | textColor(colors.red) | |
| 52 | - | mon.write(math.floor(reactor1.getWasteAmount())) |
| 52 | + | print_on_screen("Nein")
|
| 53 | end | |
| 54 | - | mon.setCursorPos(1,8) |
| 54 | + | |
| 55 | cursorPos(1,4) | |
| 56 | textColor(colors.white) | |
| 57 | print_on_screen("Temperatur: ")
| |
| 58 | - | mon.setTextColor(colors.white) |
| 58 | + | textColor(colors.lime) |
| 59 | - | mon.write("Control-Rods Level: ")
|
| 59 | + | print_on_screen(math.floor(reactor1.getTemperature())) |
| 60 | - | mon.setTextColor(colors.red) |
| 60 | + | print_on_screen(" C")
|
| 61 | - | mon.write("0")
|
| 61 | + | |
| 62 | cursorPos(1,5) | |
| 63 | textColor(colors.white) | |
| 64 | - | mon.setTextColor(colors.white) |
| 64 | + | print_on_screen("Control-Rods: ")
|
| 65 | - | mon.write("Control-Rods Level: ")
|
| 65 | + | textColor(colors.lime) |
| 66 | - | mon.setTextColor(colors.lime) |
| 66 | + | print_on_screen(math.floor(reactor1.getNumberOfControlRods())) |
| 67 | - | mon.write("90")
|
| 67 | + | |
| 68 | cursorPos(1,6) | |
| 69 | textColor(colors.white) | |
| 70 | print_on_screen("Gespeicherte Energie: ")
| |
| 71 | if math.floor(reactor1.getEnergyStored()) < 10000 then | |
| 72 | textColor(colors.red) | |
| 73 | else | |
| 74 | textColor(colors.lime) | |
| 75 | end | |
| 76 | print_on_screen(math.floor(reactor1.getEnergyStored())) | |
| 77 | ||
| 78 | cursorPos(1,7) | |
| 79 | textColor(colors.white) | |
| 80 | print_on_screen("Verschwendung in mB: ")
| |
| 81 | if math.floor(reactor1.getWasteAmount()) > 100 then | |
| 82 | textColor(colors.red) | |
| 83 | else | |
| 84 | textColor(colors.lime) | |
| 85 | end | |
| 86 | print_on_screen(math.floor(reactor1.getWasteAmount())) | |
| 87 | ||
| 88 | cursorPos(1,8) | |
| 89 | ||
| 90 | if math.floor(reactor1.getEnergyStored()) < 8000000 then | |
| 91 | reactor1.setAllControlRodLevels(0) | |
| 92 | textColor(colors.white) | |
| 93 | print_on_screen("Control-Rods Level: ")
| |
| 94 | textColor(colors.red) | |
| 95 | print_on_screen("0")
| |
| 96 | else | |
| 97 | reactor1.setAllControlRodLevels(90) | |
| 98 | textColor(colors.white) | |
| 99 | print_on_screen("Control-Rods Level: ")
| |
| 100 | textColor(colors.lime) | |
| 101 | print_on_screen("90")
| |
| 102 | end | |
| 103 | -- End Reactor 1 | |
| 104 | ||
| 105 | sleep(5) | |
| 106 | end |