Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an important update that elevates the abilities of entity manipulation in vscript. It allows read/write of all network properties, data and prediction descriptions, including physics objects and dynamic CUtlVector fields.
A few things to note,
GetPropType()
andHasProp()
can't yet return array and datatable types.Parsing member names separated with '.' temporarily modifies the source strings from the Squirrel string table. This is fast and harmless, though probably not very desired.
Indexing data table arrays (a data table array consisting of data tables) is not possible due to the original design of the NetProps interface. Though this doesn't apply to many cases, and I don't think
CAI_AllySpeechManager::m_ConceptCategoryTimers
is terribly important.Due to the nature of a single utility (
NetProps
) being used for both net props and data description maps, some vars overshadow others, such asCPlayerResource::m_iHealth
overCBaseEntity::m_iHealth
. I'm not aware of many instances of this though.The debug function
NetProps.Dump()
can be used to view all available fields of entities. This is better than a static field dump you might find elsewhere as the values of the variables are also displayed.An example dump: https://gist.github.com/samisalreadytaken/7b85fa38a2c9cac9bfefa3440f9efb4f
As for performance, using this
NetProps.GetPropInt( player, "m_iHealth" )
over a native functionplayer.GetHealth()
is 3.6 times slower, not great, not terrible.Differences to the L4D2 implementation:
They return vec3_origin on invalid input, this returns vec3_invalid.
This can access vector indices via float accessors.
This can access 8 bit int arrays as both strings and integers. It's not possible to tell apart a char array from a cstring, so access is allowed unless the char array contains a null char.
This can access more variables than theirs, most notably CUtlVectors and physics objects.
According to their docs, they don't clamp inputs, this does.
Does this PR close any issues?
PR Checklist
develop
branch OR targets another branch with a specific goal in mind