diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 17:25:31 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 17:25:31 +0100 |
| commit | 710e8cc59557bc95ed74af8726ea13012fde50c3 (patch) | |
| tree | f1fd242c12d2ce5a939fbf1d3828e3546bc8f1cf /CONTEXT.md | |
| parent | Netvars: catch array element props and log the walk (diff) | |
| download | hl2h-710e8cc59557bc95ed74af8726ea13012fde50c3.tar.gz hl2h-710e8cc59557bc95ed74af8726ea13012fde50c3.zip | |
Items: read ammo and inventory from the server arrays
The client m_iAmmo/m_hMyWeapons recv props still do not resolve, but the
listen server has the same CBaseCombatCharacter arrays in its datamap. Resolve
m_iAmmo and m_hMyWeapons there:
- reserve ammo comes from server_player_ammo() when the client array is
missing, so full-ammo filtering works (RPG rockets at 3);
- the owned-weapon mask is filled from the server m_hMyWeapons[48] handles,
so fallen weapons count as ammo before the player equips them.
Widen the datamap field-size filter to 512 for the 192-byte handle array.
Diffstat (limited to 'CONTEXT.md')
| -rw-r--r-- | CONTEXT.md | 15 |
1 files changed, 8 insertions, 7 deletions
| @@ -610,14 +610,15 @@ vocabulary / decisions. | |||
| 610 | - A world weapon whose type is already in the local player's inventory is | 610 | - A world weapon whose type is already in the local player's inventory is |
| 611 | reclassified as ammo (`SMG ammo`, `AR2 ammo`, ...). Owner handles are | 611 | reclassified as ammo (`SMG ammo`, `AR2 ammo`, ...). Owner handles are |
| 612 | unreliable on this client (`m_hOwnerEntity`/`m_hOwner` resolve to -1), so | 612 | unreliable on this client (`m_hOwnerEntity`/`m_hOwner` resolve to -1), so |
| 613 | the inventory is read directly from the local `m_hMyWeapons[48]` handle | 613 | the inventory is read from the authoritative server |
| 614 | array (and remembered active types as a fallback). NPC-held weapons are | 614 | `CBaseCombatCharacter::m_hMyWeapons[48]` array (client `m_hMyWeapons` and the |
| 615 | therefore ignored. Weapons the player does not own stay under the Weapons | 615 | remembered active weapon are fallbacks). NPC-held weapons are ignored. |
| 616 | category. | 616 | Weapons the player does not own stay under the Weapons category. |
| 617 | - Ammo pickups also honour "Only if usable": the reserve count from | 617 | - Ammo pickups also honour "Only if usable": the reserve count from |
| 618 | `m_iAmmo[type]` is compared with the `sk_max_*` cvar (stock caps as fallback, | 618 | `m_iAmmo[type]` (client array when resolved, otherwise the server |
| 619 | e.g. RPG rockets = 3). Full ammo hides the pickup; if either value cannot | 619 | `CBaseCombatCharacter::m_iAmmo` array) is compared with the `sk_max_*` cvar |
| 620 | be read the item stays visible. | 620 | (stock caps as fallback, e.g. RPG rockets = 3). Full ammo hides the pickup; |
| 621 | if either value cannot be read the item stays visible. | ||
| 621 | - Scans the client entity list every 100 ms and tags health, ammo, armor/suit, | 622 | - Scans the client entity list every 100 ms and tags health, ammo, armor/suit, |
| 622 | world weapon pickups, the two supply-crate models and generic items. | 623 | world weapon pickups, the two supply-crate models and generic items. |
| 623 | - Each tag is a colored marker with a name and optional distance, filtered by | 624 | - Each tag is a colored marker with a name and optional distance, filtered by |
