summaryrefslogtreecommitdiffstats
path: root/src/esp.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-03 22:54:31 +0100
committersalmonik <salmonik@tuta.io>2026-11-03 22:54:31 +0100
commitf87b7fdfba2e7483ae38794efa3f3cd9c0c761ac (patch)
tree6386954799ee30f7d41aa89dc0e96e93db739d5c /src/esp.cpp
parentAI: use server relationships to classify NPC friendliness (diff)
downloadhl2h-f87b7fdfba2e7483ae38794efa3f3cd9c0c761ac.tar.gz
hl2h-f87b7fdfba2e7483ae38794efa3f3cd9c0c761ac.zip
AI: debug-log NPC relation changes
Diffstat (limited to 'src/esp.cpp')
-rw-r--r--src/esp.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/esp.cpp b/src/esp.cpp
index 0966ff5..b09588f 100644
--- a/src/esp.cpp
+++ b/src/esp.cpp
@@ -151,6 +151,22 @@ static bool model_is_neutral(const char *m) {
151static bool npc_is_friendly(int idx, const char *model, int local_idx, 151static bool npc_is_friendly(int idx, const char *model, int local_idx,
152 bool &neutral) { 152 bool &neutral) {
153 int rel = server_npc_relation(idx, local_idx); 153 int rel = server_npc_relation(idx, local_idx);
154 // Debug-only: relation values are the authoritative answer and are the
155 // first thing to check when a friendly NPC still looks hostile. Logged only
156 // when an entity's relation changes, so this does not flood the log.
157 static int rel_cache[2048];
158 static bool rel_cache_init = false;
159 if (!rel_cache_init) {
160 for (int i = 0; i < 2048; i++)
161 rel_cache[i] = -999;
162 rel_cache_init = true;
163 }
164 if (idx > 0 && idx < 2048 && rel_cache[idx] != rel) {
165 rel_cache[idx] = rel;
166 logd("npc %d (%s): relation=%d followtarget=%d local=%d", idx,
167 model ? model : "?", rel,
168 (int)server_npc_has_follow_target(idx), local_idx);
169 }
154 if (rel == 3) { // D_LI 170 if (rel == 3) { // D_LI
155 neutral = false; 171 neutral = false;
156 return true; 172 return true;