make match finish async again

This commit is contained in:
Holly Stubbs 2022-11-27 23:48:43 +00:00
parent 1907e9910d
commit b6a0d5e4b1
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E

View file

@ -550,10 +550,12 @@ export class Match {
} }
// All players have finished playing, finish the match // All players have finished playing, finish the match
if (allLoaded) await this.finishMatch(); if (allLoaded) {
await this.finishMatch();
}
} }
public finishMatch() { public async finishMatch() {
if (!this.inProgress) { if (!this.inProgress) {
return; return;
} }
@ -597,6 +599,8 @@ export class Match {
slot.status = SlotStatus.NotReady; slot.status = SlotStatus.NotReady;
} }
await this.sharedContent.database.query("INSERT INTO mp_match_rounds (id, match_id, round_id, round_mode, match_type, round_scoring_type, round_team_type, round_mods, beatmap_md5, freemod, player0, player1, player2, player3, player4, player5, player6, player7, player8, player9, player10, player11, player12, player13, player14, player15) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", queryData);
osuPacketWriter.MatchComplete(); osuPacketWriter.MatchComplete();
// Inform all users in the match that it is complete // Inform all users in the match that it is complete
@ -609,8 +613,6 @@ export class Match {
// TODO: Re-implement multiplayer extras // TODO: Re-implement multiplayer extras
//if (this.multiplayerExtras != null) this.multiplayerExtras.onMatchFinished(JSON.parse(JSON.stringify(this.playerScores))); //if (this.multiplayerExtras != null) this.multiplayerExtras.onMatchFinished(JSON.parse(JSON.stringify(this.playerScores)));
this.sharedContent.database.query("INSERT INTO mp_match_rounds (id, match_id, round_id, round_mode, match_type, round_scoring_type, round_team_type, round_mods, beatmap_md5, freemod, player0, player1, player2, player3, player4, player5, player6, player7, player8, player9, player10, player11, player12, player13, player14, player15) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", queryData);
this.playerScores = undefined; this.playerScores = undefined;
} }