Simplify reaction sounds

This commit is contained in:
Half-Shot
2024-12-03 14:46:06 +00:00
parent 0c331a05ad
commit 2a45be88e9
2 changed files with 8 additions and 13 deletions

View File

@@ -38,18 +38,13 @@ export function ReactionsAudioRenderer(): ReactNode {
if (!shouldPlay) {
return;
}
const oldReactionSet = new Set(
Object.values(oldReactions).map((r) => r.name),
);
for (const reactionName of new Set(
Object.values(reactions).map((r) => r.name),
)) {
if (oldReactionSet.has(reactionName)) {
for (const [sender, reaction] of Object.entries(reactions)) {
if (oldReactions[sender]) {
// Don't replay old reactions
return;
}
if (SoundMap[reactionName]) {
audioEngineCtx.playSound(reactionName);
if (SoundMap[reaction.name]) {
audioEngineCtx.playSound(reaction.name);
} else {
// Fallback sounds.
audioEngineCtx.playSound("generic");