feat(ground-ai): add ready-rack dual-ammo bot spawn loadouts and shell switching

Select realistic ready-rack dual-shell loadouts for AI tanks on the local
server, inject them natively on bot spawn, and switch between anti-armor
and soft-target shells in battle:

- Add the loadout section to tuning/ground-ai.jsonc (lowReadyRackThreshold,
  topUpAmmoCount, primaryAmmoPct, secondaryMinRounds,
  penetrationCompareDistM), validated in ground-ai-tuning.ts.
- Add the tank-bot-ammo v2 dataset (apps/server/src/game-data/datasets/
  tank-bot-ammo.ts) reading primary cannon weapon name, capacity,
  firstStage/autoLoad shell ready-rack counts (excluding separate charges),
  and selectable shell modifications (using Lanz-Odermatt kinetic fields,
  cumulativeDamage, armorpower, and transitive reqModification chains).
- Add selectBotTankLoadouts (apps/server/src/battle/bot-tank-loadouts.ts):
  carry ready-rack count when >= 15 (top up to 22 when smaller or absent,
  clamped to gun capacity), skip SPAA/belt autocannons, pick highest-tier
  APFSDS/anti-armor primary (~80%) plus HE/HESH/HEAT secondary (~20%, min
  3 rounds) when available, and attach required addModification entries and
  per-tank wtoAmmo_<unit> strings to customBots when mode != stock.
- Hook Unit::changeAircraft (already located dynamically on .37 and .58) in
  native/wto-net/src/local_mp_loadout.c to assign the 24-byte
  ChangeUnitReflection.bullets entries via bullet_vec_assign for LocalMP
  bot spawns (async == 0, non-local bot MPlayer), leaving player spawns
  untouched.
- Track soft-target vs anti-armor shell classes in wto_ai_specs_common.das
  and write gun.nextBulletType in wto_ai_fire_common.das to queue HE/HESH
  against light/narrow targets and APFSDS/AP against MBTs/heavy armor.

Verified MSVC build of wto_ws.dll (0 warnings in project C sources), root
and launcher type checks, 14/14 check-patches on 2.61.0.58, 12/12 LocalMP
module installation, clean daScript load (wto_ai_runtime.das loaded in
211 ms, 0 compile errors), and real 2.61.0.58 loadout selection on
cn_ztz_96a (18 APFSDS + 4 HE), germ_leopard_2a4 (12 DM23 + 3 HEATFS),
ussr_t_80bvm (22 3BM60 + 6 HE), us_m1a2_abrams (14 M829A2 + 4 HEAT-MP),
ussr_t_34_1941 (18 APHEBC + 4 HE), and ussr_zsu_23_4 (stock belt kept).
Live battle acceptance begins in Step 9.
This commit is contained in:
N0VAN0M4LY committed 2026-12-03 19:25:04 +08:00
1 parent d5008baeff
commit ac35c25851
14 files changed
+601 -10

No files matched your search

+6
View File
@@ -10,6 +10,7 @@ import { BattleEconomy } from './battle/battle-economy.ts';
import { BattleMatchmaker } from './battle/battle-matchmaker.ts';
import { BattleSessionStore } from './battle/battle-session-store.ts';
import { selectBotAircraftLoadouts } from './battle/bot-aircraft-loadouts.ts';
import { selectBotTankLoadouts } from './battle/bot-tank-loadouts.ts';
import { actionTable } from './char/actions/action-table.ts';
import { CharService } from './char/char-service.ts';
import { ClanStore } from './clans/clan-store.ts';
@@ -31,6 +32,7 @@ import { DatasetCache } from './game-data/datasets/dataset-cache.ts';
import { decorCatalogue } from './game-data/datasets/decor-catalogue.ts';
import { externalItemSources } from './game-data/datasets/external-item-sources.ts';
import { flightModelPresets } from './game-data/datasets/flight-model-presets.ts';
import { tankBotAmmo } from './game-data/datasets/tank-bot-ammo.ts';
import { itemCatalogue } from './game-data/datasets/item-catalogue.ts';
import { multiplayerMissions, type MultiplayerMissions } from './game-data/datasets/multiplayer-missions.ts';
import { shopCountries } from './game-data/datasets/shop-countries.ts';
@@ -173,6 +175,9 @@ export async function startServer(options: ServerOptions): Promise<RunningServer
}, report);
const webUi = new WebUiService(datasets.load(webIcons), labels, options.dataFolder, artwork);
const botAircraftLoadouts = selectBotAircraftLoadouts(vehicles, datasets.load(flightModelPresets), equipment);
const botTankLoadouts = tuning.groundAi.mode === 'stock'
? undefined
: selectBotTankLoadouts(vehicles, datasets.load(tankBotAmmo), tuning.groundAi.loadout);
gameFiles.releasePacks();
let matching: MatchingService | undefined;
@@ -189,6 +194,7 @@ export async function startServer(options: ServerOptions): Promise<RunningServer
spawnRules,
botAircraftLoadouts,
tuning.groundAi.mode === 'stock' ? undefined : tuning.groundAi.lineupWeights,
botTankLoadouts,
(ctx) => modRuntime.runBattleFilterMissions(ctx),
);
const economy = new BattleEconomy(