feat: improve portraits and combat audio
This commit is contained in:
17
src/game/data/unitActionAssets.ts
Normal file
17
src/game/data/unitActionAssets.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
const unitActionSheetModules = import.meta.glob('../../assets/images/units/unit-*-actions.webp', {
|
||||
eager: true,
|
||||
import: 'default'
|
||||
}) as Record<string, string>;
|
||||
|
||||
function textureKeyFromPath(path: string) {
|
||||
const fileName = path.split('/').pop() ?? path;
|
||||
return fileName.replace(/\.(?:png|webp)$/i, '');
|
||||
}
|
||||
|
||||
const unitActionSheetUrls = new Map(
|
||||
Object.entries(unitActionSheetModules).map(([path, url]) => [textureKeyFromPath(path), url])
|
||||
);
|
||||
|
||||
export function unitActionSheetUrlForKey(actionKey: string) {
|
||||
return unitActionSheetUrls.get(actionKey);
|
||||
}
|
||||
Reference in New Issue
Block a user