Fix crash with concurrent duplicate cries

pull/2/head
Flashfyre 2023-11-07 17:41:31 -05:00
parent 79c5b3d4f3
commit 66bd547d6c
1 changed files with 2 additions and 0 deletions

View File

@ -208,6 +208,8 @@ export abstract class PokemonSpeciesForm {
cry(scene: BattleScene, soundConfig?: Phaser.Types.Sound.SoundConfig, ignorePlay?: boolean): AnySound { cry(scene: BattleScene, soundConfig?: Phaser.Types.Sound.SoundConfig, ignorePlay?: boolean): AnySound {
const cryKey = this.getCryKey(this.formIndex); const cryKey = this.getCryKey(this.formIndex);
let cry = scene.sound.get(cryKey) as AnySound; let cry = scene.sound.get(cryKey) as AnySound;
if (cry?.pendingRemove)
cry = null;
cry = scene.playSound(cry || cryKey, soundConfig); cry = scene.playSound(cry || cryKey, soundConfig);
if (ignorePlay) if (ignorePlay)
cry.stop(); cry.stop();