Merge branch 'main' into data-driven

This commit is contained in:
tresabhi committed 2026-11-14 13:57:46 -06:00
commit da9c5272bc
7 files changed
+31 -30

No files matched your search

@@ -104,6 +104,7 @@ export abstract class ServerBlitzKitAPI0 extends AbstractBlitzKitAPI {
protected gameTypeSelectorStyles?: SquadBattleTypeStylesYaml;
protected combatRoles?: CombatRolesYaml;
protected tierEqualizer?: string[][];
protected version?: string;
constructor(vfs: AbstractVFS) {
super();
@@ -115,15 +116,11 @@ export abstract class ServerBlitzKitAPI0 extends AbstractBlitzKitAPI {
const { existsSync } = await import("fs");
const { readFile, writeFile, mkdir } = await import("fs/promises");
console.log("Initializing virtual file system...");
const path = await import("node:path");
this.extname = path.extname;
this.parsePath = path.parse;
await this.vfs.init();
console.log("Fetching game data...");
this.nationsDir = await this.vfs
.dir("Data/XML/item_defs/vehicles")
@@ -161,11 +158,13 @@ export abstract class ServerBlitzKitAPI0 extends AbstractBlitzKitAPI {
{ delimiter: ";" },
);
this.version = (await this.vfs.text("Data/version.txt")).split(" ")[0];
console.log("Fetching game localizations...");
await Promise.all(
locales.supported.map(async ({ locale }) => {
const root = "../../temp/game-strings";
const root = `../../temp/game-strings/${this.version}`;
const cachePath = `${root}/${locale}.json`;
if (existsSync(cachePath)) {
@@ -20,9 +20,7 @@ export abstract class ServerBlitzKitAPI9 extends ServerBlitzKitAPI8 {
provisionNativeNames[key] = provision.id;
});
const version = (await this.vfs.text("Data/version.txt")).split(" ")[0];
gameDefinitions.version = version;
gameDefinitions.version = this.version!;
gameDefinitions.nations = (
await this.vfs.yaml<AvailableNationsYaml>("Data/available_nations.yaml")
).available_nations;
+18
View File
@@ -0,0 +1,18 @@
import { assertSecret } from "@blitzkit/core";
import { AbstractVFS } from "./abstract";
import { LocalVFS } from "./local";
import { ZipVFS } from "./zip";
export async function createClientVFS() {
let vfs: AbstractVFS;
if (import.meta.env.CLIENT_PROVIDER === "zip") {
vfs = new ZipVFS(assertSecret(import.meta.env.CLIENT_SOURCE));
} else {
vfs = new LocalVFS(assertSecret(import.meta.env.CLIENT_DIR));
}
await vfs.init();
return vfs;
}