SHOW:
|
|
- or go back to the newest paste.
| 1 | - | --Pompa petrolio al rovescio |
| 1 | + | |
| 2 | ||
| 3 | - | -- Configurazione |
| 3 | + | |
| 4 | - | local price = 0.65 |
| 4 | + | |
| 5 | - | local meter = peripheral.wrap("bottom")
|
| 5 | + | |
| 6 | - | local meterDisplay = "left" |
| 6 | + | |
| 7 | ||
| 8 | function clearRed() | |
| 9 | sfondo(colors.red) | |
| 10 | - | -- Reset variabili |
| 10 | + | |
| 11 | - | local oil = 0 |
| 11 | + | |
| 12 | - | local contanti = 0 |
| 12 | + | |
| 13 | ||
| 14 | - | -- Accensione display di destra |
| 14 | + | |
| 15 | - | rs.setOutput("right", true)
|
| 15 | + | |
| 16 | - | -- Blocca contatore |
| 16 | + | |
| 17 | - | rs.setOutput("bottom", true)
|
| 17 | + | |
| 18 | function fineColore() term.setTextColour(colours.white) end | |
| 19 | ||
| 20 | function fineSfondo() term.setBackgroundColour(colours.black) end | |
| 21 | ||
| 22 | ||
| 23 | -- IMPLEMENTAZIONE DEL DRAWFILLEDBOX | |
| 24 | local function drawPixelInternal(xPos, yPos) | |
| 25 | term.setCursorPos(xPos, yPos) | |
| 26 | term.write(" ")
| |
| 27 | end | |
| 28 | ||
| 29 | local tColourLookup = {}
| |
| 30 | for n = 1, 16 do | |
| 31 | tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
| |
| 32 | end | |
| 33 | ||
| 34 | function drawFilledBox(startX, startY, endX, endY, nColour) | |
| 35 | if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~= | |
| 36 | "number" or type(endY) ~= "number" or | |
| 37 | (nColour ~= nil and type(nColour) ~= "number") then | |
| 38 | error("Expected startX, startY, endX, endY, colour", 2)
| |
| 39 | end | |
| 40 | ||
| 41 | startX = math.floor(startX) | |
| 42 | startY = math.floor(startY) | |
| 43 | endX = math.floor(endX) | |
| 44 | endY = math.floor(endY) | |
| 45 | ||
| 46 | if nColour then term.setBackgroundColor(nColour) end | |
| 47 | if startX == endX and startY == endY then | |
| 48 | drawPixelInternal(startX, startY) | |
| 49 | return | |
| 50 | end | |
| 51 | ||
| 52 | local minX = math.min(startX, endX) | |
| 53 | if minX == startX then | |
| 54 | minY = startY | |
| 55 | maxX = endX | |
| 56 | maxY = endY | |
| 57 | else | |
| 58 | minY = endY | |
| 59 | maxX = startX | |
| 60 | maxY = startY | |
| 61 | end | |
| 62 | ||
| 63 | for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end | |
| 64 | end | |
| 65 | ||
| 66 | ||
| 67 | function titolo(testo) | |
| 68 | drawFilledBox(1, 1, maxw, 1, colors.yellow) | |
| 69 | term.setCursorPos((maxw - #testo) / 2, 1) | |
| 70 | colore(colors.black) | |
| 71 | term.write(testo) | |
| 72 | term.setBackgroundColor(colors.black) | |
| 73 | colore(colors.white) | |
| 74 | end | |
| 75 | ||
| 76 | ||
| 77 | clear() | |
| 78 | titolo("(C) ALBANNACH - PROSEISAR COMHARRAN DIDSEATACH FRG-9600")
| |
| 79 | print("\n\nPGA: 14dB AGC: ON DSP: ON VOL: 10")
| |
| 80 | print("")
| |
| 81 | term.write(" ")
| |
| 82 | sfondo(colors.lime) | |
| 83 | term.write("WFM")
| |
| 84 | colore(colors.black) | |
| 85 | sfondo(colors.black) | |
| 86 | term.write(" ")
| |
| 87 | sfondo(colors.white) | |
| 88 | term.write("NFM")
| |
| 89 | sfondo(colors.black) | |
| 90 | term.write(" ")
| |
| 91 | sfondo(colors.white) | |
| 92 | term.write("AM")
| |
| 93 | sfondo(colors.black) | |
| 94 | - | function errore(errore) |
| 94 | + | term.write(" ")
|
| 95 | sfondo(colors.white) | |
| 96 | - | colore(colors.white) |
| 96 | + | term.write("LSB")
|
| 97 | sfondo(colors.black) | |
| 98 | term.write(" ")
| |
| 99 | - | titolo("Errore irreversibile")
|
| 99 | + | sfondo(colors.white) |
| 100 | - | term.setCursorPos(1, 3) |
| 100 | + | term.write("USB")
|
| 101 | sfondo(colors.black) | |
| 102 | - | colore(colors.white) |
| 102 | + | term.write(" ")
|
| 103 | - | print(errore) |
| 103 | + | sfondo(colors.white) |
| 104 | - | print("\n\n\nAttendere qualche secondo...")
|
| 104 | + | term.write("DSB")
|
| 105 | - | os.sleep(5) |
| 105 | + | |
| 106 | - | os.reboot() |
| 106 | + | term.write(" ")
|
| 107 | sfondo(colors.white) | |
| 108 | term.write("CW")
| |
| 109 | - | oil = meter.getAmount() |
| 109 | + | |
| 110 | - | if oil > 0 then |
| 110 | + | |
| 111 | - | -- Sblocca il contatore, così si svuota, attendi e riblocca |
| 111 | + | term.write(" Leud-bann: 110000 Hz")
|
| 112 | - | rs.setOutput("bottom", true)
|
| 112 | + | |
| 113 | - | meter.reset() |
| 113 | + | drawFilledBox(7,7,35,9,colors.yellow) |
| 114 | - | errore("Pompa temporaneamente non disponibile.\n\nLavaggio circuiti in corso...")
|
| 114 | + | term.setCursorPos(10,8) |
| 115 | - | sleep(10) |
| 115 | + | colore(colors.black) |
| 116 | - | rs.setOutput("bottom", false)
|
| 116 | + | term.write("VFO: 000.085.200.000 Hz")
|
| 117 | - | os.reboot() |
| 117 | + | |
| 118 | drawFilledBox(37,7,39,9,colors.lightBlue) | |
| 119 | drawFilledBox(41,7,43,9,colors.lightBlue) | |
| 120 | term.setCursorPos(38,8) | |
| 121 | - | titolo("NuovoPignone DigitalPump")
|
| 121 | + | term.write("-")
|
| 122 | - | print("\n\nPECTEN S.p.A.")
|
| 122 | + | term.setCursorPos(42,8) |
| 123 | term.write("+")
| |
| 124 | - | print("Premere un tasto per iniziare l'operazione")
|
| 124 | + | term.setCursorPos(1,12) |
| 125 | colore(colors.orange) | |
| 126 | wf = paintutils.loadImage("wf")
| |
| 127 | - | print("ATTENZIONE, AVVERTENZA MOLTO IMPORTANTE")
|
| 127 | + | paintutils.drawImage(wf, 1, 12) |
| 128 | - | print("NON RIAVVIARE MAI IL COMPUTER DURANTE IL POMPAGGIO")
|
| 128 | + | |
| 129 | - | print("In caso contrario, il petrolio pompato verrà perduto!")
|
| 129 | + | |
| 130 | - | os.pullEvent("key")
|
| 130 | + | term.setCursorPos(1,19) |
| 131 | term.write("85.0M 85.1M 85.2M 85.3M 85.4M")
| |
| 132 | - | sfondo(colours.blue) |
| 132 | + | os.pullEvent() |
| 133 | shell.run("rm startup")
| |
| 134 | shell.run("pastebin get GmawBEca startup")
| |
| 135 | - | titolo("Accredita su Nebraska Pay")
|
| 135 | + |