From ffa6017dadd7f4f7d0a7a684b5f80ca99254638e Mon Sep 17 00:00:00 2001 From: ck <21735205+cyperdark@users.noreply.github.com> Date: Thu, 21 Nov 2024 06:31:26 +0300 Subject: [PATCH] fix: Remove gosu approach to send undefined for tourney field, if clients are not ready --- packages/tosu/src/api/utils/buildResult.ts | 27 +++++++++++++++++++- packages/tosu/src/api/utils/buildResultV2.ts | 25 +++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/packages/tosu/src/api/utils/buildResult.ts b/packages/tosu/src/api/utils/buildResult.ts index 07ee03f0..ef4b093f 100644 --- a/packages/tosu/src/api/utils/buildResult.ts +++ b/packages/tosu/src/api/utils/buildResult.ts @@ -273,7 +273,32 @@ const buildTourneyData = ( instanceManager.osuInstances ).filter((instance) => instance.isTourneyManager); if (osuTourneyManager.length < 1) { - return undefined; + return { + manager: { + ipcState: 0, + bestOF: 0, + teamName: { + left: '', + right: '' + }, + stars: { + left: 0, + right: 0 + }, + bools: { + scoreVisible: false, + starsVisible: false + }, + chat: [], + gameplay: { + score: { + left: 0, + right: 0 + } + } + }, + ipcClients: [] + }; } const osuTourneyClients = Object.values( diff --git a/packages/tosu/src/api/utils/buildResultV2.ts b/packages/tosu/src/api/utils/buildResultV2.ts index 14d13cc3..7280c5c8 100644 --- a/packages/tosu/src/api/utils/buildResultV2.ts +++ b/packages/tosu/src/api/utils/buildResultV2.ts @@ -332,7 +332,30 @@ const buildTourneyData = ( instanceManager.osuInstances ).filter((instance) => instance.isTourneyManager); if (osuTourneyManager.length < 1) { - return undefined; + return { + scoreVisible: false, + starsVisible: false, + + ipcState: 0, + bestOF: 0, + team: { + left: '', + right: '' + }, + + points: { + left: 0, + right: 0 + }, + + chat: [], + + totalScore: { + left: 0, + right: 0 + }, + clients: [] + }; } const osuTourneyClients = Object.values(