Fix crash with concurrent duplicate cries

This commit is contained in:
Flashfyre 2023-11-07 17:41:31 -05:00
parent 79c5b3d4f3
commit 66bd547d6c

View File

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