From a5d732920bd56c96e85db1ce2073bebf53e6b1ea Mon Sep 17 00:00:00 2001 From: salmonik Date: Thu, 5 Nov 2026 18:09:43 +0100 Subject: Items: keep health chargers visible, add charger diagnostics The health charger's candidate m_iJuice offset (0x3c8) read 0 on a full charger, so the empty-hide made health chargers disappear entirely. Restrict the hide to suit chargers (verified 0x47c) until the health offset is confirmed; health chargers stay visible. Classify with the server class name when the client class is generic, accept `healthcharger` in the health branch (maps use item_healthcharger / CNewWallHealth, not the func_healthcharger brush), and log up to eight `juice:` lines with the class and both candidate offsets/values. --- src/server.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/server.cpp') diff --git a/src/server.cpp b/src/server.cpp index cffc24f..b1661ac 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -546,7 +546,23 @@ int server_item_juice(int idx) { server_entity_health(idx, nullptr, nullptr, &base); if (!base) return -1; - return *(int *)((uintptr_t)base + off); + int val = *(int *)((uintptr_t)base + off); + static int juice_logs = 0; + if (juice_logs < 8 && cls && + (strstr(cls, "WallHealth") || strstr(cls, "Recharge") || + strstr(cls, "healthcharger") || strstr(cls, "suitcharger"))) { + juice_logs++; + int hv = g_srv_juice_health >= 0 + ? *(int *)((uintptr_t)base + g_srv_juice_health) + : -999; + int sv = g_srv_juice_suit >= 0 + ? *(int *)((uintptr_t)base + g_srv_juice_suit) + : -999; + logf("juice: idx=%d cls=%s chosen=%d health_off=%d val=%d " + "suit_off=%d val=%d", + idx, cls, off, g_srv_juice_health, hv, g_srv_juice_suit, sv); + } + return val; } // Server-side CBaseCombatCharacter::m_iAmmo array (reserve ammo). The datamap -- cgit v1.2.3