@@ -67,6 +67,7 @@ void CLuaPedDefs::LoadFunctions()
6767 {" removePedFromVehicle" , RemovePedFromVehicle},
6868 {" setPedDoingGangDriveby" , SetPedDoingGangDriveby},
6969 {" setPedAnimation" , ArgumentParserWarn<false , SetPedAnimation>},
70+ {" getPedAnimation" , ArgumentParserWarn<false , GetPedAnimation>},
7071 {" setPedAnimationProgress" , SetPedAnimationProgress},
7172 {" setPedAnimationSpeed" , SetPedAnimationSpeed},
7273 {" setPedOnFire" , SetPedOnFire},
@@ -148,6 +149,7 @@ void CLuaPedDefs::AddClass(lua_State* luaVM)
148149 lua_classfunction (luaVM, " setWeaponSlot" , " setPedWeaponSlot" );
149150 lua_classfunction (luaVM, " setWalkingStyle" , " setPedWalkingStyle" );
150151 lua_classfunction (luaVM, " setAnimation" , " setPedAnimation" );
152+ lua_classfunction (luaVM, " getAnimation" , " getPedAnimation" );
151153 lua_classfunction (luaVM, " setAnimationProgress" , " setPedAnimationProgress" );
152154 lua_classfunction (luaVM, " setAnimationSpeed" , " setPedAnimationSpeed" );
153155 lua_classfunction (luaVM, " setWearingJetpack" , " setPedWearingJetpack" ); // introduced in 1.5.5-9.13846
@@ -424,6 +426,26 @@ bool CLuaPedDefs::SetPedAnimation(CElement* pPed, std::optional<std::variant<std
424426 return CStaticFunctionDefinitions::SetPedAnimation (pPed, animBlockName, animationName, time.value_or (-1 ), blendTime.value_or (250 ), loop.value_or (true ), updatePosition.value_or (true ), interruptable.value_or (true ), freezeLastFrame.value_or (true ), restoreTask.value_or (false ));
425427}
426428
429+ std::variant<bool , CLuaMultiReturn<std::string, std::string, int , bool , bool , bool , bool , int , bool >> CLuaPedDefs::GetPedAnimation (CPed* pPed)
430+ {
431+ const SPlayerAnimData& animData = pPed->GetAnimationData ();
432+
433+ if (!animData.IsAnimating ())
434+ return false ;
435+
436+ return CLuaMultiReturn<std::string, std::string, int , bool , bool , bool , bool , int , bool >(
437+ animData.blockName ,
438+ animData.animName ,
439+ animData.time ,
440+ animData.loop ,
441+ animData.updatePosition ,
442+ animData.interruptable ,
443+ animData.freezeLastFrame ,
444+ animData.blendTime ,
445+ animData.taskToBeRestoredOnAnimEnd
446+ );
447+ }
448+
427449int CLuaPedDefs::SetPedAnimationProgress (lua_State* luaVM)
428450{
429451 CElement* pElement;
0 commit comments