feat(battle): wire Nuclear Escalation launch and airfield cooldowns

Connect Air Realistic sub-mode 103 (Nuclear Escalation) mission launch
settings and LocalMP respawn/airfield-cooldown handling:

- Server: support mode-level maxRespawns (UNLIMITED_RESPAWNS = -2) and
  per-mode missionRuleKeys so Nuclear Escalation forwards customHUD,
  stage thresholds, useSpawnDelay, afterRespawnDelaySec, and battle
  display flags from the stock missions; reject queues when no candidate
  mode is eligible for the lineup; disable spares and emit
  wtoUnlimitedRespawns for unlimited-respawn modes.
- Native: keep slots usable when wtoUnlimitedRespawns is set and emit
  wtoLocalMpAirfieldSpawn with the unit name and spawn base ID when the
  local player actually enters pilot control.
- GUI patches: track confirmed LocalMP airfield departures in
  scripts/respawn/respawnbases.nut and feed the computed per-base delays
  into scripts/respawn/respawn.nut slot countdowns and spawn checks.

Stage-unlocked dedicated event aircraft allocation by faction and room
BR is not yet wired and remains pending research. Verified with root and
launcher typechecks, check-patches and check-gui on 2.61.0.37 and
2.61.0.58, and native wto_ws.dll build; pending in-game verification.
This commit is contained in:
N0VAN0M4LY committed 2026-12-02 21:35:17 +08:00
1 parent 646be7afb9
commit f1ec034994
24 files changed
+240 -24

No files matched your search

@@ -50,6 +50,10 @@ export interface GameModeDeclaration {
* `true`; `false` for single-slot modes (`air_realistic` and its `small_teams_` sub-mode).
*/
readonly multiSlot?: boolean;
/** Stock maxRespawns value when this mode specifies its own respawn count. */
readonly maxRespawns?: number;
/** Additional scalar settings the local host needs from this mode's missions. */
readonly missionRuleKeys?: readonly string[];
/** False for modes whose native weapon rules replace combat presets. Defaults to true. */
readonly allowBotAircraftLoadouts?: boolean;
/** Minimum `mrank` exposed on the parent mode for Night Battles (`scripts/events/eventinfo.nut:134-136`). */
@@ -11,6 +11,7 @@
* AB/RB get Enduring Confrontation; Ground AB and Air AB get none);
* - `queueEvent.nut` includes or excludes its `gameModeId` in `match.enqueue` `game_modes_list`.
*/
import { UNLIMITED_RESPAWNS } from '../mode-definition.ts';
import type { GameModeDeclaration } from './game-mode-declaration.ts';
import {
AIR_REALISTIC_MISSIONS,
@@ -69,6 +70,15 @@ export const SUB_GAME_MODES: readonly GameModeDeclaration[] = [
displayType: 'random_battle',
allowedCraftMinMrank: { aircraft: MIN_MRANK_NUCLEAR_ESCALATION },
minQueueMrank: MIN_MRANK_NUCLEAR_ESCALATION,
maxRespawns: UNLIMITED_RESPAWNS,
// mission_settings.mission in mis.vromfs.bin gamedata/missions/cta/planes/nuclear_escalation/.
missionRuleKeys: [
'customHUD', 'nuclearEscalationStage1', 'nuclearEscalationStage2', 'nuclearEscalationStage3',
'useSpawnDelay', 'afterRespawnDelaySec', 'overrideMaxActiveUnitsWeight', 'scheduleBasedGmUpdateMaxInterval',
'disableFallingTrees', 'alwaysSendAllyGMData', 'isAlwaysShowCollectiveDetectedUnits', 'useAIForCollectiveDetection',
'allowToChooseHUDIconPreset', 'showAIKilllog', 'showUnitTooltipOnMap', 'disableMfdForPrevgenConsoles',
'clientReplayMaxSizeMb', 'timeToLoseInstantDetection', 'showTacticalMapCellSize',
],
requiredClass: 'aircraft',
allowedClasses: ['aircraft'],
missions: NUCLEAR_ESCALATION_MISSIONS,
@@ -41,8 +41,13 @@ export const MISSION_DIFFICULTY: Readonly<Record<ModeDifficulty, string>> = {
simulator: 'hardcore',
};
// globals/missions/respawnCountModes.nut: RESPAWN_COUNT_MODE.SINGLE_SPAWN.
// globals/missions/respawnCountModes.nut: RESPAWN_COUNT_MODE.
export const SINGLE_SPAWN = 1;
export const UNLIMITED_RESPAWNS = -2;
export function modeMaxRespawns(mode: GameModeDeclaration): number | undefined {
return mode.maxRespawns ?? (mode.multiSlot === false ? SINGLE_SPAWN : undefined);
}
export type ModeDefinition = Readonly<Record<string, unknown>>;
@@ -50,6 +55,7 @@ export function buildModeDefinition(mode: GameModeDeclaration, missions: readonl
countries: readonly string[], missionRanks?: MissionRotationRanks): ModeDefinition {
const minTeamSize = mode.teamSizeOverride?.min ?? 1;
const maxTeamSize = mode.teamSizeOverride?.max ?? teamSize(mode, missions);
const maxRespawns = modeMaxRespawns(mode);
const team = {
countries: [...countries],
allowedCrafts: mode.allowedClasses.map((unitClass) => {
@@ -83,7 +89,7 @@ export function buildModeDefinition(mode: GameModeDeclaration, missions: readonl
teamB: structuredClone(team),
mission_decl: {
difficulty: MISSION_DIFFICULTY[mode.difficulty],
...(mode.multiSlot === false ? { maxRespawns: SINGLE_SPAWN } : {}),
...(maxRespawns === undefined ? {} : { maxRespawns }),
missions_list: Object.fromEntries(missions.map((mission) => {
const ranges = missionRanks?.byMission.get(mission.name);
return [mission.name, ranges?.length === 1 ? { enableIf: ranges[0] } : {}];