Advertisement
Guest User

nukeswitch_reactor

a guest
Oct 19th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. rednet.open("bottom")
  2. rednet.open("back")
  3. state = fs.open("last_state", "w")
  4. speaker = peripheral.wrap("left")
  5. --rednet.host("n", "nukeswitch_reactor")
  6.  
  7. function setState(con)
  8.     if con then
  9.         state.write("true")
  10.     else
  11.         state.write("false")
  12.     end
  13. end
  14.  
  15. while true do
  16.     id,message = rednet.receive("n")
  17.     print("[" .. id .. "] " .. message)
  18.     if id == 124 and message == "turn_on" then
  19.         redstone.setOutput("top", true)
  20.         speaker.playSound("minecraft:block.end_portal.spawn", 3)
  21.         rednet.broadcast("n-word switched on at " .. textutils.formatTime(os.time()))
  22.     elseif id == 124 and message == "turn_off" then
  23.         redstone.setOutput("top", false)
  24.         speaker.playSound("minecraft:entity.wolf.whine", 3)
  25.         rednet.broadcast("n-word switched off at " .. textutils.formatTime(os.time()))
  26.     end
  27.     sleep(0.5)
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement