-
-
Notifications
You must be signed in to change notification settings - Fork 422
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 SetCollisionGroup to API (#1461) #1507
Conversation
Added CS:GO signature (linux only). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to sleep on this one. It's likely the right thing to do (years late, but still the right thing) but there has to be a better way than the signatures.
|
There's a better option, which is |
The most common use of changing an entity's collision group I've seen is setting the collision group to to either |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this all looks good to me.
Maybe too late, but shouldn't the native named for the sake of clarity something like "SetEntityCollisionGroup" (To be consistent with the other entity natives) ? |
I agree. |
The native's first param is |
Another late comment on this PR. But now that Much agreeing with @KyleSanderson , depending on a signature seems a bit too much, especially if this native is going to be wanted on more games than just TF2/CS. Therefore I suggest the following alternative: The function is implemented as follow:
Considering This effectively only calls With that dirty hack done, we can then reimplement If I wasn't clear in my explanations, I could always make a PR. Extra note: it is possible that this virtual function gets overriden, although I'm not aware of any classes that do this. But should it be overridden, we could parse the vtable on |
About the enum |
It is very well possible that things like Anyone who might call something that would break physics would just have to do something like this SetEntProp(client, Prop_Data, "m_CollisionGroup", COLLISION_GROUP_DEBRIS_TRIGGER, 4);
CollisionRulesChanged(); |
Same issue for
To be perfect and avoid any problem with "CollisionRulesChanged", we would need to call directly these virtual functions, but that would mean maintaining 5 signatures: With their associated enums: |
Not necessarily applying my method. Only the vtable offset (not signature) for Secondly, if we need a better method for SetMoveType than the current SM's implementation, we can fallback on the IServerTools interface. Which is already available through Sourcemod. So we would need to maintain 2 signatures (not 5)
Finally, I don't know if plugins really need access to |
No, I was just tracking where CollisionRulesChanged() was called, and found SetSolid & SetSolidFlags. Don't know if issues have been detected with these ones, but looking at the last topic comment (https://forums.alliedmods.net/showpost.php?p=2247647&postcount=173), it looks like there's something with SetSolid. By the way, I don't know if we should continue to talk here. @ashort96 if possible, just rename the native to "SetEntityCollisionGroup(int entity, int collisiongroup)", and then let's discuss everything on an alliedmodders topic. EDIT : Small mistake from me, but I said signatures while SetSolid & SetSolidFlags may be called with offset (Need to check the vtable list). |
@Kenzzer if you're up for making a PR for the virtual solution I'm up for reviewing and/or co-authoring to help it get in. I agree that's the much better way, and we already do this with other functions by grabbing the function from 0 so there's precedence. IServerTools is not available on all games, so while it's handy for new stuff, old games will still need a classic fallback. |
Alright, in that case I'll open a PR in the next couple of days! |
Addresses issue #1461 and adds SetCollisionGroup to the API. Only CS:S and TF2 signatures are added - requesting feedback of where the CS:GO signature should go.