feat(battle): add Nuclear Escalation tactical and strategic nuclear carriers

Connect stage-unlocked nuclear carriers to Air Realistic sub-mode 103
(Nuclear Escalation) and expose a player toggle for stage-3 megaton
strategic bombers:

- Dataset & profile grants: extract tactical killstreak nuclear carriers
  (5 kt / 30 kt Nuclear Escalation presets) and megaton strategic bombers
  (nt_b_52h / nt_tu_95m) from wpcost.blk in battle-spawn-rules (v4), and
  grant their required weapon/modification records in
  support-plane-modifications.ts.
- Server slot selection & tuning: add nuclearEscalationStrategicBombers
  (default true) in tuning/battle.jsonc, battle-tuning.ts, and
  launcher-tuning.ts; add one nation-matched tactical carrier per session
  rank bracket (with allowedWeapons limited to its Nuclear Escalation
  presets) and, when enabled, one stage-3 strategic bomber to
  extraBattleSlots; include modeTag in battle launch notifications.
- GUI patch & launcher UI: add battle/filter-extra-slot-weapons on
  scripts/weaponry/weaponryinfo.nut to filter extra-slot presets by
  allowedWeapons (hiding Ground RB zero-yield presets at stage 0) and to
  fall back to LocalMP launch metadata for GameModeRestrictions; expose
  the strategic bomber toggle in the launcher Battle tuning section.

Verified with root and launcher typechecks, launcher build, full
check-gui on 2.61.0.37 and 2.61.0.58 (49 patches across 37 .nut files),
and slot selection check across all 10 nations on 2.61.0.58 stock data;
pending in-game verification.
This commit is contained in:
N0VAN0M4LY committed 2026-12-02 23:03:15 +08:00
1 parent f1ec034994
commit d0e4797fe7
19 files changed
+247 -15

No files matched your search

@@ -14,12 +14,14 @@
* char.vromfs.bin config/wpcost.blk
* ucav_*_killstreak{ country:t ... }
* The strike UCAVs, one per country.
* *_killstreak / nt_* with weapons.<preset>.totalNuclearYield:i
* Tactical (5 kt / 30 kt) and strategic (>= 1000 kt) nuclear carriers for Nuclear Escalation.
* char.vromfs.bin config/warpoints.blk respawn_points / TankHistorical
* Starting points and unit cost parameters for Ground Realistic Battles.
*/
import type { BlkBlock } from '@wto/blk';
import { findParam } from '@wto/blk';
import { blockAt, numberField, stringField, stringList } from './blk-fields.ts';
import { blockAt, boolField, numberField, stringField, stringList } from './blk-fields.ts';
import type { Dataset } from './dataset.ts';
export interface SupportPlaneUnit {
@@ -43,6 +45,18 @@ export interface StrikeUcav {
readonly unitName: string;
}
export interface NuclearCarrierWeapon {
readonly name: string;
readonly yieldKt: number;
}
export interface NuclearCarrierUnit {
readonly country: string;
readonly unitName: string;
readonly mrank: number;
readonly weapons: readonly NuclearCarrierWeapon[];
}
export interface RandomSpawnUnit {
readonly unitName: string;
readonly addModifications: readonly string[];
@@ -76,22 +90,31 @@ export interface BattleSpawnRulesData {
/** By event name (`missionSupportPlane` keys are game mode names). */
readonly supportPlanes: Readonly<Record<string, readonly SupportPlanePreset[]>>;
readonly strikeUcavs: readonly StrikeUcav[];
/** Killstreak nuclear carriers carrying 5 kt / 30 kt Nuclear Escalation presets. */
readonly nuclearEscalationTacticalCarriers: readonly NuclearCarrierUnit[];
/** Megaton-class strategic nuclear bombers (`nt_*` with totalNuclearYield >= 1000 kt). */
readonly nuclearEscalationStrategicBombers: readonly NuclearCarrierUnit[];
readonly spawnScore: SpawnScoreRules;
/** By event economic name, then country. */
readonly randomSpawnUnits: Readonly<Record<string, Readonly<Record<string, readonly RandomSpawnGroup[]>>>>;
}
const STRIKE_UCAV_PATTERN = /^ucav_.*_killstreak$/;
const KILLSTREAK_PATTERN = /_killstreak$/;
const STRATEGIC_BOMBER_PATTERN = /^nt_/;
const STRATEGIC_YIELD_MIN_KT = 1000;
export const battleSpawnRules: Dataset<BattleSpawnRulesData> = {
id: 'battle-spawn-rules',
version: 3,
version: 4,
extract: (source) => {
const gameplay = source.readBlk('aces.vromfs.bin', 'config/gameplay.blk');
const wpcost = source.readBlk('char.vromfs.bin', 'config/wpcost.blk');
return {
supportPlanes: extractSupportPlanes(blockAt(gameplay, 'missionSupportPlane')),
strikeUcavs: extractStrikeUcavs(wpcost.blocks),
nuclearEscalationTacticalCarriers: extractNuclearCarriers(wpcost.blocks, 'tactical'),
nuclearEscalationStrategicBombers: extractNuclearCarriers(wpcost.blocks, 'strategic'),
spawnScore: extractSpawnScore(blockAt(source.readBlk('char.vromfs.bin', 'config/warpoints.blk'), 'respawn_points')),
randomSpawnUnits: extractRandomSpawnUnits(blockAt(gameplay, 'RandomSpawnUnits')),
};
@@ -162,6 +185,38 @@ function extractStrikeUcavs(wpcostBlocks: readonly BlkBlock[]): StrikeUcav[] {
});
}
function extractNuclearCarriers(
wpcostBlocks: readonly BlkBlock[],
kind: 'tactical' | 'strategic',
): NuclearCarrierUnit[] {
const carriers: NuclearCarrierUnit[] = [];
for (const unitBlk of wpcostBlocks) {
const country = stringField(unitBlk, 'country') ?? '';
if (!country.startsWith('country_')) continue;
if (kind === 'tactical' && !KILLSTREAK_PATTERN.test(unitBlk.name)) continue;
if (kind === 'strategic' && !STRATEGIC_BOMBER_PATTERN.test(unitBlk.name)) continue;
const weaponsBlk = blockAt(unitBlk, 'weapons');
if (!weaponsBlk) continue;
const weapons: NuclearCarrierWeapon[] = [];
for (const weaponBlk of weaponsBlk.blocks) {
if (boolField(weaponBlk, 'isWeaponForCustomSlot') === true) continue;
if (boolField(weaponBlk, 'hideInGui') === true) continue;
if (weaponBlk.name.includes('without_countermeasures')) continue;
const yieldKt = numberField(weaponBlk, 'totalNuclearYield') ?? 0;
if (yieldKt <= 0) continue;
if (kind === 'tactical' && yieldKt >= STRATEGIC_YIELD_MIN_KT) continue;
if (kind === 'strategic' && yieldKt < STRATEGIC_YIELD_MIN_KT) continue;
weapons.push({ name: weaponBlk.name, yieldKt });
}
if (weapons.length === 0) continue;
weapons.sort((a, b) => a.yieldKt - b.yieldKt || a.name.localeCompare(b.name));
const mrank = numberField(unitBlk, 'economicRankHistorical') ?? numberField(unitBlk, 'economicRank') ?? 0;
carriers.push({ country, unitName: unitBlk.name, mrank, weapons });
}
carriers.sort((a, b) => a.country.localeCompare(b.country) || a.mrank - b.mrank || a.unitName.localeCompare(b.unitName));
return carriers;
}
function extractRandomSpawnUnits(
root: BlkBlock | undefined,
): Record<string, Record<string, RandomSpawnGroup[]>> {