fix(ground-ai): harden drive ownership, teardown and failure switch

Address two issues found in the first isolated 2.61.0.58 live runs and add
a test switch to disable silent fallback to stock movement:

- Add navigation.returnToStockOnFailure in tuning/ground-ai.jsonc (default
  true), compiled into WTO_AI_NAV_RETURN_TO_STOCK and written to wto_ws.cfg
  as ground_ai_return_to_stock=0 when disabled. When false, failed or
  timed-out bots keep stock movement paused, brake in place and log the
  failure once instead of silently handing control back to stock tankBot.
- Allow holdMs=0 release actions even after local_mp_is_host() flips false
  during mission unload, add eid=0 bulk release on wto_reset_runtime(), and
  match slots by eid rather than live owner lookup so match exit cleans up
  the native control table immediately.
- Stop releasing drive ownership when a vehicle is immobilized by damage or
  repair; brake in place and pause the echo watchdog instead, avoiding the
  1-second release/re-acquire flapping observed during combat. Log exact
  release reasons and back off for 1 second if MoveSystem.inactive is
  cleared externally.

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, and a temporary
2.61.0.58 game copy build confirming ground_ai_return_to_stock=0 in
wto_ws.cfg and 15 packed daScript modules. Live battle re-check pending.
This commit is contained in:
N0VAN0M4LY committed 2026-12-03 16:47:44 +08:00
1 parent 89242e91f0
commit 73bae4785f
11 files changed
+116 -27

No files matched your search

+3
View File
@@ -140,6 +140,9 @@ export function buildGameCopy(inputs: GameCopyInputs): GameCopyBuild {
const executableFolder = dirname(GAME_FILES.executable);
const hookSettings = networkHookSettings(endpoint, stockImage, native.values, {
loggingEnabled: inputs.hookLogging ?? true,
...(customGroundDrive && inputs.groundAi?.config.navigation.returnToStockOnFailure === false
? { groundAiReturnToStock: false }
: {}),
});
const files: GameCopyFile[] = [
{ path: GAME_FILES.charPack, content: core.charPack },
@@ -56,6 +56,7 @@ export interface GroundAiConfig {
readonly steerSign: number;
readonly deadEchoSec: number;
readonly controlTimeoutSec: number;
readonly returnToStockOnFailure: boolean;
readonly cornerBrakeAccel: number;
readonly pivotAngleDeg: number;
readonly stuckWindowSec: number;
@@ -165,6 +166,7 @@ function collectConfigEntries(c: GroundAiConfig): readonly DasEntry[] {
['WTO_AI_NAV_STEER_SIGN', 'float', c.navigation.steerSign],
['WTO_AI_NAV_DEAD_ECHO_SEC', 'float', c.navigation.deadEchoSec],
['WTO_AI_NAV_CONTROL_TIMEOUT_SEC', 'float', c.navigation.controlTimeoutSec],
['WTO_AI_NAV_RETURN_TO_STOCK', 'bool', c.navigation.returnToStockOnFailure],
['WTO_AI_NAV_CORNER_BRAKE_ACCEL', 'float', c.navigation.cornerBrakeAccel],
['WTO_AI_NAV_PIVOT_ANGLE_DEG', 'float', c.navigation.pivotAngleDeg],
['WTO_AI_NAV_STUCK_WINDOW_SEC', 'float', c.navigation.stuckWindowSec],
+5 -1
View File
@@ -17,11 +17,15 @@ export function networkHookSettings(
endpoint: LocalEndpoint,
stock: PeImage,
nativeValues: ReadonlyMap<string, number>,
options?: { readonly loggingEnabled?: boolean },
options?: {
readonly loggingEnabled?: boolean;
readonly groundAiReturnToStock?: boolean;
},
): { name: string; content: Uint8Array } {
const lines = [
`port=${endpoint.port}`,
...(options?.loggingEnabled === false ? ['log=0'] : []),
...(options?.groundAiReturnToStock === false ? ['ground_ai_return_to_stock=0'] : []),
...nativeSettingsLines(stock, nativeValues),
];
return { name: SETTINGS, content: new TextEncoder().encode(`${lines.join('\n')}\n`) };