From b64c44f5eec83fff0601ef7c027177193cb83dc6 Mon Sep 17 00:00:00 2001 From: Kasen IO Date: Fri, 31 Jul 2020 17:30:50 -0400 Subject: [PATCH] Make notices respect domain mute settings. --- scripts/communityScripts/chat/FloofChat.js | 38 +++++++++++++++------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/scripts/communityScripts/chat/FloofChat.js b/scripts/communityScripts/chat/FloofChat.js index 224b6eb7a8..00a55c48a2 100644 --- a/scripts/communityScripts/chat/FloofChat.js +++ b/scripts/communityScripts/chat/FloofChat.js @@ -629,26 +629,40 @@ function avatarJoinsDomain(sessionID) { Script.setTimeout(function () { var messageText = AvatarManager.getPalData([sessionID]).data[0].sessionDisplayName + " has joined." var messageColor = {red: 122, green: 122, blue: 122}; - playNotificationSound(); + addToLog(messageText, "Notice", messageColor, "Domain"); - Messages.sendLocalMessage(FLOOF_NOTIFICATION_CHANNEL, JSON.stringify({ - sender: "(D)", - text: messageText, - colour: {text: messageColor} - })); + + if (!mutedAudio["Domain"]) { + playNotificationSound(); + } + + if (!muted["Domain"]) { + Messages.sendLocalMessage(FLOOF_NOTIFICATION_CHANNEL, JSON.stringify({ + sender: "(D)", + text: messageText, + colour: {text: messageColor} + })); + } }, 500); // Wait 500ms for the avatar to load to properly get info about them. } function avatarLeavesDomain(sessionID) { var messageText = AvatarManager.getPalData([sessionID]).data[0].sessionDisplayName + " has left." var messageColor = {red: 122, green: 122, blue: 122}; - playNotificationSound(); + addToLog(messageText, "Notice", messageColor, "Domain"); - Messages.sendLocalMessage(FLOOF_NOTIFICATION_CHANNEL, JSON.stringify({ - sender: "(D)", - text: messageText, - colour: {text: messageColor} - })); + + if (!mutedAudio["Domain"]) { + playNotificationSound(); + } + + if (!muted["Domain"]) { + Messages.sendLocalMessage(FLOOF_NOTIFICATION_CHANNEL, JSON.stringify({ + sender: "(D)", + text: messageText, + colour: {text: messageColor} + })); + } } function keyPressEvent(event) {