Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capability to +USE serverside ragdolls and toggle cleanup of individual ragdolls #297

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Blixibon
Copy link
Member

This PR adds two new spawnflags to prop_ragdoll to enable +USE and prevent pickup, respectively. When a ragdoll has +USE enabled, the player will be able to grab a limb and drag it around. This uses the same framework as the mega physcannon, although pickup forces will only use the strength of the carried limb, rather than the strength of the entire bone hierarchy. The other spawnflag disables picking up the ragdoll even when +USE is enabled, and is intended for situations where a ragdoll should be useable but should not be picked up. An OnPlayerUse output is also included, and it fires every time the ragdoll is +USE'd regardless of whether it is picked up. A new cvar, ragdoll_always_allow_use, allows all ragdolls to be +USE'd regardless of the spawnflag, which may be useful if you're making a game or mod centered around this mechanic. This cvar is disabled by default.

This PR also includes two new inputs: AddToLRU and RemoveFromLRU. "LRU" stands for "Least Recently Used", and in this case it's referring to Source's ragdoll cleanup system, which automatically removes ragdolls which haven't been used. Serverside ragdolls spawned by NPCs are automatically added to this system, while prop_ragdolls spawned by the map are not. You can use the AddToLRU input to add any ragdoll to this system, or the RemoveFromLRU input to remove a ragdoll from this system. This is useful when you want a ragdoll created by a NPC to linger, or if you want a ragdoll created by the map to be treated as a regular NPC ragdoll.


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

@@ -58,6 +60,8 @@ const float ATTACHED_DAMPING_SCALE = 50.0f;
#define SF_RAGDOLLPROP_STARTASLEEP 0x10000
#ifdef MAPBASE
#define SF_RAGDOLLPROP_FIXED_CONSTRAINTS 0x20000
#define SF_RAGDOLLPROP_ALLOW_USE 0x40000
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure you want to add new spawnflags? The likelihood of Mapbase mods adding their own is low, but if they do then this update will be breaking.

Copy link

@1upD 1upD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment about changing spawnflags, but other than that everything looks good

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.

2 participants