Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local alarm_relays = {
- peripheral.wrap("redstone_relay_0"),
- peripheral.wrap("redstone_relay_1"),
- peripheral.wrap("redstone_relay_2"),
- peripheral.wrap("redstone_relay_3")
- }
- print("Found " .. #alarm_relays .. " alarm relays, toggling alarms")
- for i, relay in ipairs(alarm_relays) do
- if relay.getOutput("top") then
- print("Relay " .. i .. " is on, turning off")
- relay.setOutput("top", false)
- else
- print("Relay " .. i .. " is off, turning on")
- relay.setOutput("top", true)
- end
- end
- local alarmState = false
- if alarm_relays[1].getOutput("top") then
- alarmState = true
- end
- local door_relay = peripheral.wrap("redstone_relay_11")
- print("Found door relay, setting to " .. (alarmState and "on" or "off"))
- door_relay.setOutput("back", alarmState)
Advertisement
Add Comment
Please, Sign In to add comment