Skip to content

Updated CS:GO offsets.#367

Merged
jordanbriere merged 1 commit into
Source-Python-Dev-Team:masterfrom
CookStar:new_offsets
Dec 7, 2020
Merged

Updated CS:GO offsets.#367
jordanbriere merged 1 commit into
Source-Python-Dev-Team:masterfrom
CookStar:new_offsets

Conversation

@CookStar

@CookStar CookStar commented Dec 4, 2020

Copy link
Copy Markdown
Contributor

No description provided.

@CookStar

CookStar commented Dec 4, 2020

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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

CookStar commented Dec 7, 2020

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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

CookStar commented Dec 8, 2020

Copy link
Copy Markdown
Contributor Author

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