From 3249caf17de0dcab005398995ef3e611b3f81131 Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 3 Nov 2026 23:07:40 +0100 Subject: AI: fix relationship lookup; classify citizen/hacked turrets m_Relationship is DEFINE_UTLVECTOR (FIELD_CUSTOM), not FIELD_EMBEDDED, so the datamap scan always returned -1 and every NPC fell back to the model heuristic. Resolve it as FIELD_CUSTOM with an embedded fallback. Floor turrets never add relationship rows when friendly: CNPC_FloorTurret overrides Classify() to CLASS_PLAYER_ALLY for citizen-built (SF_FLOOR_TURRET_CITIZEN) and Alyx-hacked turrets. Read m_spawnflags and m_bHackedByAlyx from the server instead. Widen the datamap offset window (0x4..0x4000) for derived-class fields and log the new offsets plus turret state in the NPC debug line. --- CONTEXT.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'CONTEXT.md') diff --git a/CONTEXT.md b/CONTEXT.md index c6b9c2c..fb97636 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -157,6 +157,13 @@ vocabulary / decisions. - This makes map-scripted friendly turrets and other relationship overrides dynamic instead of model-name guesses. When no row exists, the old model heuristic is used. +- `m_Relationship` is declared with `DEFINE_UTLVECTOR`, so its datamap entry + is `FIELD_CUSTOM` (not `FIELD_EMBEDDED`). Resolving it as embedded silently + returned `-1` for every NPC. +- Floor turrets are special: citizen-built turrets (`SF_FLOOR_TURRET_CITIZEN`, + spawnflags `0x200`) and Alyx-hacked turrets (`m_bHackedByAlyx`) report + `CLASS_PLAYER_ALLY` from their overridden `Classify()` and never add a + relationship row. They are classified from those server fields instead. - Bugbait-controlled antlions are also treated as friendly when their server `m_hFollowTarget` is set, covering antlions that spawned before the global `antlion_allied` state changed. -- cgit v1.2.3