-
-
Notifications
You must be signed in to change notification settings - Fork 502
Add to accept 4x4 lua table in setElementBoneMatrix function #3844
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1072,10 +1072,43 @@ std::variant<bool, CLuaMultiReturn<float, float, float, float>> CLuaPedDefs::Get | |
| return std::make_tuple(x, y, z, w); | ||
| } | ||
|
|
||
| bool CLuaPedDefs::SetElementBoneMatrix(lua_State* const luaVM, CClientPed* entity, std::uint32_t boneId, CMatrix boneMatrix) | ||
| bool CLuaPedDefs::SetElementBoneMatrix(lua_State* const luaVM) | ||
|
||
| { | ||
| CEntity* theEntity = entity->GetGameEntity(); | ||
| return theEntity ? theEntity->SetBoneMatrix(static_cast<eBone>(boneId), boneMatrix) : false; | ||
| CClientEntity* entity = NULL; | ||
| std::uint32_t boneId; | ||
| CMatrix boneMatrix; | ||
|
|
||
| CScriptArgReader argStream(luaVM); | ||
| argStream.ReadUserData(entity); | ||
| argStream.ReadNumber(boneId); | ||
|
|
||
| if (argStream.NextIsTable()) | ||
| { | ||
| if (!ReadMatrix(luaVM, argStream.m_iIndex, boneMatrix)) | ||
| { | ||
| argStream.SetCustomError("Matrix is not 4 x 4"); | ||
| } | ||
| } | ||
| else | ||
| { | ||
| argStream.ReadMatrix(boneMatrix); | ||
| } | ||
|
|
||
| if (!argStream.HasErrors()) | ||
| { | ||
| CEntity* theEntity = entity->GetGameEntity(); | ||
|
|
||
| if (theEntity->SetBoneMatrix(static_cast<eBone>(boneId), boneMatrix)) | ||
| { | ||
| lua_pushboolean(luaVM, true); | ||
| return true; | ||
| } | ||
| } | ||
| else | ||
| m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage()); | ||
|
|
||
| lua_pushboolean(luaVM, false); | ||
| return false; | ||
| } | ||
|
|
||
| std::variant<bool, std::array<std::array<float, 4>, 4>> CLuaPedDefs::GetElementBoneMatrix(lua_State* const luaVM, CClientPed* entity, std::uint32_t boneId) | ||
|
|
||
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.
Just implement that "CMatrix" can be read from 4x4 lua table and don't touch this file at all