Use different stream for match chat messages

This commit is contained in:
Ethan Stubbs 2021-02-06 01:22:27 +00:00
parent 85cd164db6
commit 02ae0846e2
4 changed files with 9 additions and 3 deletions

View file

@ -39,6 +39,7 @@ module.exports = class {
slot.status = 2; slot.status = 2;
// Remove the kicked player from the match's stream // Remove the kicked player from the match's stream
global.StreamsHandler.removeUserFromStream(this.MultiplayerMatch.matchStreamName, kickedPlayer.uuid); 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 // Remove the kicked player's referance this this match
kickedPlayer.currentMatch = null; kickedPlayer.currentMatch = null;
@ -62,7 +63,7 @@ module.exports = class {
senderId: global.users[0].id senderId: global.users[0].id
}); });
global.StreamsHandler.sendToStream(this.MultiplayerMatch.matchStreamName, osuPacketWriter.toBuffer, null); global.StreamsHandler.sendToStream(this.MultiplayerMatch.matchChatStreamName, osuPacketWriter.toBuffer, null);
} }
} }

View file

@ -108,6 +108,7 @@ module.exports = class {
} }
const streamName = this.matches[matchIndex].matchStreamName; const streamName = this.matches[matchIndex].matchStreamName;
const chatStreamName = this.matches[matchIndex].matchChatStreamName;
const match = this.matches[matchIndex]; const match = this.matches[matchIndex];
let full = true; let full = true;
@ -138,6 +139,7 @@ module.exports = class {
// Add user to the stream for the match // Add user to the stream for the match
global.StreamsHandler.addUserToStream(streamName, JoiningUser.uuid); global.StreamsHandler.addUserToStream(streamName, JoiningUser.uuid);
global.StreamsHandler.addUserToStream(chatStreamName, JoiningUser.uuid);
// Inform all users in the match that a new user has joined // Inform all users in the match that a new user has joined
global.StreamsHandler.sendToStream(streamName, osuPacketWriter1.toBuffer, null); global.StreamsHandler.sendToStream(streamName, osuPacketWriter1.toBuffer, null);

View file

@ -39,6 +39,7 @@ module.exports = class {
this.seed = MatchData.seed; this.seed = MatchData.seed;
this.matchStreamName = `mp_${this.matchId}`; this.matchStreamName = `mp_${this.matchId}`;
this.matchChatStreamName = `mp_chat_${this.matchId}`;
this.matchLoadSlots = null; this.matchLoadSlots = null;
this.matchSkippedSlots = null; this.matchSkippedSlots = null;
@ -60,6 +61,7 @@ module.exports = class {
MatchHost.addActionToQueue(osuPacketWriter.toBuffer); MatchHost.addActionToQueue(osuPacketWriter.toBuffer);
global.StreamsHandler.addStream(this.matchStreamName, true, this.matchId); 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 // Update the match listing for users in the multiplayer lobby
global.MultiplayerManager.updateMatchListing(); global.MultiplayerManager.updateMatchListing();
@ -122,6 +124,7 @@ module.exports = class {
// Remove the leaving user from the match's stream // Remove the leaving user from the match's stream
global.StreamsHandler.removeUserFromStream(this.matchStreamName, MatchUser.uuid); 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 // Inform all users in the match that the leaving user has left
global.StreamsHandler.sendToStream(this.matchStreamName, osuPacketWriter.toBuffer, null); global.StreamsHandler.sendToStream(this.matchStreamName, osuPacketWriter.toBuffer, null);

View file

@ -36,8 +36,8 @@ module.exports = function(CurrentUser, CurrentPacket) {
}); });
if (CurrentPacket.data.target == "#multiplayer") { if (CurrentPacket.data.target == "#multiplayer") {
global.StreamsHandler.sendToStream(CurrentUser.currentMatch.matchStreamName, osuPacketWriter.toBuffer, CurrentUser.uuid); global.StreamsHandler.sendToStream(CurrentUser.currentMatch.matchChatStreamName, osuPacketWriter.toBuffer, CurrentUser.uuid);
botCommandHandler(CurrentUser, CurrentPacket.data.message, CurrentUser.currentMatch.matchStreamName, true); botCommandHandler(CurrentUser, CurrentPacket.data.message, CurrentUser.currentMatch.matchChatStreamName, true);
return; return;
} }