feat(launcher): add Bot parameters tuning page for ground AI and lineup weights

Extend readLauncherTuning/writeLauncherTuning and launcher IPC schemas to read, validate, and atomically persist battle.botPoolLimitPerType and nested ground-ai.jsonc overrides (including mode, vehicle class lineupWeights, spawn loadout, and all advanced ground AI sections). Add a dedicated Bot parameters section under Tuning with collapsible groups, bilingual labels, cross-field validation, and per-section reset. Verified with root/launcher typecheck, electron-vite build, 904-key locale parity check, and temp-dir read/write/reset round-trip.
This commit is contained in:
N0VAN0M4LY committed 2026-12-04 03:22:50 +08:00
1 parent 37cbcd806f
commit 2d3287937f
13 files changed
+1432 -22

No files matched your search

+11 -6
View File
@@ -2,7 +2,13 @@
* Typed, range-validated reader for `tuning/ground-ai.jsonc`.
*/
import type { DiscoveredMod } from '@wto/mods';
import { GROUND_AI_MODES, type GroundAiConfig, type GroundAiMode } from '@wto/patcher';
import {
GROUND_AI_DRIVE_MODES,
GROUND_AI_MODES,
type GroundAiConfig,
type GroundAiDriveMode,
type GroundAiMode,
} from '@wto/patcher';
import type { TankLineupWeights } from '../battle/battle-ranks.ts';
import { tuningFiles } from './tuning-loader.ts';
import { TuningError, type TuningReader } from './tuning-reader.ts';
@@ -12,8 +18,6 @@ export interface GroundAiTuning extends GroundAiConfig {
readonly lineupWeights: TankLineupWeights;
}
const DRIVE_MODES = new Set(['vehicle_phys', 'movesys']);
export function loadGroundAiTuning(
dataFolder: string | null,
report: (line: string) => void,
@@ -170,9 +174,10 @@ function readTerrainSection(terrain: TuningReader): GroundAiTuning['terrain'] {
}
function readNavigationSection(nav: TuningReader): GroundAiTuning['navigation'] {
const driveMode = nav.string('driveMode');
if (!DRIVE_MODES.has(driveMode)) {
throw new TuningError(`tuning file ground-ai.jsonc: navigation.driveMode must be "vehicle_phys" or "movesys" (found "${driveMode}")`);
const driveModeRaw = nav.string('driveMode');
const driveMode = GROUND_AI_DRIVE_MODES.find((candidate): candidate is GroundAiDriveMode => candidate === driveModeRaw);
if (driveMode === undefined) {
throw new TuningError(`tuning file ground-ai.jsonc: navigation.driveMode must be "vehicle_phys" or "movesys" (found "${driveModeRaw}")`);
}
const steerSign = nav.number('steerSign', { min: -1, max: 1 });
if (steerSign !== 1 && steerSign !== -1) {