Files
blitzkit/scripts/buildAssets/scratchedFlags.ts
T

31 lines
1.0 KiB
TypeScript
Raw Normal View History

2024-01-07 20:07:45 -06:00
import { readdir } from 'fs/promises';
import { readBase64DVPL } from '../../src/core/blitz/readBase64DVPL';
2024-04-23 09:57:59 -05:00
import { commitAssets } from '../../src/core/blitzkit/commitAssets';
import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles';
2024-08-14 14:04:06 -05:00
import { DATA } from './constants';
2024-01-07 20:07:45 -06:00
2024-01-29 17:14:51 -06:00
export async function scratchedFlags(production: boolean) {
2024-01-07 20:07:45 -06:00
console.log('Building scratched flags...');
2024-08-14 14:04:06 -05:00
const flags = await readdir(`${DATA}/Gfx/Lobby/flags`);
2024-01-20 21:35:36 -06:00
const changes = await Promise.all(
flags
.filter(
(flag) =>
flag.startsWith('flag_tutor-tank_') &&
!flag.endsWith('@2x.packed.webp.dvpl'),
)
.map(async (flag) => {
2024-08-14 14:04:06 -05:00
const content = await readBase64DVPL(`${DATA}/Gfx/Lobby/flags/${flag}`);
2024-01-20 21:35:36 -06:00
const name = flag.match(/flag_tutor-tank_(.+)\.packed\.webp/)![1];
2024-01-07 20:07:45 -06:00
2024-01-20 21:35:36 -06:00
return {
content,
encoding: 'base64',
path: `flags/scratched/${name}.webp`,
} satisfies FileChange;
}),
2024-01-07 20:07:45 -06:00
);
2024-01-20 21:35:36 -06:00
2024-01-21 00:01:32 -06:00
await commitAssets('scratched flags', changes, production);
2024-01-07 20:07:45 -06:00
}