Skip to content

Ragdolls not cleaning their collision hash fix - #562

Open
MyGamepedia wants to merge 1 commit into
mapbase-source:developfrom
MyGamepedia:ragdoll-fix
Open

MyGamepedia wants to merge 1 commit into
mapbase-source:developfrom
MyGamepedia:ragdoll-fix

Conversation

@MyGamepedia

@MyGamepedia MyGamepedia commented Nov 9, 2026 •

Copy link
Copy Markdown

Usually this is not an issue until the entity is removed from the map. There is prop_ragdoll_attached entity, which is usually created by the npc_barnacle entity, in order for this creature to eat its victim without causing errors, it uses collision hash (g_EntityCollisionHash) to prevent the prop_ragdoll_attached from colliding with the npc_barnacle, the barnacle's npc_barnacle_tongue_tip, and worldspawn. Collision hash recognizes an entity using only entindex, not the serial number (entref). and because the prop_ragdoll_attached is usually removed from the map when eaten by the npc_barnacle, it leaves its old entry in collision hash.
What does all this mean ? If a new networked entity will occupy the same entindex slot the removed prop_ragdoll_attached did, this new entity will also receive the collision hash rules, and fall out of world, because the collision hash tells it do not collide with worldspawn.
I'm not sure if it's just server ragdolls or everything else as well, but for me it became a problem when I started using server ragdolls created by dead NPCs, the chance this bug will happen is kinda low (difficult to repeat intentionally), but because I tested my project a lot, I noticed this bug many times, but for a long time I did not understand what the problem was.
The fix is ​​quite simple, before the entity is removed, clear the collision hash for this and bones (IPhysicsObjects stored in m_ragdoll.list[i].pObject).
I should note that I initially noticed this bug only in Black Mesa, but by looking at the code, it can be replicated in Mapbase and HL2; this mechanic has no difs between these games. That's why I opened this PR, perhaps it will help someone. After implementing the fix, I haven't noticed anything like this happening again (don't ask me here how I can modify this proprietary game as it's a complicated topic).
I have some footage of this bug saved, where two barnacles eat two headcrabs, then I kill a houndeye and one of these barnacles, they create a bunch of bones, then I kill the zombie guard, and it creates his corpse and the corpse of the headcrab, both fall through the floor.
https://github.com/user-attachments/assets/7de40f80-9d4f-4579-ac7a-3154595cbbc7


Does this PR close any issues?

  • (Optional) Insert issue number(s) and any related info here

PR Checklist

  • My PR follows all guidelines in the CONTRIBUTING.md file
  • My PR targets a develop branch OR targets another branch with a specific goal in mind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant