Add T6 Zombies fleet support with Plutainer configuration
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
||||
import { existsSync } from 'node:fs';
|
||||
import { dirname, join, posix } from 'node:path';
|
||||
import { betaArchiveOf, config, destOf, destOfKind, type ArtifactKind } from '../config.js';
|
||||
import { betaArchiveOf, configFileOf, destOfKind, type ArtifactKind } from '../config.js';
|
||||
import { db } from '../db/index.js';
|
||||
import { sha256Buffer } from './files.js';
|
||||
import { ensureDest, getServer, heldByBeta } from './servers.js';
|
||||
@@ -29,7 +29,7 @@ function isCollapsingKind(kind: ArtifactKind): boolean {
|
||||
|
||||
// The path we should write to for the composed cfg on this server.
|
||||
function composedCfgPath(server: string): string {
|
||||
return join(destOfKind(server, 'config'), config.configTargetFile);
|
||||
return join(destOfKind(server, 'config'), configFileOf(server));
|
||||
}
|
||||
|
||||
// Compose the effective dedicated_sp.cfg for a given beta+server, taking
|
||||
@@ -112,7 +112,7 @@ function composeCfgForServer(
|
||||
.filter(({ script }) => scopeAppliesToServer(script, { game: serverGame, map: serverMap }))
|
||||
.map(({ script, version }) => ({ id: script.id, text: version.content.toString('utf8') }));
|
||||
|
||||
const composed = composeServerCfg(baselineText, [...promotedOverlays, ...inBetaScopedOverlays], serverGame, serverMap);
|
||||
const composed = composeServerCfg(baselineText, [...promotedOverlays, ...inBetaScopedOverlays], serverGame, serverMap, getServer(serverName)?.map_slug);
|
||||
return { text: composed, baselineScriptId };
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ export async function openBeta(input: OpenBetaInput): Promise<OpenBetaResult> {
|
||||
}
|
||||
const dest = destOfKind(name, 'config');
|
||||
await mkdir(dest, { recursive: true });
|
||||
const targetRel = config.configTargetFile;
|
||||
const targetRel = configFileOf(name);
|
||||
const targetPath = join(dest, targetRel);
|
||||
if (existsSync(targetPath)) {
|
||||
const priorBytes = await readFile(targetPath);
|
||||
@@ -504,7 +504,7 @@ export async function openBeta(input: OpenBetaInput): Promise<OpenBetaResult> {
|
||||
`beta:${betaId}`
|
||||
);
|
||||
// Archive the composed preview for operator visibility.
|
||||
await writeFile(join(archive, `${name}.${config.configTargetFile}`), composedBuf);
|
||||
await writeFile(join(archive, `${name}.${configFileOf(name)}`), composedBuf);
|
||||
} catch (err) {
|
||||
firstErr = `configs: ${(err as Error).message}`;
|
||||
}
|
||||
@@ -603,7 +603,7 @@ export async function rollbackBeta(betaId: number): Promise<RollbackResult> {
|
||||
// Collapsing config layer: single restore for the shared cfg file.
|
||||
if (hasCollapsing) {
|
||||
const dest = destOfKind(bs.server, 'config');
|
||||
const targetRel = config.configTargetFile;
|
||||
const targetRel = configFileOf(bs.server);
|
||||
const targetPath = join(dest, targetRel);
|
||||
const snap = getSnapshot.get(betaId, bs.server, targetRel) as
|
||||
| { prior_content: Buffer; prior_sha256: string; prior_size: number }
|
||||
@@ -828,7 +828,7 @@ export async function promoteBeta(betaId: number): Promise<PromoteResult> {
|
||||
const composedBuf = Buffer.from(composedResult.text, 'utf8');
|
||||
const composedSha = sha256Buffer(composedBuf);
|
||||
const dest = destOfKind(name, 'config');
|
||||
const targetRel = config.configTargetFile;
|
||||
const targetRel = configFileOf(name);
|
||||
const targetPath = join(dest, targetRel);
|
||||
|
||||
let priorContent: Buffer | null = null;
|
||||
@@ -862,7 +862,7 @@ export async function promoteBeta(betaId: number): Promise<PromoteResult> {
|
||||
try {
|
||||
const dest = destOfKind(cp.server, 'config');
|
||||
await mkdir(dest, { recursive: true });
|
||||
const targetRel = config.configTargetFile;
|
||||
const targetRel = configFileOf(cp.server);
|
||||
const targetPath = join(dest, targetRel);
|
||||
// Beta server already has composed content at targetPath; overwrite
|
||||
// idempotently. Scope-expansion server: write in place.
|
||||
@@ -942,7 +942,7 @@ export async function promoteBeta(betaId: number): Promise<PromoteResult> {
|
||||
depId,
|
||||
cp.server,
|
||||
verb,
|
||||
config.configTargetFile,
|
||||
configFileOf(cp.server),
|
||||
cp.priorSha,
|
||||
cp.composedSha,
|
||||
cp.priorContent,
|
||||
@@ -950,7 +950,7 @@ export async function promoteBeta(betaId: number): Promise<PromoteResult> {
|
||||
);
|
||||
recordScript(
|
||||
cp.server,
|
||||
config.configTargetFile,
|
||||
configFileOf(cp.server),
|
||||
null,
|
||||
cp.composedSha,
|
||||
cp.composedContent.byteLength,
|
||||
|
||||
Reference in New Issue
Block a user