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

Add root piece getters to Lua API #973

Merged
merged 1 commit into from
Aug 26, 2023

Conversation

sprunk
Copy link
Collaborator

@sprunk sprunk commented Aug 26, 2023

No description provided.

@lhog
Copy link
Collaborator

lhog commented Aug 26, 2023

Hmm isn't root piece always [0] ?

@sprunk
Copy link
Collaborator Author

sprunk commented Aug 26, 2023

Game devs don't know that. I had a strong suspicion this is the case but there is no foolproof way to learn this other than reading engine source. I've seen a chunk of lua code that gets all pieces and checks them one by one to find the root, which is what prompted this PR (since I wanted to replace it with something simpler and realized there isn't any).

Some sort of Engine.rootPieceIndex constant would also be fine if we anticipate we will never be using formats that have the root piece elsewhere (it may well be a good assumption since the numbers can be remapped, but idk).

@lhog
Copy link
Collaborator

lhog commented Aug 26, 2023

Root piece is always zero, no matter how pieces arranged in the model.
But yeah, I guess it can't hurt.

@lhog lhog merged commit 8e1a0e6 into beyond-all-reason:BAR105 Aug 26, 2023
@sprunk sprunk deleted the entangling-roots branch August 31, 2023 15:00
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