Fix crash with concurrent duplicate cries
This commit is contained in:
parent
79c5b3d4f3
commit
66bd547d6c
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue