Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("bottom")
- rednet.open("back")
- state = fs.open("last_state", "w")
- speaker = peripheral.wrap("left")
- --rednet.host("n", "nukeswitch_reactor")
- function setState(con)
- if con then
- state.write("true")
- else
- state.write("false")
- end
- end
- while true do
- id,message = rednet.receive("n")
- print("[" .. id .. "] " .. message)
- if id == 124 and message == "turn_on" then
- redstone.setOutput("top", true)
- speaker.playSound("minecraft:block.end_portal.spawn", 3)
- rednet.broadcast("n-word switched on at " .. textutils.formatTime(os.time()))
- elseif id == 124 and message == "turn_off" then
- redstone.setOutput("top", false)
- speaker.playSound("minecraft:entity.wolf.whine", 3)
- rednet.broadcast("n-word switched off at " .. textutils.formatTime(os.time()))
- end
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement