From 5ddc9eb9d02ddc84e4c3a45bdcb2941513fb0346 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 18:58:13 +0100 Subject: Chams: per-relationship, visible/invisible styles and viewmodel - Hostile/neutral/friendly each have independent visible and through-wall settings: enable, style and colour. Viewmodel has its own enable/style/colour. - Styles: Flat, Wireframe, Additive, Solid, White, Fullbright, Glow outline. Additive uses the model solid material + ADDITIVE flag (the VGUI additive was invisible on NPCs). White/fullbright are solid-based, so the viewmodel no longer disappears/checkerboards. Glow outline adds a wireframe contour pass for depth. - Config: [chams] active/bind, [chams_hostile|neutral|friendly] vis/inv settings, [chams_vm]. GUI sections for each group. --- src/esp.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/esp.cpp') diff --git a/src/esp.cpp b/src/esp.cpp index 1631df1..d32a8bc 100644 --- a/src/esp.cpp +++ b/src/esp.cpp @@ -187,6 +187,26 @@ bool esp_is_viewmodel_index(int idx) { return model && (strstr(model, "/v_") || strstr(model, "\\v_")); } +// 0 = hostile, 1 = neutral, 2 = friendly, -1 = not an NPC. +static bool npc_is_friendly(int idx, const char *model, int local_idx, + bool &neutral); +int esp_npc_relation(int idx) { + if (!esp_is_npc_index(idx)) + return -1; + int local = engine_get_local_player(); + if (local <= 0) + return 0; + void *ent = entitylist_get(idx); + const char *model = ent ? entity_model_name(ent) : nullptr; + bool neutral = false; + bool friendly = npc_is_friendly(idx, model, local, neutral); + if (neutral) + return 1; + if (friendly) + return 2; + return 0; +} + static bool model_is_friendly(const char *m) { static const char *patterns[] = { "citizen", "humans/", "male_", "female_", "barney", "alyx", -- cgit v1.2.3