| local CooldownMsg = "Door Cooldown"
|
| local modem = peripheral.find("modem")
|
| modem.open(10)
|
|
|
| while true do
|
| local event = {os.pullEvent()}
|
| print(event[1])
|
|
|
| if event[1] == "redstone" then
|
| print(redstone.getInput("right"))
|
| if (redstone.getInput("right")) then
|
| modem.transmit(10, 10, CooldownMsg)
|
| redstone.setOutput("left", true)
|
| redstone.setOutput("top", true)
|
| sleep(1)
|
| redstone.setOutput("top", false)
|
| redstone.setOutput("left", false)
|
| sleep(0.1)
|
| end
|
| end
|
|
|
| if event[1] == "modem_message" and event[5] == CooldownMsg then
|
| print("correct msg")
|
| redstone.setOutput("top", true)
|
| local CooldownEvent
|
| os.startTimer(60)
|
| while true do
|
| CooldownEvent = {os.pullEvent()}
|
| if ((CooldownEvent[1] == "redstone") and (not redstone.getOutput("right"))) then
|
| break end
|
| if (CooldownEvent[1] == "timer") then
|
| break end
|
| end
|
| redstone.setOutput("left", false)
|
| end
|
| end
|
|
|