mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-17 20:10:21 +03:00
Exposed client-side ragdoll class and functions to VScript
This commit is contained in:
@@ -282,6 +282,16 @@ BEGIN_DATADESC( C_ClientRagdoll )
|
||||
END_DATADESC()
|
||||
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
BEGIN_ENT_SCRIPTDESC( C_ClientRagdoll, C_BaseAnimating, "Client-side ragdolls" )
|
||||
|
||||
DEFINE_SCRIPTFUNC_NAMED( SUB_Remove, "FadeOut", "Fades out the ragdoll and removes it from the client." )
|
||||
|
||||
// TODO: Proper shared ragdoll funcs?
|
||||
DEFINE_SCRIPTFUNC_NAMED( ScriptGetRagdollObject, "GetRagdollObject", "Gets the ragdoll object of the specified index." )
|
||||
DEFINE_SCRIPTFUNC_NAMED( ScriptGetRagdollObjectCount, "GetRagdollObjectCount", "Gets the number of ragdoll objects on this ragdoll." )
|
||||
|
||||
END_SCRIPTDESC();
|
||||
|
||||
ScriptHook_t C_BaseAnimating::g_Hook_OnClientRagdoll;
|
||||
#endif
|
||||
|
||||
@@ -693,6 +703,24 @@ void C_ClientRagdoll::Release( void )
|
||||
BaseClass::Release();
|
||||
}
|
||||
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
HSCRIPT C_ClientRagdoll::ScriptGetRagdollObject( int iIndex )
|
||||
{
|
||||
if (iIndex < 0 || iIndex > m_pRagdoll->RagdollBoneCount())
|
||||
{
|
||||
Warning("%s GetRagdollObject: Index %i not valid (%i objects)\n", GetDebugName(), iIndex, m_pRagdoll->RagdollBoneCount());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return g_pScriptVM->RegisterInstance( m_pRagdoll->GetElement(iIndex) );
|
||||
}
|
||||
|
||||
int C_ClientRagdoll::ScriptGetRagdollObjectCount()
|
||||
{
|
||||
return m_pRagdoll->RagdollBoneCount();
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Incremented each frame in InvalidateModelBones. Models compare this value to what it
|
||||
// was last time they setup their bones to determine if they need to re-setup their bones.
|
||||
|
||||
Reference in New Issue
Block a user