File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { ItemId } from '../commons/CommonTypes';
22import { GameItemType } from '../location/GameMapTypes' ;
33import { GameSoundType } from '../sound/GameSoundTypes' ;
44import Parser from './Parser' ;
5+ import SoundAssets from '../assets/SoundAssets' ;
56
67export enum GameEntityType {
78 locations = 'locations' ,
@@ -203,22 +204,24 @@ export default class ParserValidator {
203204 break ;
204205
205206 case GameEntityType . bgms :
206- const numberOfBgm = Parser . checkpoint . map
207- . getSoundAssets ( )
208- . filter (
207+ const numberOfBgm = [
208+ ...Parser . checkpoint . map . getSoundAssets ( ) , // Imported sound assets
209+ ...Object . values ( SoundAssets ) // Default sound assets
210+ ] . filter (
209211 sound => sound . soundType === GameSoundType . BGM && sound . key === itemId
210212 ) . length ;
211213 if ( numberOfBgm === 0 ) {
212- console . error ( `Cannot find bgm key "${ itemId } "` ) ;
214+ throw new Error ( `Cannot find bgm key "${ itemId } "` ) ;
213215 } else if ( numberOfBgm > 1 ) {
214- console . error ( `More than 1 bgm key "${ itemId } "` ) ;
216+ throw new Error ( `More than 1 bgm key "${ itemId } "` ) ;
215217 }
216218 break ;
217219
218220 case GameEntityType . sfxs :
219- const numberOfSfx = Parser . checkpoint . map
220- . getSoundAssets ( )
221- . filter (
221+ const numberOfSfx = [
222+ ...Parser . checkpoint . map . getSoundAssets ( ) , // Imported sound assets
223+ ...Object . values ( SoundAssets ) // Default sound assets
224+ ] . filter (
222225 sound => sound . soundType === GameSoundType . SFX && sound . key === itemId
223226 ) . length ;
224227 if ( numberOfSfx === 0 ) {
You can’t perform that action at this time.
0 commit comments