Advertisement
Alexr360

Bastion Reciever Main

Feb 20th, 2024 (edited)
1,204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 KB | None | 0 0
  1. local function bastion()
  2.     local modem = peripheral.find("modem") or error("No modem attached", 0)
  3.     modem.open(15) -- Open 43 so we can receive replies
  4.  
  5.     -- And wait for a reply
  6.     local event, side, channel, replyChannel, message, distance
  7.     repeat
  8.       event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
  9.     until channel == 15
  10.  
  11.     -- Process the received message based on its content
  12.     if message == "Fortress" then
  13.         print("Toggling Fortress Gate")
  14.         redstone.setOutput("right", true)  -- Emit a redstone signal to the right
  15.         os.sleep(1)  -- Keep the signal for 1 seconds
  16.         redstone.setOutput("right", false)  -- Turn off the redstone signal
  17.  
  18.     end
  19. end
  20.  
  21. term.clear()
  22. term.setCursorPos(1, 1)
  23. print("Bastion Network Online!")
  24.  
  25. -- Main loop
  26. while true do
  27.     bastion()
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement