feat(ground-ai): add cover reload, stalemate reposition, and damage repair

Complete the single-vehicle tactical loop for reload survival, stalemate
breaking, and vehicle damage repair:

- Add cover, reload, hull-angle, stalemate, reposition, and repair-cover
  parameters to tuning/ground-ai.jsonc, validated in ground-ai-tuning.ts
  and compiled into WTO_AI_SM_* constants.
- Add wto_ai_cover_common.das: continuously record the last hard-concealed
  hull position before peeking, and evaluate 9 cover candidates around
  the tank (with enemy-clearance scoring when searching for a repair
  cover).
- Add wto_ai_tactics_actions_common.das and wire wto_ai_tactics_common.das:
  - Damage retreat & repair (plan 6.1): when gun is inoperable while
    mobile, retreat to an enemy-free cover and send
    EventRepairSystemRequestRepair(repair=true) once safe; when engine or
    tracks immobilize the chassis, halt in place, request repair, and keep
    gun self-defense active; stay halted while
    repair_system_remaining_repair_time > 0.
  - 3-way reload action: pull back into remembered/nearby cover (up to 6 s
    budget, uninterrupted by flashes/new orders) -> zigzag advance at
    +/-18 deg when pushing without cover -> angle hull front +/-15 deg
    when side-exposed >30 deg with pivot room.
  - Stalemate reposition: confirm outgoing effective damage via
    EventUnitDamage (uint(hpFixed) < uint(prevHpFixed)) and enemy death;
    trigger lateral reposition after 2 no-effect shots, 2 no-shot halts,
    or 12 s cumulative halt time, unlocking short-halt only after 20 m
    progress or reaching the new position.
- Split periodic telemetry out of wto_ai_runtime.das into
  wto_ai_diag_common.das to keep every module under 300 lines.

Verified root and launcher type checks, isolated 2.61.0.58 build (24
ground AI modules packed), and clean in-engine daScript compilation/load
(wto_ai_runtime.das loaded in 228 ms, 0 compile errors). Live battle
acceptance deferred until the full pipeline is wired.
This commit is contained in:
N0VAN0M4LY committed 2026-12-03 18:14:43 +08:00
1 parent 314bdfe68e
commit 80113bdd2e
11 files changed
+535 -127

No files matched your search

@@ -97,6 +97,18 @@ export interface GroundAiConfig {
readonly shortHaltMaxSec: number;
readonly shortHaltCooldownSec: number;
readonly turnLaunchSpeedMps: number;
readonly coverMinDistM: number;
readonly coverMaxDistM: number;
readonly coverRetreatBudgetSec: number;
readonly reloadAdvanceAngleDeg: number;
readonly hullAngleTriggerDeg: number;
readonly hullAngleTargetDeg: number;
readonly maxTotalHaltSec: number;
readonly stalemateMissShots: number;
readonly stalemateNoShotHalts: number;
readonly repositionMinMoveM: number;
readonly repositionStepM: number;
readonly repairSafeEnemyDistM: number;
};
readonly tactics: {
readonly visionRangeM: number;
@@ -245,6 +257,18 @@ function collectConfigEntries(c: GroundAiConfig): readonly DasEntry[] {
['WTO_AI_SM_SHORT_HALT_MAX_SEC', 'float', c.stateMachine.shortHaltMaxSec],
['WTO_AI_SM_SHORT_HALT_COOLDOWN_SEC', 'float', c.stateMachine.shortHaltCooldownSec],
['WTO_AI_SM_TURN_LAUNCH_MPS', 'float', c.stateMachine.turnLaunchSpeedMps],
['WTO_AI_SM_COVER_MIN_DIST_M', 'float', c.stateMachine.coverMinDistM],
['WTO_AI_SM_COVER_MAX_DIST_M', 'float', c.stateMachine.coverMaxDistM],
['WTO_AI_SM_COVER_RETREAT_SEC', 'float', c.stateMachine.coverRetreatBudgetSec],
['WTO_AI_SM_RELOAD_ADV_DEG', 'float', c.stateMachine.reloadAdvanceAngleDeg],
['WTO_AI_SM_HULL_ANGLE_TRIG_DEG', 'float', c.stateMachine.hullAngleTriggerDeg],
['WTO_AI_SM_HULL_ANGLE_TGT_DEG', 'float', c.stateMachine.hullAngleTargetDeg],
['WTO_AI_SM_MAX_TOTAL_HALT_SEC', 'float', c.stateMachine.maxTotalHaltSec],
['WTO_AI_SM_STALE_MISS_SHOTS', 'int', c.stateMachine.stalemateMissShots],
['WTO_AI_SM_STALE_NOSHOT_HALTS', 'int', c.stateMachine.stalemateNoShotHalts],
['WTO_AI_SM_REPOS_MIN_MOVE_M', 'float', c.stateMachine.repositionMinMoveM],
['WTO_AI_SM_REPOS_STEP_M', 'float', c.stateMachine.repositionStepM],
['WTO_AI_SM_REPAIR_SAFE_DIST_M', 'float', c.stateMachine.repairSafeEnemyDistM],
['WTO_AI_TACTICS_VISION_RANGE_M', 'float', c.tactics.visionRangeM],
['WTO_AI_TACTICS_VISION_FOV_DEG', 'float', c.tactics.visionFovDeg],
['WTO_AI_TACTICS_PERIPHERAL_RANGE_M', 'float', c.tactics.peripheralRangeM],