Skip to content

Updated CS:GO offsets. #367

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

Merged
merged 1 commit into from
Dec 7, 2020

Conversation

CookStar
Copy link
Contributor

@CookStar CookStar commented Dec 4, 2020

No description provided.

@CookStar
Copy link
Contributor Author

CookStar commented Dec 4, 2020

If someone has already found it, there's no need to find it again, and thanks to AlliedModders/SourceMod.

https://gist.github.com/CookStar/b890e1cb3d1c68991b45b0c50a28c80e

@jordanbriere
Copy link
Contributor

If someone has already found it, there's no need to find it again, and thanks to AlliedModders/SourceMod.

https://gist.github.com/CookStar/b890e1cb3d1c68991b45b0c50a28c80e

Nice! That's actually an interesting way to go about it. Perhaps we could do the same and retrieve them that way dynamically. The chances new members are inserted in-between sounds less likely than being declared before them.

@jordanbriere jordanbriere merged commit e88efa2 into Source-Python-Dev-Team:master Dec 7, 2020
@CookStar
Copy link
Contributor Author

CookStar commented Dec 7, 2020

Nice! That's actually an interesting way to go about it. Perhaps we could do the same and retrieve them that way dynamically. The chances new members are inserted in-between sounds less likely than being declared before them.

If so, it would be better to make the offset-related functions more available on the Python side.
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/src/core/modules/entities/entities_props.cpp#L115
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/src/core/modules/entities/entities_entity.cpp#L254

@jordanbriere
Copy link
Contributor

If so, it would be better to make the offset-related functions more available on the Python side.
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/src/core/modules/entities/entities_props.cpp#L115
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/src/core/modules/entities/entities_entity.cpp#L254

Would definitely be good to have more flexibility for those but I don't think we need them here. This is how I would implement it: https://github.com/Source-Python-Dev-Team/Source.Python/compare/instance_property (only tested on CS:S).

It would also give access to their offset directly from an Entity instance:

for name, prop in entity.properties.items():
    print(f'Offset of {name} is {prop.offset}')

@CookStar
Copy link
Contributor Author

CookStar commented Dec 8, 2020

Would definitely be good to have more flexibility for those but I don't think we need them here. This is how I would implement it: https://github.com/Source-Python-Dev-Team/Source.Python/compare/instance_property (only tested on CS:S).

It would also give access to their offset directly from an Entity instance:

for name, prop in entity.properties.items():
    print(f'Offset of {name} is {prop.offset}')

It works perfectly.

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