diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-05 18:09:43 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-05 18:09:43 +0100 |
| commit | a5d732920bd56c96e85db1ce2073bebf53e6b1ea (patch) | |
| tree | 2692a1f19f5b6cc33d015091f3a176062ea9bcf3 /src/server.cpp | |
| parent | Grenade trajectory: actual grenade state, full-length path, rounder rings (diff) | |
| download | hl2h-a5d732920bd56c96e85db1ce2073bebf53e6b1ea.tar.gz hl2h-a5d732920bd56c96e85db1ce2073bebf53e6b1ea.zip | |
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.
Diffstat (limited to '')
| -rw-r--r-- | src/server.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
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) { | |||
| 546 | server_entity_health(idx, nullptr, nullptr, &base); | 546 | server_entity_health(idx, nullptr, nullptr, &base); |
| 547 | if (!base) | 547 | if (!base) |
| 548 | return -1; | 548 | return -1; |
| 549 | return *(int *)((uintptr_t)base + off); | 549 | int val = *(int *)((uintptr_t)base + off); |
| 550 | static int juice_logs = 0; | ||
| 551 | if (juice_logs < 8 && cls && | ||
| 552 | (strstr(cls, "WallHealth") || strstr(cls, "Recharge") || | ||
| 553 | strstr(cls, "healthcharger") || strstr(cls, "suitcharger"))) { | ||
| 554 | juice_logs++; | ||
| 555 | int hv = g_srv_juice_health >= 0 | ||
| 556 | ? *(int *)((uintptr_t)base + g_srv_juice_health) | ||
| 557 | : -999; | ||
| 558 | int sv = g_srv_juice_suit >= 0 | ||
| 559 | ? *(int *)((uintptr_t)base + g_srv_juice_suit) | ||
| 560 | : -999; | ||
| 561 | logf("juice: idx=%d cls=%s chosen=%d health_off=%d val=%d " | ||
| 562 | "suit_off=%d val=%d", | ||
| 563 | idx, cls, off, g_srv_juice_health, hv, g_srv_juice_suit, sv); | ||
| 564 | } | ||
| 565 | return val; | ||
| 550 | } | 566 | } |
| 551 | 567 | ||
| 552 | // Server-side CBaseCombatCharacter::m_iAmmo array (reserve ammo). The datamap | 568 | // Server-side CBaseCombatCharacter::m_iAmmo array (reserve ammo). The datamap |
