Skip to content

Fix bone related functions #4203

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Nico8340
Copy link
Contributor

@Nico8340 Nico8340 commented May 6, 2025

Fixes functions related to bones, until now, 201, 301 and 302 were not useable. Also refactors the mentioned functions.

CEntity* theEntity = entity->GetGameEntity();
if (!theEntity)
if (bone < BONE_ROOT || bone > BONE_LEFTBREAST)
throw std::invalid_argument("Invalid bone: " + std::to_string(bone));
Copy link
Member

@tederis tederis May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exceptions make functions backward incompatible. Because the existing code can rely on return value, but exceptions will interrupt the execution and potentially break the code. Maybe better to use ArgumentParserWarn<false, ...>?

@tederis tederis added refactor enhancement New feature or request labels May 7, 2025
return false;
return theEntity->SetBonePosition(static_cast<eBone>(boneId), position);

return std::make_tuple(position.fX, position.fY, position.fZ);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you used CLuaMultiReturn in the function definition in the variant, then why are you returning a plain std::tuple here instead of CLuaMultiReturn? Even though CLuaMultiReturn is std::tuple, the return type should match the definition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants