Skip to content

Commit

Permalink
fix: more try/catches because at fast speeds, still having issues wit…
Browse files Browse the repository at this point in the history
…h offsets
  • Loading branch information
KotRikD committed Dec 19, 2023
1 parent edebd3c commit 89c544e
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions packages/tosu/src/objects/instanceManager/osuInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ export class OsuInstance {

prevTime = allTimesData.PlayTime;

if (allTimesData.PlayTime < 150) {
if (
allTimesData.PlayTime < 150 &&
!gamePlayData.isDefaultState
) {
gamePlayData.init();
break;
}

Expand All @@ -238,7 +242,7 @@ export class OsuInstance {
await tourneyUserProfileData.updateState();
}
} catch (exc) {
wLogger.error('error happend while another loop executed`');
wLogger.error('error happend while another loop executed');
console.error(exc);
}

Expand All @@ -255,20 +259,27 @@ export class OsuInstance {
]);

while (!this.isDestroyed) {
switch (allTimesData.Status) {
case 2:
if (allTimesData.PlayTime < 150) {
try {
switch (allTimesData.Status) {
case 2:
if (allTimesData.PlayTime < 150) {
break;
}

await gamePlayData.updateKeyOverlay();
// await
break;
}
default:
// no-default
}

await gamePlayData.updateKeyOverlay();
// await
break;
default:
// no-default
await sleep(config.keyOverlayPollRate);
} catch (exc) {
wLogger.error(
'error happend while keyboard overlay attempted to parse'
);
console.error(exc);
}

await sleep(config.keyOverlayPollRate);
}
}

Expand Down

0 comments on commit 89c544e

Please sign in to comment.