From a9adc1498820a72bdaf04e1841651f6bd373da34 Mon Sep 17 00:00:00 2001 From: dp0ch Date: Fri, 8 Nov 2024 07:18:41 +0100 Subject: [PATCH] catch Sprite.play() errors in egg hatch phase --- src/phases/egg-hatch-phase.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/phases/egg-hatch-phase.ts b/src/phases/egg-hatch-phase.ts index 90aceeb46bc..0dd73113437 100644 --- a/src/phases/egg-hatch-phase.ts +++ b/src/phases/egg-hatch-phase.ts @@ -329,7 +329,12 @@ export class EggHatchPhase extends Phase { this.scene.validateAchv(achvs.HATCH_SHINY); } this.eggContainer.setVisible(false); - this.pokemonSprite.play(this.pokemon.getSpriteKey(true)); + const spriteKey = this.pokemon.getSpriteKey(true); + try { + this.pokemonSprite.play(spriteKey); + } catch (err: unknown) { + console.error(`Failed to play animation for ${spriteKey}`, err); + } this.pokemonSprite.setPipelineData("ignoreTimeTint", true); this.pokemonSprite.setPipelineData("spriteKey", this.pokemon.getSpriteKey()); this.pokemonSprite.setPipelineData("shiny", this.pokemon.shiny);