Don't need ActionBuffer

you know why? We have a little thing called the USER'S QUEUE which we can just dump shit into
This commit is contained in:
Holly Stubbs 2021-06-23 07:41:24 +01:00
parent c6e5ea0662
commit 2485638760
2 changed files with 6 additions and 26 deletions

View file

@ -1,19 +0,0 @@
module.exports = class {
constructor(initialData = Buffer) {
this.actionBuffer;
if (initialData.length == 0) {
this.actionBuffer = Buffer.alloc(0);
} else {
this.actionBuffer = initialData;
}
}
bufferAction(data = Buffer) {
if (data.length != 0)
this.actionBuffer = Buffer.concat([this.actionBuffer, data], this.actionBuffer.length + data.length);
}
toBuffer() {
return this.actionBuffer;
}
}

View file

@ -1,7 +1,6 @@
const osu = require("osu-packet"),
UserPresence = require("./UserPresence.js"),
StatusUpdate = require("./StatusUpdate.js"),
ActionBuffer = require("../ActionBuffer.js");
StatusUpdate = require("./StatusUpdate.js");
module.exports = function(CurrentUser, MatchID) {
const matchData = global.MultiplayerManager.getMatch(MatchID);
@ -11,13 +10,13 @@ module.exports = function(CurrentUser, MatchID) {
osuPacketWriter.MatchUpdate(matchData.createOsuMatchJSON());
let actions = new ActionBuffer(osuPacketWriter.toBuffer);
// Queue info on all the users in the match to the client
for (let slot in matchData.slots) {
actions.bufferAction(UserPresence(CurrentUser, slot.playerId, false));
actions.bufferAction(StatusUpdate(CurrentUser, slot.playerId, false));
CurrentUser.addActionToQueue(UserPresence(CurrentUser, slot.playerId, false));
CurrentUser.addActionToQueue(StatusUpdate(CurrentUser, slot.playerId, false));
}
CurrentUser.addActionToQueue(actions.toBuffer());
// Queue data
CurrentUser.addActionToQueue(osuPacketWriter.toBuffer);
}
}