feat: data driven nations

This commit is contained in:
TrèsAbhi committed 2024-06-19 20:53:59 -05:00
1 parent b4bb0dcc67
commit 4927f1315c
4 files changed
+162 -148

No files matched your search

+6 -2
View File
@@ -1,5 +1,6 @@
import { readdir } from 'fs/promises';
import { readBase64DVPL } from '../../src/core/blitz/readBase64DVPL';
import sharp from 'sharp';
import { readDVPLFile } from '../../src/core/blitz/readDVPLFile';
import { commitAssets } from '../../src/core/blitzkit/commitAssets';
import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles';
import { DATA, POI } from './constants';
@@ -14,7 +15,10 @@ export async function circleFlags(production: boolean) {
!flag.endsWith('@2x.packed.webp.dvpl'),
)
.map(async (flag) => {
const content = await readBase64DVPL(`${DATA}/${POI.flags}/${flag}`);
const image = sharp(await readDVPLFile(`${DATA}/${POI.flags}/${flag}`));
const content = (
await image.trim({ threshold: 100 }).toBuffer()
).toString('base64');
const name = flag.match(/flag_profile-stat_(.+)\.packed\.webp/)![1];
return {
+13 -4
View File
@@ -353,11 +353,15 @@ export interface MapAlly {
points: Array<number[]>;
}
interface AvailableNationsYaml {
available_nations: string[];
}
const blitzShellKindToBlitzkit: Record<ShellKind, ShellType> = {
ARMOR_PIERCING: 'ap',
ARMOR_PIERCING_CR: 'ap_cr',
HIGH_EXPLOSIVE: 'he',
HOLLOW_CHARGE: 'hc',
ARMOR_PIERCING: ShellType.AP,
ARMOR_PIERCING_CR: ShellType.APCR,
HIGH_EXPLOSIVE: ShellType.HE,
HOLLOW_CHARGE: ShellType.HEAT,
};
const missingStrings: Record<string, string> = {
'#artefacts:tungstentip/name': 'Tungsten Shells',
@@ -378,6 +382,11 @@ export async function definitions(production: boolean) {
.split('.')
.slice(0, 3)
.join('.'),
nations: (
await readYAMLDVPL<AvailableNationsYaml>(
`${DATA}/available_nations.yaml.dvpl`,
)
).available_nations,
};
const tankDefinitions: TankDefinitions = {};
const modelDefinitions: ModelDefinitions = {};