From 02ae0846e25b2b2ff8e2171e41501da08522280a Mon Sep 17 00:00:00 2001 From: Ethan Stubbs <37120476+tgpethan@users.noreply.github.com> Date: Sat, 6 Feb 2021 01:22:27 +0000 Subject: [PATCH] Use different stream for match chat messages --- server/MultiplayerExtras/OsuBattleRoyale.js | 3 ++- server/MultiplayerManager.js | 2 ++ server/MultiplayerMatch.js | 3 +++ server/Packets/SendPublicMessage.js | 4 ++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/server/MultiplayerExtras/OsuBattleRoyale.js b/server/MultiplayerExtras/OsuBattleRoyale.js index 61954f2..cfe2187 100644 --- a/server/MultiplayerExtras/OsuBattleRoyale.js +++ b/server/MultiplayerExtras/OsuBattleRoyale.js @@ -39,6 +39,7 @@ module.exports = class { slot.status = 2; // Remove the kicked player from the match's stream global.StreamsHandler.removeUserFromStream(this.MultiplayerMatch.matchStreamName, kickedPlayer.uuid); + global.StreamsHandler.removeUserFromStream(this.MultiplayerMatch.matchChatStreamName, kickedPlayer.uuid); // Remove the kicked player's referance this this match kickedPlayer.currentMatch = null; @@ -62,7 +63,7 @@ module.exports = class { senderId: global.users[0].id }); - global.StreamsHandler.sendToStream(this.MultiplayerMatch.matchStreamName, osuPacketWriter.toBuffer, null); + global.StreamsHandler.sendToStream(this.MultiplayerMatch.matchChatStreamName, osuPacketWriter.toBuffer, null); } } diff --git a/server/MultiplayerManager.js b/server/MultiplayerManager.js index df56cad..1e2652d 100644 --- a/server/MultiplayerManager.js +++ b/server/MultiplayerManager.js @@ -108,6 +108,7 @@ module.exports = class { } const streamName = this.matches[matchIndex].matchStreamName; + const chatStreamName = this.matches[matchIndex].matchChatStreamName; const match = this.matches[matchIndex]; let full = true; @@ -138,6 +139,7 @@ module.exports = class { // Add user to the stream for the match global.StreamsHandler.addUserToStream(streamName, JoiningUser.uuid); + global.StreamsHandler.addUserToStream(chatStreamName, JoiningUser.uuid); // Inform all users in the match that a new user has joined global.StreamsHandler.sendToStream(streamName, osuPacketWriter1.toBuffer, null); diff --git a/server/MultiplayerMatch.js b/server/MultiplayerMatch.js index 5548267..cdac2c5 100644 --- a/server/MultiplayerMatch.js +++ b/server/MultiplayerMatch.js @@ -39,6 +39,7 @@ module.exports = class { this.seed = MatchData.seed; this.matchStreamName = `mp_${this.matchId}`; + this.matchChatStreamName = `mp_chat_${this.matchId}`; this.matchLoadSlots = null; this.matchSkippedSlots = null; @@ -60,6 +61,7 @@ module.exports = class { MatchHost.addActionToQueue(osuPacketWriter.toBuffer); global.StreamsHandler.addStream(this.matchStreamName, true, this.matchId); + global.StreamsHandler.addStream(this.matchChatStreamName, true, this.matchId); // Update the match listing for users in the multiplayer lobby global.MultiplayerManager.updateMatchListing(); @@ -122,6 +124,7 @@ module.exports = class { // Remove the leaving user from the match's stream global.StreamsHandler.removeUserFromStream(this.matchStreamName, MatchUser.uuid); + global.StreamsHandler.removeUserFromStream(this.matchChatStreamName, MatchUser.uuid); // Inform all users in the match that the leaving user has left global.StreamsHandler.sendToStream(this.matchStreamName, osuPacketWriter.toBuffer, null); diff --git a/server/Packets/SendPublicMessage.js b/server/Packets/SendPublicMessage.js index b5568ef..3e9063e 100644 --- a/server/Packets/SendPublicMessage.js +++ b/server/Packets/SendPublicMessage.js @@ -36,8 +36,8 @@ module.exports = function(CurrentUser, CurrentPacket) { }); if (CurrentPacket.data.target == "#multiplayer") { - global.StreamsHandler.sendToStream(CurrentUser.currentMatch.matchStreamName, osuPacketWriter.toBuffer, CurrentUser.uuid); - botCommandHandler(CurrentUser, CurrentPacket.data.message, CurrentUser.currentMatch.matchStreamName, true); + global.StreamsHandler.sendToStream(CurrentUser.currentMatch.matchChatStreamName, osuPacketWriter.toBuffer, CurrentUser.uuid); + botCommandHandler(CurrentUser, CurrentPacket.data.message, CurrentUser.currentMatch.matchChatStreamName, true); return; }