export function safeAddSound(
  scene: Phaser.Scene,
  key: string,
  config?: Phaser.Types.Sound.SoundConfig
): Phaser.Sound.BaseSound | undefined {
  if (!scene.cache.audio.has(key)) {
    return undefined;
  }

  try {
    return scene.sound.add(key, config);
  } catch {
    return undefined;
  }
}
