Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- IMPLEMENTAZIONE DEL DRAWFILLEDBOX
- local function drawPixelInternal(xPos, yPos)
- term.setCursorPos(xPos, yPos)
- term.write(" ")
- end
- local tColourLookup = {}
- for n = 1, 16 do
- tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
- end
- function drawFilledBox(startX, startY, endX, endY, nColour)
- if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
- "number" or type(endY) ~= "number" or
- (nColour ~= nil and type(nColour) ~= "number") then
- error("Expected startX, startY, endX, endY, colour", 2)
- end
- startX = math.floor(startX)
- startY = math.floor(startY)
- endX = math.floor(endX)
- endY = math.floor(endY)
- if nColour then term.setBackgroundColor(nColour) end
- if startX == endX and startY == endY then
- drawPixelInternal(startX, startY)
- return
- end
- local minX = math.min(startX, endX)
- if minX == startX then
- minY = startY
- maxX = endX
- maxY = endY
- else
- minY = endY
- maxX = startX
- maxY = startY
- end
- for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
- end
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function colore(sfumatura) term.setTextColour(sfumatura) end
- function sfondo(sfumaturaSfondo) term.setBackgroundColour(sfumaturaSfondo) end
- function fineColore() term.setTextColour(colours.white) end
- function fineSfondo() term.setBackgroundColour(colours.black) end
- function titolo(testo)
- drawFilledBox(1, 1, 51, 1, colors.yellow)
- term.setCursorPos((51 - #testo) / 2, 1)
- colore(colors.black)
- term.write(testo)
- fineSfondo()
- fineColore()
- end
- function footer()
- testo = "(C) Malakhit OKB - Aggiornato alle ore " .. textutils.formatTime(os.time(), true)
- drawFilledBox(1, 19, 51, 19, colors.yellow)
- term.setCursorPos((51 - #testo) / 2, 19)
- colore(colors.black)
- term.write(testo)
- fineSfondo()
- fineColore()
- end
- clear()
- titolo("Sistema Ritm")
- term.setCursorPos(1, 3)
- print("Attesa collegamento")
- while true do
- rednet.open("bottom")
- senderID, rawMessage = rednet.receive(10)
- rednet.close("bottom")
- if rawMessage == nil or rawMessage == "" then
- titolo("Sistema Ritm")
- term.setCursorPos(1, 3)
- colore(colors.red)
- print("Errore di comunicazione - collegamento interrotto")
- sleep(5)
- os.reboot()
- end
- message = textutils.unserialize(rawMessage)
- if message.type ~= "SKALA-RITM" then
- titolo("Sistema Ritm")
- term.setCursorPos(1, 3)
- colore(colors.red)
- print("Errore di comunicazione - manomissione rilevata")
- sleep(5)
- os.reboot()
- end
- clear()
- titolo("Sistema Ritm")
- sleep(0.1)
- term.setCursorPos(1, 3)
- if message.lowUranium == true then
- colore(colors.yellow)
- print("AVVERENTEZA: Uranio in esaurimento")
- end
- if message.steamHeat == true then
- colore(colors.white)
- print("INFORMAZIONE: Vapore saturo riscaldam. disponibile")
- end
- if message.scram == true then
- colore(colors.red)
- print("GUASTO: Reattore in SCRAM")
- else
- colore(colors.white)
- print("INFORMAZIONE: Reattore in funzione")
- end
- if message.pumpsSeized == true then
- colore(colors.red)
- print("GUASTO GRAVE: Reattore danneggiato irreparabilmente")
- else
- colore(colors.white)
- print("INFORMAZIONE: Pompe circuito primario in funzione")
- end
- footer()
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement