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
- modem = component.modem
- red = component.redstone
- local sides = require("sides")
- local colors = require("colors")
- local port = 125
- local asd = 1
- print("Security")
- print("--------------------------------------------------------------------------------------------------------------------------------------------------------------")
- print()
- repeat
- modem.open(port)
- print("Listening for incoming alerts.")
- print()
- local _, _, _, _, _, raw, address_raw = event.pull(nil, "modem_message")
- modem.close(port)
- print("Message recieved.")
- os.sleep(0.5)
- if raw == "intruder" then
- print("Sound the alarms!")
- red.setBundledOutput(sides.north, { [colors.brown] = 15 } )
- red.setBundledOutput(sides.north, { [colors.cyan] = 15 } )
- os.sleep(1)
- elseif raw == "nointruder" then
- print("stopping alarms.")
- red.setBundledOutput(sides.north, { [colors.brown] = 0 } )
- red.setBundledOutput(sides.north, { [colors.cyan] = 0 } )
- os.sleep(1)
- elseif raw == "lockdown" then
- print("Lockdown initiated!.")
- red.setBundledOutput(sides.north, { [colors.green] = 15 } )
- os.sleep(1)
- elseif raw == "liftlockdown" then
- print("Lockdown lifted!.")
- red.setBundledOutput(sides.north, { [colors.green] = 0 } )
- os.sleep(1)
- elseif raw == "alarm+lock" then
- print("Lockdown initiated, alarms sounded!.")
- red.setBundledOutput(sides.north, { [colors.brown] = 15 } )
- red.setBundledOutput(sides.north, { [colors.cyan] = 15 } )
- red.setBundledOutput(sides.north, { [colors.green] = 15 } )
- os.sleep(1)
- elseif raw == "liftalarm+lock" then
- print("Lockdown lifted, alarms off!.")
- red.setBundledOutput(sides.north, { [colors.brown] = 0 } )
- red.setBundledOutput(sides.north, { [colors.cyan] = 0 } )
- red.setBundledOutput(sides.north, { [colors.green] = 0 } )
- os.sleep(1)
- elseif raw == "alarmson" then
- print("Alarms on!.")
- red.setBundledOutput(sides.north, { [colors.brown] = 15 } )
- os.sleep(1)
- elseif raw == "alarmsoff" then
- print("Alarms off!.")
- red.setBundledOutput(sides.north, { [colors.brown] = 0 } )
- os.sleep(1)
- elseif raw == "turretson" then
- print("Turrets on.")
- red.setBundledOutput(sides.north, { [colors.cyan] = 15 } )
- os.sleep(1)
- elseif raw == "turretsoff" then
- print("Turrets off.")
- red.setBundledOutput(sides.north, { [colors.cyan] = 0 } )
- os.sleep(1)
- elseif raw == "alarm+turret" then
- print("Sounding alarms and activating turrets.")
- red.setBundledOutput(sides.north, { [colors.brown] = 15 } )
- red.setBundledOutput(sides.north, { [colors.cyan] = 15 } )
- os.sleep(1)
- end
- until asd == 2
Add Comment
Please, Sign In to add comment