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

CollisionGroup Needs Force Type Casting #534

Closed
TitaniumLithium opened this issue Jul 31, 2024 · 2 comments
Closed

CollisionGroup Needs Force Type Casting #534

TitaniumLithium opened this issue Jul 31, 2024 · 2 comments
Labels
untriaged New issue has not been triaged

Comments

@TitaniumLithium
Copy link

Not a big problem though.

TestEntity.Collision.CollisionGroup = CollisionGroup.COLLISION_GROUP_DEFAULT;

Will Alert :
Cannot cast CounterStrikeSharp.API.Modules.Entities.Constants.CollisionGroup to byte directly

public enum CollisionGroup
{
COLLISION_GROUP_NONE = 0,
COLLISION_GROUP_NEVER,
COLLISION_GROUP_TRIGGER,
COLLISION_GROUP_CONDITIONALLY_SOLID,

// m_CollisionGroup
[SchemaMember("CCollisionProperty", "m_CollisionGroup")]
public ref byte CollisionGroup => ref Schema.GetRef<byte>(this.Handle, "CCollisionProperty", "m_CollisionGroup");

@github-actions github-actions bot added the untriaged New issue has not been triaged label Jul 31, 2024
@KillStr3aK
Copy link
Contributor

in general this is intended, could be added tho
also dont forget that changing collisions like that are not preferred

@roflmuffin
Copy link
Owner

roflmuffin commented Aug 1, 2024

Yeah this is a somewhat rare exception because the CollisionGroup enum is not defined in the schema from Valve that we use to generate the types, and we provide the CollisionGroup out of convenience. I'm guessing if we just change CollisionGroup to be a byte enum it should fix this? We can't implicitly convert enums so we would have to change the type on the schema which is probably a no go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged New issue has not been triaged
Projects
None yet
Development

No branches or pull requests

3 participants