-
Notifications
You must be signed in to change notification settings - Fork 333
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
Minor bone and ragdoll E2 fixes #2896
Conversation
Fix ragdollSetPose(table, number) with 0 would not rotate properly
Add dynamic perf
local bone_count = entity:GetPhysicsObjectCount() | ||
if table.Count(entity2bone[entity] or {}) ~= bone_count then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are an entity's bones count able to change? I'm not sure what this fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entity2bone[entity]
exists when you get only 1 bone, so this assumes the array is full. Not sure how to do this elegantly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it so getting 1 bone populates the whole array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or make it so getting 1 bone doesn't use the cache.
end | ||
|
||
pose.size = #pose.n | ||
pose.stypes._origina = "a" | ||
pose.s._origina = bones[0]:GetAngles() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do E2 arrays support 0 index?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also should _origina be documented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They can use them but they won't work on foreach
. This is a table anyway. Numerical indices are already being used for the bones themselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also should _origina be documented
It's kind of an internal thing but I guess I could. Somewhere.
@Denneisk sorry, my review comments I added a few weeks ago never got submitted somehow lol |
tl;dr, I don't like the table.Count, I think the cache needs to be a little smarter |
ragdollSetPose
based on sizeE2Lib.GetBones
would not fill empty keys in bone tableragdollSetPose(table, number)
with 0 would not rotate to the correct target angle