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

Minor bone and ragdoll E2 fixes #2896

Merged
merged 4 commits into from
Dec 23, 2023
Merged

Conversation

Denneisk
Copy link
Member

  • Added E2 descriptions
  • Added small perf cost to ragdollSetPose based on size
  • Fix E2Lib.GetBones would not fill empty keys in bone table
  • Fix ragdollSetPose(table, number) with 0 would not rotate to the correct target angle

Fix ragdollSetPose(table, number) with 0 would not rotate properly
Add dynamic perf
Comment on lines 50 to 51
local bone_count = entity:GetPhysicsObjectCount()
if table.Count(entity2bone[entity] or {}) ~= bone_count then
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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()
Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Member Author

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.

@thegrb93
Copy link
Contributor

@Denneisk sorry, my review comments I added a few weeks ago never got submitted somehow lol

@thegrb93
Copy link
Contributor

tl;dr, I don't like the table.Count, I think the cache needs to be a little smarter

@thegrb93 thegrb93 merged commit 0653171 into wiremod:master Dec 23, 2023
1 check failed
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