feat(ground-ai)!: disable stock tankBot globally when AI script loads

Replace per-bot mid-battle movement handback to stock AI with a clean
binary startup gate:

- Locate Unit::setBehaviorTree (ground_ai_set_beh_tree: .37 0x4e89b0,
  .58 0x4e8f60) in patches/native/local_mp_ground_ai.jsonc and hook it
  in native/wto-net/src/local_mp_ground_ai.c.
- Announce readiness from [init] in wto_ai_runtime.das via
  wtoGroundAiScriptReady once the ground AI scripts finish compiling
  cleanly with custom movement enabled. When announced, hook_set_beh_tree
  suppresses attaching "tankBot" to LocalMP bot tanks and keeps their
  MoveSystem.inactive pinned to 1 for the life of the vehicle, ending
  all tug-of-war (external_inactive_reset) with stock AI.
- If scripts fail to compile, are missing, or mode is "stock" / "fire",
  ownMovement stays 0 and stock tankBot runs untouched.
- Remove per-bot handback, timeout release, and the now-obsolete
  navigation.returnToStockOnFailure config plumbing; on genuine script
  failure a bot halts in place and logs DRIVE_FAIL instead of silently
  switching to stock. Also initialize newly spawned bot ticks to run on
  frame 0 to eliminate spawn-frame invalid_drive_cmd noise.

Verified MSVC build of wto_ws.dll (0 warnings in project C sources), root
and launcher type checks, native module resolution on both 2.61.0.37 and
2.61.0.58 (0 failures), isolated 2.61.0.58 startup confirming 12/12
LocalMP modules installed, wto_ai_runtime.das loaded in 213 ms (0 compile
errors), and "ground AI script ready (ownMovement=1; stock tankBot
disabled)" in wto_ws.log.

BREAKING CHANGE: removes navigation.returnToStockOnFailure from
tuning/ground-ai.jsonc; stock tankBot is now controlled strictly by
whether the custom ground AI script loaded with custom movement enabled.
This commit is contained in:
N0VAN0M4LY committed 2026-12-04 01:06:04 +08:00
1 parent ac35c25851
commit 85532cd930
13 files changed
+105 -124

No files matched your search

-3
View File
@@ -140,9 +140,6 @@ 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 },
@@ -88,7 +88,6 @@ export interface GroundAiConfig {
readonly steerSign: number;
readonly deadEchoSec: number;
readonly controlTimeoutSec: number;
readonly returnToStockOnFailure: boolean;
readonly cornerBrakeAccel: number;
readonly pivotAngleDeg: number;
readonly stuckWindowSec: number;
@@ -269,7 +268,6 @@ 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],
+1 -5
View File
@@ -17,15 +17,11 @@ export function networkHookSettings(
endpoint: LocalEndpoint,
stock: PeImage,
nativeValues: ReadonlyMap<string, number>,
options?: {
readonly loggingEnabled?: boolean;
readonly groundAiReturnToStock?: boolean;
},
options?: { readonly loggingEnabled?: 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`) };