From d0e4797fe7d54a853988eca77251a90c0e7a8fe6 Mon Sep 17 00:00:00 2001 From: N0VAN0M4LY <224130499+N0VAN0M4LY@users.noreply.github.com> Date: Wed, 2 Dec 2026 23:03:15 +0800 Subject: [PATCH] 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. --- .../src/renderer/src/i18n/locales/en.json | 1 + .../src/renderer/src/i18n/locales/zh-CN.json | 1 + .../renderer/src/pages/tuning/TuningPage.tsx | 4 +- apps/launcher/src/shared/schemas/tuning.ts | 1 + apps/server/src/battle/battle-extra-slots.ts | 75 ++++++++++++++++++- apps/server/src/battle/battle-matchmaker.ts | 3 + apps/server/src/battle/battle-tuning.ts | 2 + .../game-data/datasets/battle-spawn-rules.ts | 59 ++++++++++++++- .../src/matching/battle-launch-notify.ts | 1 + .../support-plane-modifications.ts | 34 ++++++--- apps/server/src/tuning/launcher-tuning.ts | 2 + apps/server/tuning/battle.jsonc | 7 +- .../find-allowed-modes.nut | 5 ++ .../find-min-rank.nut | 4 + .../find-visible.nut | 3 + .../filter-extra-slot-weapons/patch.jsonc | 23 ++++++ .../replace-allowed-modes.nut | 10 +++ .../replace-min-rank.nut | 9 +++ .../replace-visible.nut | 18 +++++ 19 files changed, 247 insertions(+), 15 deletions(-) create mode 100644 patches/gui/battle/filter-extra-slot-weapons/find-allowed-modes.nut create mode 100644 patches/gui/battle/filter-extra-slot-weapons/find-min-rank.nut create mode 100644 patches/gui/battle/filter-extra-slot-weapons/find-visible.nut create mode 100644 patches/gui/battle/filter-extra-slot-weapons/patch.jsonc create mode 100644 patches/gui/battle/filter-extra-slot-weapons/replace-allowed-modes.nut create mode 100644 patches/gui/battle/filter-extra-slot-weapons/replace-min-rank.nut create mode 100644 patches/gui/battle/filter-extra-slot-weapons/replace-visible.nut diff --git a/apps/launcher/src/renderer/src/i18n/locales/en.json b/apps/launcher/src/renderer/src/i18n/locales/en.json index af4fe17..54bb065 100644 --- a/apps/launcher/src/renderer/src/i18n/locales/en.json +++ b/apps/launcher/src/renderer/src/i18n/locales/en.json @@ -463,6 +463,7 @@ "tankBotRespawns": "AI tank respawns", "airBotRespawns": "AI aircraft respawns", "strikeUcavSpawnScore": "Strike UCAV spawn points", + "nuclearEscalationStrategicBombers": "Nuclear Escalation stage-3 strategic bombers (B-52H / Tu-95M)", "silverLions": "Starting Silver Lions", "goldenEagles": "Starting Golden Eagles", "preferLineSuccessor": "Prefer the next vehicle in the line", diff --git a/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json b/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json index 40e6b22..5d947f5 100644 --- a/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json +++ b/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json @@ -463,6 +463,7 @@ "tankBotRespawns": "AI 坦克重生次数", "airBotRespawns": "AI 飞机重生次数", "strikeUcavSpawnScore": "打击无人机所需出生点数", + "nuclearEscalationStrategicBombers": "核战冲突启用第 3 阶段战略核轰炸机(B-52H / Tu-95M)", "silverLions": "初始银狮", "goldenEagles": "初始金鹰", "preferLineSuccessor": "优先研发同系载具", diff --git a/apps/launcher/src/renderer/src/pages/tuning/TuningPage.tsx b/apps/launcher/src/renderer/src/pages/tuning/TuningPage.tsx index ef8e505..aa32d0e 100644 --- a/apps/launcher/src/renderer/src/pages/tuning/TuningPage.tsx +++ b/apps/launcher/src/renderer/src/pages/tuning/TuningPage.tsx @@ -11,7 +11,7 @@ type Field = keyof TuningValues; type Draft = Partial>; const fields = { rewards: ['rewardMultiplierSilverLions', 'rewardMultiplierResearchPoints', 'friendlyKillPenaltyMul'], - battle: ['maxPlayers', 'smallTeamsMaxPlayers', 'brSpreadMrank', 'subModeChance', 'tankBotRespawns', 'airBotRespawns', 'strikeUcavSpawnScore'], + battle: ['maxPlayers', 'smallTeamsMaxPlayers', 'brSpreadMrank', 'subModeChance', 'tankBotRespawns', 'airBotRespawns', 'strikeUcavSpawnScore', 'nuclearEscalationStrategicBombers'], newProfile: ['silverLions', 'goldenEagles'], research: ['preferLineSuccessor', 'autoTargetPick'], } as const satisfies Record; @@ -70,7 +70,7 @@ export function TuningPage({ copy, section, onError }: Props) { const editor = (field: Field): ReactNode => { const active = draft[field] ?? inputValue(field, loaded.effective[field]); const label = t(`tuning.fields.${field}`); - if (field === 'preferLineSuccessor') { + if (typeof loaded.defaults[field] === 'boolean') { return set(field, event.target.checked)} />; } if (field === 'autoTargetPick') { diff --git a/apps/launcher/src/shared/schemas/tuning.ts b/apps/launcher/src/shared/schemas/tuning.ts index 50b5b8c..6eb1ad4 100644 --- a/apps/launcher/src/shared/schemas/tuning.ts +++ b/apps/launcher/src/shared/schemas/tuning.ts @@ -12,6 +12,7 @@ export const TuningValuesSchema = z.object({ tankBotRespawns: z.number().int().min(1).max(10), airBotRespawns: z.number().int().min(1).max(10), strikeUcavSpawnScore: z.number().int().min(1).max(10000), + nuclearEscalationStrategicBombers: z.boolean(), silverLions: z.number().int().nonnegative(), goldenEagles: z.number().int().min(0).max(0x7fffffff), preferLineSuccessor: z.boolean(), diff --git a/apps/server/src/battle/battle-extra-slots.ts b/apps/server/src/battle/battle-extra-slots.ts index 6f0451f..9d6243a 100644 --- a/apps/server/src/battle/battle-extra-slots.ts +++ b/apps/server/src/battle/battle-extra-slots.ts @@ -22,6 +22,7 @@ import { randomInt } from 'node:crypto'; import type { BattleSpawnRulesData, + NuclearCarrierUnit, RandomSpawnGroup, RandomSpawnUnit, SupportPlanePreset, @@ -43,6 +44,8 @@ export interface ExtraBattleSlot { /** The modifications enabled when not `allModifications`; the unit is otherwise stock. */ readonly modifications: readonly string[]; readonly forceWeapon?: string; + /** Restricts the respawn weapon dropdown to these presets when multiple mode presets exist. */ + readonly allowedWeapons?: readonly string[]; /** The RandomSpawnUnits group the vehicle was drawn from. */ readonly groupName?: string; } @@ -56,7 +59,10 @@ export interface ExtraBattleSlotsInput { readonly sessionMaxMrank: number; readonly vehiclesByName: ReadonlyMap; readonly rules: BattleSpawnRulesData; - readonly tuning: Pick; + readonly tuning: Pick< + BattleTuning, + 'strikeUcavModes' | 'strikeUcavSessionMrankAllowance' | 'strikeUcavSpawnScore' | 'nuclearEscalationStrategicBombers' + >; } export function selectExtraBattleSlots(input: ExtraBattleSlotsInput): readonly ExtraBattleSlot[] { @@ -68,6 +74,7 @@ export function selectExtraBattleSlots(input: ExtraBattleSlotsInput): readonly E if (supportPlane) supportSlots.push(supportPlane); const ucav = strikeUcavSlot(input); if (ucav) supportSlots.push(ucav); + supportSlots.push(...nuclearEscalationSlots(input)); // Keep room for fixed support vehicles while displaying random vehicle groups first. const slots: ExtraBattleSlot[] = []; @@ -118,6 +125,72 @@ function strikeUcavSlot(input: ExtraBattleSlotsInput): ExtraBattleSlot | undefin }; } +const NUCLEAR_ESCALATION_TAG_PREFIX = 'nuclear_escalation_'; +const GROUND_RB_SUPPORT_MODE = 'tank_event_in_random_battles_historical'; +const EASTERN_STRATEGIC_BOMBER_COUNTRIES = new Set(['country_ussr', 'country_china']); + +function nuclearEscalationSlots(input: ExtraBattleSlotsInput): ExtraBattleSlot[] { + if (!input.declaration.tag?.startsWith(NUCLEAR_ESCALATION_TAG_PREFIX)) return []; + const slots: ExtraBattleSlot[] = []; + const tactical = selectTacticalNuclearCarrier(input); + if (tactical) { + const weaponNames = tactical.weapons.map((weapon) => weapon.name); + slots.push({ + unitName: tactical.unitName, + allModifications: true, + modifications: [], + ...(weaponNames.length === 1 ? { forceWeapon: weaponNames[0]! } : { allowedWeapons: weaponNames }), + }); + } + if (input.tuning.nuclearEscalationStrategicBombers) { + const strategic = selectStrategicNuclearBomber(input.country, input.rules.nuclearEscalationStrategicBombers); + if (strategic) { + const weapon = strategic.weapons[0]; + slots.push({ + unitName: strategic.unitName, + allModifications: true, + modifications: [], + ...(weapon ? { forceWeapon: weapon.name } : {}), + }); + } + } + return slots; +} + +function selectTacticalNuclearCarrier(input: ExtraBattleSlotsInput): NuclearCarrierUnit | undefined { + const byCountry = input.rules.nuclearEscalationTacticalCarriers.filter((entry) => entry.country === input.country); + if (byCountry.length === 0) return undefined; + + // Prefer the stock Ground RB nuclear carrier for the matching rank bracket when it carries + // Nuclear Escalation 5 kt / 30 kt presets; otherwise pick the country's closest-mrank carrier. + const groundPresets = input.rules.supportPlanes[GROUND_RB_SUPPORT_MODE] ?? []; + const bracket = groundPresets.find((p) => input.sessionMaxMrank >= p.minMrank && input.sessionMaxMrank <= p.maxMrank); + const preferredUnit = bracket?.units[input.country]?.unitName; + if (preferredUnit) { + const matched = byCountry.find((entry) => entry.unitName === preferredUnit); + if (matched) return matched; + } + + return [...byCountry].sort((a, b) => { + const distA = Math.abs(a.mrank - input.sessionMaxMrank); + const distB = Math.abs(b.mrank - input.sessionMaxMrank); + if (distA !== distB) return distA - distB; + const underA = a.mrank <= input.sessionMaxMrank ? 0 : 1; + const underB = b.mrank <= input.sessionMaxMrank ? 0 : 1; + if (underA !== underB) return underA - underB; + return a.mrank - b.mrank || a.unitName.localeCompare(b.unitName); + })[0]; +} + +function selectStrategicNuclearBomber( + country: string, + bombers: readonly NuclearCarrierUnit[], +): NuclearCarrierUnit | undefined { + if (bombers.length === 0) return undefined; + const preferredCountry = EASTERN_STRATEGIC_BOMBER_COUNTRIES.has(country) ? 'country_ussr' : 'country_usa'; + return bombers.find((entry) => entry.country === preferredCountry) ?? bombers[0]; +} + /** * The options of one random group: the group's vehicles inside `randomWindow`, or, when none fits, * those of the highest rank below it. Vehicles already in the lineup are left out (offline diff --git a/apps/server/src/battle/battle-matchmaker.ts b/apps/server/src/battle/battle-matchmaker.ts index 20a9b01..aa2293e 100644 --- a/apps/server/src/battle/battle-matchmaker.ts +++ b/apps/server/src/battle/battle-matchmaker.ts @@ -47,6 +47,7 @@ export interface BattleLaunchPlan { readonly sessionId: string; readonly modeId: number; readonly modeName: string; + readonly modeTag?: string; readonly economicName: string; readonly missionName: string; /** The mission as the game describes it, including the parameters copied into the mission settings. */ @@ -198,6 +199,7 @@ export class BattleMatchmaker { userId: input.userId, modeId: declaration.gameModeId, modeName: declaration.name, + ...(declaration.tag !== undefined ? { modeTag: declaration.tag } : {}), economicName: declaration.economicName, difficulty: declaration.difficulty, requiredClass: declaration.requiredClass, @@ -224,6 +226,7 @@ export class BattleMatchmaker { sessionId: session.sessionId, modeId: declaration.gameModeId, modeName: declaration.name, + ...(declaration.tag !== undefined ? { modeTag: declaration.tag } : {}), economicName: declaration.economicName, missionName: mission.name, mission, diff --git a/apps/server/src/battle/battle-tuning.ts b/apps/server/src/battle/battle-tuning.ts index 6bd8c0e..257e400 100644 --- a/apps/server/src/battle/battle-tuning.ts +++ b/apps/server/src/battle/battle-tuning.ts @@ -26,6 +26,7 @@ export interface BattleTuning { readonly strikeUcavSpawnScore: number; readonly tankBotRespawns: number; readonly airBotRespawns: number; + readonly nuclearEscalationStrategicBombers: boolean; } export function readBattleTuning(reader: TuningReader): BattleTuning { @@ -66,5 +67,6 @@ export function readBattleTuning(reader: TuningReader): BattleTuning { strikeUcavSpawnScore: reader.int('strikeUcavSpawnScore', { min: 1, max: 10000 }), tankBotRespawns: reader.int('tankBotRespawns', { min: 1, max: 10 }), airBotRespawns: reader.int('airBotRespawns', { min: 1, max: 10 }), + nuclearEscalationStrategicBombers: reader.bool('nuclearEscalationStrategicBombers'), }; } diff --git a/apps/server/src/game-data/datasets/battle-spawn-rules.ts b/apps/server/src/game-data/datasets/battle-spawn-rules.ts index 6d4f830..8d639ab 100644 --- a/apps/server/src/game-data/datasets/battle-spawn-rules.ts +++ b/apps/server/src/game-data/datasets/battle-spawn-rules.ts @@ -14,12 +14,14 @@ * char.vromfs.bin config/wpcost.blk * ucav_*_killstreak{ country:t ... } * The strike UCAVs, one per country. + * *_killstreak / nt_* with weapons..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>; 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>>>; } 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 = { 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> { diff --git a/apps/server/src/matching/battle-launch-notify.ts b/apps/server/src/matching/battle-launch-notify.ts index 35bfeae..ba56f96 100644 --- a/apps/server/src/matching/battle-launch-notify.ts +++ b/apps/server/src/matching/battle-launch-notify.ts @@ -57,6 +57,7 @@ export function battleLaunchNotify( battle: { sessionId: plan.sessionId, modeName: plan.modeName, + ...(plan.modeTag ? { modeTag: plan.modeTag } : {}), economicName: plan.economicName, country: plan.country, missionName: plan.missionName, diff --git a/apps/server/src/modifications/support-plane-modifications.ts b/apps/server/src/modifications/support-plane-modifications.ts index 2834519..45b486e 100644 --- a/apps/server/src/modifications/support-plane-modifications.ts +++ b/apps/server/src/modifications/support-plane-modifications.ts @@ -31,7 +31,10 @@ export interface SupportUnitEquipmentGrants { } export function supportPlaneModifications( - rules: Pick, + rules: Pick< + BattleSpawnRulesData, + 'supportPlanes' | 'strikeUcavs' | 'nuclearEscalationTacticalCarriers' | 'nuclearEscalationStrategicBombers' + >, catalogue: EquipmentCatalogue, ): SupportUnitEquipmentGrants { const seenMods = new Set(); @@ -53,21 +56,34 @@ export function supportPlaneModifications( weapons.push({ vehicle, weapon, count: Math.max(1, count) }); }; + const grantWeaponPreset = (unitName: string, weapon: string): void => { + const facts = catalogue.weapon(unitName, weapon); + addWeapon(unitName, weapon, facts?.maxCount ?? 1); + for (const modification of facts?.requires ?? []) addMod(unitName, modification); + for (const container of facts?.sumWeapons ?? []) { + const containerFacts = catalogue.weapon(unitName, container); + addWeapon(unitName, container, containerFacts?.maxCount ?? 1); + for (const modification of containerFacts?.requires ?? []) addMod(unitName, modification); + } + }; + for (const presets of Object.values(rules.supportPlanes)) { for (const preset of presets) { for (const { unitName, weapon } of Object.values(preset.units)) { - const facts = catalogue.weapon(unitName, weapon); - addWeapon(unitName, weapon, facts?.maxCount ?? 1); - for (const modification of facts?.requires ?? []) addMod(unitName, modification); - for (const container of facts?.sumWeapons ?? []) { - const containerFacts = catalogue.weapon(unitName, container); - addWeapon(unitName, container, containerFacts?.maxCount ?? 1); - for (const modification of containerFacts?.requires ?? []) addMod(unitName, modification); - } + grantWeaponPreset(unitName, weapon); } } } + for (const carrier of [ + ...rules.nuclearEscalationTacticalCarriers, + ...rules.nuclearEscalationStrategicBombers, + ]) { + for (const weapon of carrier.weapons) { + grantWeaponPreset(carrier.unitName, weapon.name); + } + } + for (const ucav of rules.strikeUcavs) { const vehicle = catalogue.vehicle(ucav.unitName); if (!vehicle) continue; diff --git a/apps/server/src/tuning/launcher-tuning.ts b/apps/server/src/tuning/launcher-tuning.ts index 69c0d45..b8ff816 100644 --- a/apps/server/src/tuning/launcher-tuning.ts +++ b/apps/server/src/tuning/launcher-tuning.ts @@ -25,6 +25,7 @@ function values(files: TuningFiles) { tankBotRespawns: battle.tankBotRespawns, airBotRespawns: battle.airBotRespawns, strikeUcavSpawnScore: battle.strikeUcavSpawnScore, + nuclearEscalationStrategicBombers: battle.nuclearEscalationStrategicBombers, silverLions: newProfile.silverLions, goldenEagles: newProfile.goldenEagles, preferLineSuccessor: research.preferLineSuccessor, @@ -46,6 +47,7 @@ const fileOf = { tankBotRespawns: 'battle', airBotRespawns: 'battle', strikeUcavSpawnScore: 'battle', + nuclearEscalationStrategicBombers: 'battle', silverLions: 'new-profile', goldenEagles: 'new-profile', preferLineSuccessor: 'research', diff --git a/apps/server/tuning/battle.jsonc b/apps/server/tuning/battle.jsonc index feff637..bdbcd59 100644 --- a/apps/server/tuning/battle.jsonc +++ b/apps/server/tuning/battle.jsonc @@ -47,5 +47,10 @@ // AI bot respawn limits per battle in multi-slot versus modes. "tankBotRespawns": 3, - "airBotRespawns": 2 + "airBotRespawns": 2, + + // Offer a stage-3 megaton strategic bomber (B-52H / Tu-95M) alongside the tactical nuclear + // carrier in Air RB Nuclear Escalation (sub-mode 103). Disable to use tactical 5 kt / 30 kt + // carriers only, matching the regular live rotation. + "nuclearEscalationStrategicBombers": true } diff --git a/patches/gui/battle/filter-extra-slot-weapons/find-allowed-modes.nut b/patches/gui/battle/filter-extra-slot-weapons/find-allowed-modes.nut new file mode 100644 index 0000000..5146792 --- /dev/null +++ b/patches/gui/battle/filter-extra-slot-weapons/find-allowed-modes.nut @@ -0,0 +1,5 @@ + let missionState = get_mission_custom_state(false) + let economicName = missionState?.matchingEconomicName ?? "" + let tag = missionState?.matchingTag ?? "" + if (economicName == "" && tag == "") + return false diff --git a/patches/gui/battle/filter-extra-slot-weapons/find-min-rank.nut b/patches/gui/battle/filter-extra-slot-weapons/find-min-rank.nut new file mode 100644 index 0000000..dcc2258 --- /dev/null +++ b/patches/gui/battle/filter-extra-slot-weapons/find-min-rank.nut @@ -0,0 +1,4 @@ + let missionState = get_mission_custom_state(false) + let economicName = missionState?.matchingEconomicName ?? "" + let tag = missionState?.matchingTag ?? "" + local minRank = 0 diff --git a/patches/gui/battle/filter-extra-slot-weapons/find-visible.nut b/patches/gui/battle/filter-extra-slot-weapons/find-visible.nut new file mode 100644 index 0000000..8814217 --- /dev/null +++ b/patches/gui/battle/filter-extra-slot-weapons/find-visible.nut @@ -0,0 +1,3 @@ +function isWeaponVisible(unit, weapon, onlySelectable = true, weaponTags = null) { + if (weapon?.hideInGui || isWeaponAux(weapon)) + return false diff --git a/patches/gui/battle/filter-extra-slot-weapons/patch.jsonc b/patches/gui/battle/filter-extra-slot-weapons/patch.jsonc new file mode 100644 index 0000000..fb96b54 --- /dev/null +++ b/patches/gui/battle/filter-extra-slot-weapons/patch.jsonc @@ -0,0 +1,23 @@ +// Restrict extra LocalMP battle slots to the weapon presets chosen for the active mode, +// and fall back to LocalMP launch metadata for GameModeRestrictions when mission custom state is empty. +// Why the client: online the battle server filters slot presets and fills mission custom state; +// on a LocalMP host, killstreak nuclear carriers carry both Ground RB and Nuclear Escalation presets. +// Without it: Nuclear Escalation carriers expose Ground RB presets with zero nuclear yield at stage 0. +{ + "id": "battle/filter-extra-slot-weapons", + "title": "Filter weapon presets of LocalMP extra battle slots and mode restrictions", + "features": [ + "K-Additional vehicles" + ], + "variants": [ + { + "written_for": "2.61.0.37", + "file": "scripts/weaponry/weaponryinfo.nut", + "edits": [ + { "find": "find-visible.nut", "replace": "replace-visible.nut" }, + { "find": "find-min-rank.nut", "replace": "replace-min-rank.nut" }, + { "find": "find-allowed-modes.nut", "replace": "replace-allowed-modes.nut" } + ] + } + ] +} diff --git a/patches/gui/battle/filter-extra-slot-weapons/replace-allowed-modes.nut b/patches/gui/battle/filter-extra-slot-weapons/replace-allowed-modes.nut new file mode 100644 index 0000000..d7257f4 --- /dev/null +++ b/patches/gui/battle/filter-extra-slot-weapons/replace-allowed-modes.nut @@ -0,0 +1,10 @@ + let missionState = get_mission_custom_state(false) + let wtoBattle = require("nestdb").ndbTryRead(["wto", "activeBattle"]) + let economicName = (missionState?.matchingEconomicName ?? "") != "" + ? missionState.matchingEconomicName + : (wtoBattle?.economicName ?? "") + let tag = (missionState?.matchingTag ?? "") != "" + ? missionState.matchingTag + : (wtoBattle?.modeTag ?? "") + if (economicName == "" && tag == "") + return false diff --git a/patches/gui/battle/filter-extra-slot-weapons/replace-min-rank.nut b/patches/gui/battle/filter-extra-slot-weapons/replace-min-rank.nut new file mode 100644 index 0000000..51a8144 --- /dev/null +++ b/patches/gui/battle/filter-extra-slot-weapons/replace-min-rank.nut @@ -0,0 +1,9 @@ + let missionState = get_mission_custom_state(false) + let wtoBattle = require("nestdb").ndbTryRead(["wto", "activeBattle"]) + let economicName = (missionState?.matchingEconomicName ?? "") != "" + ? missionState.matchingEconomicName + : (wtoBattle?.economicName ?? "") + let tag = (missionState?.matchingTag ?? "") != "" + ? missionState.matchingTag + : (wtoBattle?.modeTag ?? "") + local minRank = 0 diff --git a/patches/gui/battle/filter-extra-slot-weapons/replace-visible.nut b/patches/gui/battle/filter-extra-slot-weapons/replace-visible.nut new file mode 100644 index 0000000..4a22fe0 --- /dev/null +++ b/patches/gui/battle/filter-extra-slot-weapons/replace-visible.nut @@ -0,0 +1,18 @@ +function isWeaponVisible(unit, weapon, onlySelectable = true, weaponTags = null) { + if (weapon?.hideInGui || isWeaponAux(weapon)) + return false + + // WTOffline: restrict extra battle slots (e.g. Nuclear Escalation carriers) to their mode presets. + if (isInFlight() && unit != null && weapon != null) { + let wtoExtraSlots = require("nestdb").ndbTryRead(["wto", "activeBattle"])?.extraBattleSlots + if (wtoExtraSlots != null) { + foreach (wtoSlot in wtoExtraSlots) { + let wtoAllowed = wtoSlot?.allowedWeapons + if (wtoSlot?.unitName == unit.name && wtoAllowed != null && wtoAllowed.len() > 0) { + if (wtoAllowed.indexof(weapon.name) == null) + return false + break + } + } + } + }