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;
}
+2 -3
View File
@@ -3,7 +3,6 @@ import { mkdir, rm } from "node:fs/promises";
import { downloadSteamClient } from "./steam";
import { downloadWGCClient } from "./wgc";
import { downloadWGPKGClient } from "./wgpkg";
import { downloadZipClient } from "./zip";
export const DEPOT_DOWNLOADER_RETRY_TIME = 30_000;
@@ -20,9 +19,9 @@ switch (provider) {
await downloadSteamClient();
break;
// from zip, usually has a root directory for opentest
// from zip, read remotely by ZipVFS at build time; nothing to download
case "zip":
await downloadZipClient();
console.log("Zip client provider; skipping download in favor of ZipVFS");
break;
// effectively the same as wgc, but direct for preview
+2 -5
View File
@@ -1,6 +1,3 @@
import { assertSecret } from "@blitzkit/core";
import { LocalVFS } from "@blitzkit/core/src/blitzkit/vfs/local";
import { createClientVFS } from "@blitzkit/core/src/blitzkit/vfs/client";
export const vfs = await new LocalVFS(
assertSecret(import.meta.env.CLIENT_DIR),
).init();
export const vfs = await createClientVFS();
+2 -3
View File
@@ -1,4 +1,3 @@
import { assertSecret } from "@blitzkit/core";
import { LocalVFS } from "@blitzkit/core/src/blitzkit/vfs/local";
import { createClientVFS } from "@blitzkit/core/src/blitzkit/vfs/client";
export const vfs = new LocalVFS(assertSecret(import.meta.env.CLIENT_DIR));
export const vfs = await createClientVFS();