Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Made by FoxWorn3365
- term.setBackgroundColor(colors.white)
- term.clear()
- -- Sistemo le funzioni
- function header(lol)
- term.setBackgroundColor(colors.lightBlue)
- term.setTextColor(colors.white)
- term.setCursorPos(16, 1)
- print(lol)
- end
- function button(x, y, text, color)
- term.setBackgroundColor(colors[color])
- term.setTextColor(colors.white)
- term.setCursorPos(x, y)
- print(text)
- end
- function sotText(x, y, tex, col, bkcol)
- term.setBackgroundColor(colors[bkcol])
- term.setTextColor(colors[col])
- term.setCursorPos(x, y)
- print(tex)
- term.setBackgroundColor(colors.white)
- end
- function ntext(x, y, text, col)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors[col])
- term.setCursorPos(x, y)
- print(text)
- end
- function n(ca)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors[ca])
- end
- function reactorSend(id, msg)
- rednet.send(id, msg)
- end
- function allarme(nun)
- if nun == 1 then
- sotText(5, 14, "! TEMPERATURA REATTORE SUPERIORE DI 1000C", "white", "red")
- n("blue")
- elseif nun == 2 then
- sotText(5, 15, "! TEMPERATURA REATTORE SUPERIORE DI 8500C", "white", "red")
- n("blue")
- elseif nun == 3 then
- sotText(5, 16, "! TEMPERATURA REATTORE SUPERIORE DI 5000C OFF", "white", "yellow")
- n("blue")
- elseif nun == 4 then
- sotText(5, 17, "! TEMPERATURA REATTORE SUPERIORE DI 5000C", "white", "orange")
- n("blue")
- elseif nun == 5 then
- sotText(5, 18, "! OUTPUT INFERIORE A 250kW", "white", "green")
- n("blue")
- end
- end
- -- Immeto i dati per configurare
- reactorName = "RBMK-1"
- emergency = "right"
- -- Sistemo qualche variabile d'ambiente
- alarmHeat0 = true
- alarmHeat1 = true
- alarmHeat2 = true
- alarmOutput = true
- -- Inizio il programma
- while true do -- Il while servir�AF�BF�BDA0 per tenere sempre aggiornati i dati
- -- Recupero i dati del reattore
- term.clear()
- p = peripheral.wrap("bottom")
- local a, b, c, t = p.get(1)
- heat = t.heat
- status = t.reactorPoweredB
- mheat = t.maxHeat
- output = t.output
- -- Elaboro alcune informazioni
- if status == true then
- statusColor = "green"
- statusText = "ATTIVO"
- else
- statusColor = "red"
- statusText = "DISATTIVO"
- end
- if heat <= 1000 then
- heatColor = "green"
- alarmHeat0 = false
- alarmHeat1 = false
- alarmHeat2 = false
- rs.setOutput(emergency, false)
- elseif heat > 1000 and heat < 5000 then
- heatColor = "yellow"
- alarmHeat0 = true
- rs.setOutput(emergency, false)
- elseif heat > 5000 and heat < 8500 then
- heatColor = "orange"
- alarmHeat1 = true
- rs.setOutput(emergency, false)
- elseif heat > 8500 then
- alarmHeat2 = true
- heatColor = "red"
- rs.setOutput(emergency, true)
- end
- if output <= 250 then
- outputColor = "orange"
- elseif output >= 251 and output <= 500 then
- outputColor = "yellow"
- else
- outputColor = "green"
- end
- if heat > 5000 and status == false then
- alarmStatus = true
- else
- alarmStatus = false
- end
- if output < 250 then
- alarmOutput = true
- else
- alarmOutput = false
- end
- -- Inizio l'interfaccia utente
- header("GESTIONE REATTORE RBMK")
- n("black")
- print("\nBenvenuto nel pannello di gestione del reattore "..reactorName)
- print("\n---------------------------------------")
- n("blue")
- print("\nStato Reattore:")
- ntext(17, 8, statusText, statusColor)
- n("blue")
- print("Temperatura:")
- ntext(14, 9, heat, heatColor)
- ntext(20, 9, " / "..mheat, "black")
- print("Output:")
- ntext(9, 10, output.."kW", outputColor)
- n("blue")
- ntext(5, 12, "ALLARMI", "red")
- if alarmHeat0 == true then
- allarme(1)
- end
- if alarmHeat1 == true then
- allarme(2)
- end
- if alarmHeat2 == true then
- allarme(3)
- end
- if alarmStatus == true then
- allarme(4)
- end
- if alarmOutput == true then
- allarme(5)
- term.setBackgroundColor(colors.white)
- end
- n("blue")
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement