From c91c7248fcb3911a8a2b6442d8657167364a911c Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 27 Oct 2026 21:11:32 +0100 Subject: Stucklaunch: fix prop detection and add diagnostics - Client physics props are CPhysicsProp/CPhysBox, not the server class prop_physics; the old case-sensitive class check never matched. Detect MOVETYPE_VPHYSICS first (the reliable signal), then case-insensitive class/model patterns. - Log the first few prop checks with index, movetype, class and model so a failed ground lookup is diagnosable. - Log once when Stucklaunch is active (with run state, bind and ground offset), when it engages, and when the ground is not a prop. - Toast a warning when binding a feature that is not Active yet. --- src/esp.cpp | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) (limited to 'src/esp.cpp') diff --git a/src/esp.cpp b/src/esp.cpp index bda6232..ca7bae0 100644 --- a/src/esp.cpp +++ b/src/esp.cpp @@ -2,6 +2,7 @@ #include "hl2h.h" #include #include +#include #include #include #include @@ -1131,18 +1132,49 @@ static void spread_compute() { g_spread_ready = true; } +static bool icontains(const char *hay, const char *needle) { + if (!hay || !needle || !*needle) + return false; + size_t n = strlen(needle); + for (const char *p = hay; *p; p++) + if (strncasecmp(p, needle, n) == 0) + return true; + return false; +} + bool entity_is_physics_prop(int idx) { if (idx <= 0 || idx > 4096) return false; + void *ent = entitylist_get(idx); + if (!ent) + return false; + int mt = -1; + // The reliable signal: physics objects use MOVETYPE_VPHYSICS. The client + // class is CPhysicsProp / CPhysBox, not the server's prop_physics name. + if (g_net.movetype >= 0) { + mt = *(int *)((uintptr_t)ent + g_net.movetype); + if (mt == MOVETYPE_VPHYSICS) + return true; + } void *net = entity_networkable(idx); const char *cls = net ? entity_class_name(net, nullptr) : nullptr; - void *ent = entitylist_get(idx); - const char *model = ent ? entity_model_name(ent) : nullptr; - if (cls && (strstr(cls, "prop_physics") || strstr(cls, "physbox"))) - return true; - if (model && (strstr(model, "props_junk") || strstr(model, "props_physics"))) - return true; - return false; + const char *model = entity_model_name(ent); + bool is_prop = icontains(cls, "physicsprop") || icontains(cls, "physbox") || + icontains(cls, "prop_physics") || + icontains(model, "props_junk") || + icontains(model, "props_physics") || + icontains(model, "props_c17") || + icontains(model, "props_interiors") || + icontains(model, "props_lab"); + if (!is_prop) { + static int miss_logs = 0; + if (miss_logs < 6) { + miss_logs++; + logf("stucklaunch prop? idx=%d movetype=%d cls=%s model=%s", idx, mt, + cls ? cls : "?", model ? model : "?"); + } + } + return is_prop; } bool active_weapon_is_gravity_gun(void *local_ent) { -- cgit v1.2.3