Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function bastion()
- local modem = peripheral.find("modem") or error("No modem attached", 0)
- modem.open(15) -- Open 43 so we can receive replies
- -- And wait for a reply
- local event, side, channel, replyChannel, message, distance
- repeat
- event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
- until channel == 15
- -- Process the received message based on its content
- if message == "Fortress" then
- print("Toggling Fortress Gate")
- redstone.setOutput("right", true) -- Emit a redstone signal to the right
- os.sleep(1) -- Keep the signal for 1 seconds
- redstone.setOutput("right", false) -- Turn off the redstone signal
- end
- end
- term.clear()
- term.setCursorPos(1, 1)
- print("Bastion Network Online!")
- -- Main loop
- while true do
- bastion()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement