Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- FoxInvest Holding
- ----------------------
- -- Titanus Elios
- -- Gestione del LATTE
- -----------------------
- maxw, maxh = term.getSize()
- 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()
- sfondo(colors.black)
- term.clear()
- term.setCursorPos(1, 1)
- end
- function clearRed()
- sfondo(colors.red)
- term.clear()
- term.setCursorPos(1, 1)
- end
- function titolo(testo)
- drawFilledBox(1, 1, maxw, 1, colors.white)
- term.setCursorPos((maxw - #testo) / 2, 1)
- term.setTextColor(colors.black)
- term.write(testo)
- no()
- end
- function bottone(color, text, x, y)
- term.setBackgroundColor(colors[color])
- term.setTextColor(colors.white)
- term.setCursorPos(x, y)
- print(text)
- end
- function no()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- end
- function alarm(color, text)
- term.setBackgroundColor(colors[color])
- term.setTextColor(colors.white)
- print(" "..text.." ")
- no()
- end
- function getInput(id)
- rednet.send(id, "status")
- local rID, message = rednet.receive(2)
- return message
- end
- p = peripheral.wrap("bottom")
- while true do
- -- Recupero lo stato del tank
- local a, b, c, b1 = p.get(1)
- amount = b1.amount
- -- Stato
- no()
- term.clear()
- no()
- titolo("FIH - Latte - MNG e UPS")
- OUTColor = "green"
- -- if getInput(1234) == "ON" then
- -- OUTColor = "green"
- -- else
- -- OUTColor = "red"
- -- end
- if cicalino == true then
- rs.setOutput("right", true)
- else
- rs.setOutput("right", false)
- end
- print("\n\nOUT MAN:")
- term.setCursorPos(10, 3)
- term.setBackgroundColor(colors[OUTColor])
- term.write(" ")
- no()
- print("\nOUT AUTO:")
- term.setCursorPos(10, 4)
- term.setBackgroundColor(colors[OUTColor])
- term.write(" ")
- no()
- print("\nIN AUTO:")
- term.setCursorPos(10, 5)
- term.setBackgroundColor(colors[OUTColor])
- term.write(" ")
- no()
- print("\nIN MAN:")
- term.setCursorPos(10, 6)
- term.setBackgroundColor(colors[OUTColor])
- term.write(" ")
- no()
- print("\n\nMAX Q:")
- term.setCursorPos(10, 8)
- term.setTextColor(colors[OUTColor])
- term.write(tostring(b1.capacity))
- no()
- print("\nLIQUID:")
- term.setCursorPos(10, 9)
- term.setTextColor(colors[OUTColor])
- term.write("Milk (latte) - ID: "..b1.liquidId)
- no()
- print("\nAMOUNT:")
- term.setCursorPos(10, 10)
- term.setTextColor(colors[OUTColor])
- term.write("Milk (latte) - ID: "..amount)
- no()
- if amount < 1000000 then
- UPSColor = "orange"
- cicalino = true
- rs.setOutput("back", true)
- else
- UPSColor = "red"
- cicalino = false
- rs.setOutput("back", false)
- end
- print("\n\nUPS:")
- term.setCursorPos(10, 12)
- term.setBackgroundColor(colors[UPSColor])
- term.write(" ")
- no()
- sleep(0.2)
- end
Add Comment
Please, Sign In to add comment