Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- c = require("component")
- local term = require("term")
- local component = require("component")
- event = require("event")
- os = require("os")
- event = require("event")
- computer = require("computer")
- serialization = require("serialization")
- local tun = component.tunnel
- local gpu = component.gpu -- get primary gpu component
- local w, h = gpu.getResolution()
- gpu.fill(1, 1, w, h, " ") -- clears the screen
- tun = component.tunnel
- modem = component.modem
- local port = 124
- local asd = 1
- print("Event Manager 1")
- print("--------------------------------------------------------------------------------------------------------------------------------------------------------------")
- print()
- repeat
- term.clear(false)
- modem.open(port)
- print("Listening for incoming messages and events across dimensions")
- print()
- local _, _, _, _, _, raw, address_raw = event.pull(nil, "modem_message")
- modem.close(port)
- print("Message recieved.")
- os.sleep(0.5)
- if raw == "intruderC" then
- print("Intruder by Core!")
- modem.broadcast(125, "intruder")
- os.sleep(1)
- port = -1
- tun.send("intruderC")
- port = 124
- elseif raw == "intruderR" then
- print("Intruder by reactor!")
- modem.broadcast(125, "intruder")
- os.sleep(1)
- elseif raw == "intruderSP" then
- print("Intruder by Spatial IO!")
- modem.broadcast(125, "intruder")
- os.sleep(1)
- port = -1
- tun.send("intruder")
- port = 124
- elseif raw == "intruderD" then
- print("Intruder by main door!")
- modem.broadcast(125, "intruder")
- os.sleep(1)
- port = -1
- tun.send("intruder")
- port = 124
- elseif raw == "lockdown" then
- print("Lockdown initiated!")
- modem.broadcast(125, "lockdown")
- os.sleep(1)
- port = -1
- tun.send("lockdown")
- port = 124
- elseif raw == "liftlockdown" then
- print("Lockdown lifted!")
- modem.broadcast(125, "liftlockdown")
- os.sleep(1)
- port = -1
- tun.send("liftlockdown")
- port = 124
- elseif raw == "alarm+lock" then
- print("Lockdown initiated, alarms sounded!")
- modem.broadcast(125, "alarm+lock")
- os.sleep(1)
- port = -1
- tun.send("alarm+lock")
- port = 124
- elseif raw == "liftalarm+lock" then
- print("Lockdown lifted, alarms off!")
- modem.broadcast(125, "liftalarm+lock")
- os.sleep(1)
- port = -1
- tun.send("liftalarm+lock")
- port = 124
- elseif raw == "alarmson" then
- print("Sounding alarms!")
- modem.broadcast(125, "alarmson")
- os.sleep(1)
- port = -1
- tun.send("alarmson")
- port = 124
- elseif raw == "turretson" then
- print("Activating turrets!")
- modem.broadcast(125, "turretson")
- os.sleep(1)
- port = -1
- tun.send("turretson")
- port = 124
- elseif raw == "turretsoff" then
- print("Disabling turrets!")
- modem.broadcast(125, "turretsoff")
- os.sleep(1)
- port = -1
- tun.send("turretsoff")
- port = 124
- elseif raw == "abort" then
- print("false alarm")
- modem.broadcast(125, "nointruder")
- os.sleep(1)
- port = -1
- tun.send("abort")
- port = 124
- elseif raw == "alarmsoff" then
- print("Sounding alarms!")
- modem.broadcast(125, "alarmsoff")
- os.sleep(1)
- port = -1
- tun.send("alarmsoff")
- port = 124
- elseif raw == "alarm+turret" then
- print("Sounding alarms and activating turrets")
- modem.broadcast(125, "alarm+turret")
- os.sleep(1)
- port = -1
- tun.send("alarm+turret")
- port = 124
- else
- print("Message not programmed")
- print("Message:")
- print(raw)
- os.sleep(10)
- end
- until asd == 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement