diff --git a/scripts/buildAssets/index.ts b/scripts/buildAssets/index.ts index ca55b6432..92807ba0e 100644 --- a/scripts/buildAssets/index.ts +++ b/scripts/buildAssets/index.ts @@ -25,15 +25,8 @@ if (allTargets || targets?.includes('definitions')) { await buildDefinitions(); } -if ( - allTargets || - targets?.includes('bigTankIcons') || - targets?.includes('smallTankIcons') -) { - await buildTankIcons( - allTargets || targets?.includes('bigTankIcons'), - allTargets || targets?.includes('smallTankIcons'), - ); +if (allTargets || targets?.includes('tankIcons')) { + await buildTankIcons(); } if (allTargets || targets?.includes('scratchedFlags')) { diff --git a/scripts/buildAssets/tankArmors.ts b/scripts/buildAssets/tankArmors.ts index b17791f4b..0e898de46 100644 --- a/scripts/buildAssets/tankArmors.ts +++ b/scripts/buildAssets/tankArmors.ts @@ -20,8 +20,6 @@ export async function buildTankArmors() { await Promise.all( nations.map(async (nation) => { - if (nation !== 'japan') return; - const tanks = await readXMLDVPL<{ root: VehicleDefinitionList }>( `${DATA}/${POI.vehicleDefinitions}/${nation}/list.xml.dvpl`, ); @@ -30,6 +28,8 @@ export async function buildTankArmors() { Object.entries(tanks.root).map(async ([tankKey, tank]) => { const id = toUniqueId(nation, tank.id); + if (id !== 26897) return; + console.log(`Building armor ${id} @ ${nation}/${tankKey}`); const model = await extractArmor(DATA, `${nation}-${tankKey}`); diff --git a/scripts/buildAssets/tankIcons.ts b/scripts/buildAssets/tankIcons.ts index 12555bbfd..1d60faebd 100644 --- a/scripts/buildAssets/tankIcons.ts +++ b/scripts/buildAssets/tankIcons.ts @@ -17,7 +17,7 @@ export interface TankParameters { }; } -export async function buildTankIcons(big?: boolean, small?: boolean) { +export async function buildTankIcons() { console.log('Building tank icons...'); const changes: FileChange[] = []; @@ -31,35 +31,36 @@ export async function buildTankIcons(big?: boolean, small?: boolean) { `${DATA}/${POI.vehicleDefinitions}/${nation}/list.xml.dvpl`, ); - for (const tankIndex in tanks.root) { - const tank = tanks.root[tankIndex]; - const nationVehicleId = tank.id; - const id = (nationVehicleId << 8) + (NATION_IDS[nation] << 4) + 1; - const parameters = await readYAMLDVPL( - `${DATA}/${POI.tankParameters}/${nation}/${tankIndex}.yaml.dvpl`, - ); - const small = `${DATA}/${parameters.resourcesPath.smallIconPath - .replace(/~res:\//, '') - .replace(/\..+/, '')}.packed.webp.dvpl`; - const big = `${DATA}/${parameters.resourcesPath.bigIconPath - .replace(/~res:\//, '') - .replace(/\..+/, '')}.packed.webp.dvpl`; + await Promise.all( + Object.entries(tanks.root).map(async ([tankIndex, tank]) => { + const nationVehicleId = tank.id; + const id = (nationVehicleId << 8) + (NATION_IDS[nation] << 4) + 1; + const parameters = await readYAMLDVPL( + `${DATA}/${POI.tankParameters}/${nation}/${tankIndex}.yaml.dvpl`, + ); + const small = `${DATA}/${parameters.resourcesPath.smallIconPath + .replace(/~res:\//, '') + .replace(/\..+/, '')}.packed.webp.dvpl`; + const big = `${DATA}/${parameters.resourcesPath.bigIconPath + .replace(/~res:\//, '') + .replace(/\..+/, '')}.packed.webp.dvpl`; - if (big) { - changes.push({ - content: await readBase64DVPL(big), - encoding: 'base64', - path: `icons/tank/big/${id}.webp`, - }); - } - if (small) { - changes.push({ - content: await readBase64DVPL(small), - encoding: 'base64', - path: `icons/tank/small/${id}.webp`, - }); - } - } + if (big) { + changes.push({ + content: await readBase64DVPL(big), + encoding: 'base64', + path: `icons/tank/big/${id}.webp`, + }); + } + if (small) { + changes.push({ + content: await readBase64DVPL(small), + encoding: 'base64', + path: `icons/tank/small/${id}.webp`, + }); + } + }), + ); }), ); diff --git a/scripts/buildAssets/tankModels.ts b/scripts/buildAssets/tankModels.ts index f75dfa297..b849e66f5 100644 --- a/scripts/buildAssets/tankModels.ts +++ b/scripts/buildAssets/tankModels.ts @@ -27,8 +27,6 @@ export async function buildTankModels() { await Promise.all( nations.map(async (nation) => { - if (nation !== 'japan') return; - const tanks = await readXMLDVPL<{ root: VehicleDefinitionList }>( `${DATA}/${POI.vehicleDefinitions}/${nation}/list.xml.dvpl`, ); @@ -45,6 +43,8 @@ export async function buildTankModels() { Object.entries(tanks.root).map(async ([tankKey, tank]) => { const id = toUniqueId(nation, tank.id); + if (id !== 26897) return; + console.log(`Building model ${id} @ ${nation}/${tankKey}`); const parameters = await readYAMLDVPL(