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

CS2: Entity.Properties() does not include second level properties of composite types #441

Open
esbengc opened this issue Oct 13, 2023 · 1 comment

Comments

@esbengc
Copy link
Contributor

esbengc commented Oct 13, 2023

Describe the bug
When parsing Source 2 demos and calling Entity.Properties(), the return value will not include properties such as a.b if both a and b are both composite types (i.e. arrays or record types). For example CCSPlayerPawn.m_pWeaponServices.m_hMyWeapons, which is an array type, will not be returned. Similarly, CCSPlayerPawn.m_attributes (which is an array of records) is not listed at all.

To Reproduce
Parse any CS2 demo, and at any point where a player pawn entity is available, call entity.Properties and print the names of the returned properties. m_pWeaponServices.m_hMyWeapons is absent

Expected behavior
See above

Library version
v4.0.0-beta2

Additional context
Problem seems to come from method sendtables2.field.getFieldPaths. When resolving a composite property, it calls state.get(fp) on the current state using the root-relative fp. For top level properties, this works fine as state will be the top-level state of the entity. For nested properties, however, it's going to be a problem. Take CCSPlayerPawn.m_pWeaponServices.m_hMyWeapons as an example: Here, state will be the value of m_pWeaponServices, which consists of 7 inner properties, while fp will be the root-relative path [86, 0]. So it starts by looking up value at index 86 on an object with only 7 properties, which fails.

@markus-wa
Copy link
Owner

markus-wa commented Oct 14, 2023

thanks for filing this issue - that's indeed a bug.

in the meantime ServerClass.String() could be useful - I think this should include the props with a.b. (on the latest master anyway, not on -beta.2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants