mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: code split build assets
This commit is contained in:
1 parent
5a25f335cd
commit
1f39ecefe4
11 files changed
+492
-375
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { readdir } from 'fs/promises';
|
||||
import { DATA, DOI } from '.';
|
||||
import { NATION_IDS } from '../../src/constants/nations';
|
||||
import { extractModel } from '../../src/core/blitz/extractModel';
|
||||
import { readXMLDVPL } from '../../src/core/blitz/readXMLDVPL';
|
||||
import { VehicleDefinitionList } from './definitions';
|
||||
|
||||
export async function buildTankArmors() {
|
||||
console.log('Building tank armors...');
|
||||
|
||||
const nations = await readdir(`${DATA}/${DOI.vehicleDefinitions}`).then(
|
||||
(nations) => nations.filter((nation) => nation !== 'common'),
|
||||
);
|
||||
|
||||
await Promise.all(
|
||||
nations.map(async (nation) => {
|
||||
const tanks = await readXMLDVPL<{ root: VehicleDefinitionList }>(
|
||||
`${DATA}/${DOI.vehicleDefinitions}/${nation}/list.xml.dvpl`,
|
||||
);
|
||||
|
||||
for (const tankKey in tanks.root) {
|
||||
const tank = tanks.root[tankKey];
|
||||
const nationVehicleId = tank.id;
|
||||
const id = (nationVehicleId << 8) + (NATION_IDS[nation] << 4) + 1;
|
||||
|
||||
if (id !== 24609) continue; // concept 1b
|
||||
|
||||
const model = extractModel(
|
||||
DATA,
|
||||
`${DOI.collisionMeshes}/${nation}-${tankKey}`,
|
||||
);
|
||||
|
||||
console.log(`Building armor ${id} @ ${nation}/${tankKey}`);
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user