Add LookupEntityAttachment & GetEntityAttachment natives#1653
Add LookupEntityAttachment & GetEntityAttachment natives#1653asherkin merged 6 commits intoalliedmodders:masterfrom
Conversation
Headline
left a comment
There was a problem hiding this comment.
Tested for CS:GO Windows, functions properly.
Looks like a great patch, thank you for seeing this through!
KyleSanderson
left a comment
There was a problem hiding this comment.
Nice one - thank you for the contribution. Can you add sdk2013 Gamedata outside of the comments? The networkable stuff was a big issue with ents a decade ago.
What exactly do you mean by this? There isn't any gamedata that would make sense to add for sdk2013. |
bca6ec3 to
09974e9
Compare
asherkin
left a comment
There was a problem hiding this comment.
This all looks good to me, the error handling and datatable bits all seem fine - one tiny comment on how the API is presented but otherwise I'd say the meat of this is all good to go.
|
@KyleSanderson please could you re-review this or dismiss your stale review. |
Concerns addressed, no follow up
* Update syntax for SourceMod 1.11 * Remove DHooks dependency * Remove LookupAttachment SDKCall alliedmodders/sourcemod#1653 * Remove deprecated forwards * Rename ShowKeyHintText * Move pragmas up * A few more updates * Switch to AddTargetsToMenu2 * Update default admin flags * Update native return values * Update code and comment style * More style changes * yes * Change weird vector declaration * Re-register vehicle on plugin reload * Rework passenger damage in vehicles * Enforce convars * Use EOS constant * Add semicolons * Comments * Don't use nonexistant define * More headers
|
I might have an idea how to get attachment points without using signatures, though can't check if that will work: |
#1555
I agree.
Overview
This PR adds two new natives:
Example usage:
Gamedata for CS:GO, CS:S, L4D, L4D2 and TF2 is provided, but has not been tested by me.
Implementation
Using the virtual
CBaseAnimating::GetAttachment(int, matrix3x4_t &)was a deliberate choice because virtual offsets are generally easier to maintain than signatures. Thematrix3x4_tis converted to world position and world angles internally.Some of the other overloads are also inlined on a few games, making this the best choice.
Since this call can only be used on classes inheriting
CBaseAnimating, we check if theDT_BaseAnimatingSendTable exists on the entity, throwing a native error if it doesn't.This safeguard could be greatly improved with a call to
CBaseEntity::GetBaseAnimating, but would require more gamedata (maybe something to consider for the future?)Footnote
I have not been able to test this for any game other than TF2. I'd be grateful if other people could assist with testing
this on different games and engine versions.
This is my first time actively working with C++, so excuse some rookie mistakes.