SHOW:
|
|
- or go back to the newest paste.
| 1 | s = peripheral.wrap("bottom")
| |
| 2 | local function doSonarSweep() | |
| 3 | s.setAttenuation(0) | |
| 4 | s.stop(0) | |
| 5 | s.start(0, 2438) | |
| 6 | sleep(0.2) | |
| 7 | s.start(1, 2532) | |
| 8 | sleep(0.2) | |
| 9 | s.setAttenuation(10) | |
| 10 | s.stop(0) | |
| 11 | s.start(2, 2614) | |
| 12 | sleep(0.4) | |
| 13 | s.stop(0) | |
| 14 | s.stop(1) | |
| 15 | s.stop(2) | |
| 16 | end | |
| 17 | ||
| 18 | local sonColors = {1024, 2048, 512, 8192, 32, 2, 16, 16384}
| |
| 19 | ||
| 20 | local function clearScreen() | |
| 21 | term.setBackgroundColor(32768) | |
| 22 | term.clear() | |
| 23 | term.setCursorPos(1,1) | |
| 24 | term.setTextColor(1) | |
| 25 | ||
| 26 | term.setCursorPos(1, 1) | |
| 27 | - | term.write(" Gidroakusticheskiy kompleks «Kerch'»")
|
| 27 | + | term.write(" Selex ES - Sonar Attivo ")
|
| 28 | term.setCursorPos(25, 2) | |
| 29 | term.write("-O-")
| |
| 30 | ||
| 31 | term.setCursorPos(50, 3) | |
| 32 | term.write("0")
| |
| 33 | term.setCursorPos(50, 6) | |
| 34 | term.write(".5")
| |
| 35 | term.setCursorPos(50, 9) | |
| 36 | term.write("1k")
| |
| 37 | term.setCursorPos(50, 12) | |
| 38 | term.write("2k")
| |
| 39 | term.setCursorPos(50, 15) | |
| 40 | term.write("4k")
| |
| 41 | term.setCursorPos(50, 18) | |
| 42 | term.write("8k")
| |
| 43 | ||
| 44 | term.setCursorPos(1, 3) | |
| 45 | term.write("0")
| |
| 46 | term.setCursorPos(1, 6) | |
| 47 | term.write(".5")
| |
| 48 | term.setCursorPos(1, 9) | |
| 49 | term.write("1k")
| |
| 50 | term.setCursorPos(1, 12) | |
| 51 | term.write("2k")
| |
| 52 | term.setCursorPos(1, 15) | |
| 53 | term.write("4k")
| |
| 54 | term.setCursorPos(1, 18) | |
| 55 | term.write("8k")
| |
| 56 | end | |
| 57 | ||
| 58 | local function drawLine(y, modifier) | |
| 59 | for i = 4, 48 do | |
| 60 | local ran = math.floor(math.random(1, 2)) | |
| 61 | local m1 = math.floor(math.random(1, 3)) | |
| 62 | local m2 = math.floor(math.random(1, 3)) | |
| 63 | local m3 = math.floor(math.random(1, 2)) | |
| 64 | if i > 30+m2 then | |
| 65 | ran = ran | |
| 66 | elseif i > 20-m1 then | |
| 67 | ran = ran + 1 + modifier | |
| 68 | -- elseif i < 20 then | |
| 69 | -- ran = ran | |
| 70 | end | |
| 71 | ran = ran + modifier | |
| 72 | if (ran+1) > 8 then | |
| 73 | ran = 9 - (math.floor(math.random(1,2))) | |
| 74 | end | |
| 75 | local colorBase = sonColors[ran] | |
| 76 | paintutils.drawPixel(i, y, colorBase) | |
| 77 | ||
| 78 | end | |
| 79 | end | |
| 80 | ||
| 81 | clearScreen() | |
| 82 | ||
| 83 | ||
| 84 | ||
| 85 | term.setCursorPos(21, 10) | |
| 86 | term.setBackgroundColor(colors.red) | |
| 87 | term.setTextColor(colors.white) | |
| 88 | - | term.write("NACHINAT")
|
| 88 | + | term.write("AVVIA SONAR")
|
| 89 | ||
| 90 | ||
| 91 | event = os.pullEvent("mouse_click")
| |
| 92 | ||
| 93 | clearScreen() | |
| 94 | doSonarSweep() | |
| 95 | ||
| 96 | while true do | |
| 97 | for i = 3, 21 do | |
| 98 | mod = 8 - i | |
| 99 | if mod < 0 then | |
| 100 | mod = 0 | |
| 101 | end | |
| 102 | drawLine(i, mod) | |
| 103 | sleep(0.1) | |
| 104 | end | |
| 105 | doSonarSweep() | |
| 106 | end |