Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Mottaker/Kontrollstasjon
- rednet.open("right")
- local R_HIGH_TEMP = 6
- local R_DMG_CRIT = 8
- local reaktorstatus = ""
- local REAKTOR_ON = "1"
- local REAKTOR_OFF = "2"
- local ALARM_OFF = "3"
- while true do
- id, msg = rednet.receive()
- term.setCursorPos(1,1)
- print("1. For å starte reaktor")
- term.setCursorPos(1,2)
- print("2. For å stoppe reaktor")
- term.setCursorPos(1,3)
- print("3. For å skru av alarm")
- print("Reaktorstatus: ")
- print(reaktorstatus)
- pw = read()
- if id == R_HIGH_TEMP and msg == "HIGH_TEMP" then
- term.setCursorPos(1,5)
- print("Fra "..id)
- print("ADVARSEL! MELDING MOTTATT: HIGH_TEMP")
- print("ALARM PÅ!")
- rednet.broadcast("ALARM_ON")
- rednet.broadcast("REACTOR_OFF")
- print("REAKTOR SKRUDD AV")
- reaktorstatus = 0
- end
- if id == R_DMG_CRIT and msg == "DMG_CRIT" then
- term.setCursorPos(1,5)
- print("Fra "..id)
- print("ADVARSEL! MELDING MOTTATT: DMG_CRIT")
- print("ALARM PÅ!")
- rednet.broadcast("ALARM_ON")
- rednet.broadcast("REACTOR_OFF")
- print("REAKTOR SKRUDD AV")
- reaktorstatus = 0
- end
- if pw == REAKTOR_ON then
- rednet.broadcast("REACTOR_ON")
- reaktorstatus = 1
- term.clear()
- term.setCursorPos(1,1)
- print("Reaktor er skrudd på")
- sleep(1)
- end
- if pw == REAKTOR_OFF then
- rednet.broadcast("REACTOR_OFF")
- reaktorstatus = 0
- term.clear()
- term.setCursorPos(1,1)
- print("Reaktor er skrudd av")
- sleep(1)
- end
- end
Add Comment
Please, Sign In to add comment