mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-14 15:57:59 +03:00
Exposed client-side ragdoll class and functions to VScript
This commit is contained in:
parent
cb7cee6283
commit
4861893235
@ -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.
|
||||
|
@ -678,6 +678,9 @@ public:
|
||||
C_ClientRagdoll( bool bRestoring = true );
|
||||
DECLARE_CLASS( C_ClientRagdoll, C_BaseAnimating );
|
||||
DECLARE_DATADESC();
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
DECLARE_ENT_SCRIPTDESC();
|
||||
#endif
|
||||
|
||||
// inherited from IPVSNotify
|
||||
virtual void OnPVSStatusChanged( bool bInPVS );
|
||||
@ -699,6 +702,11 @@ public:
|
||||
void FadeOut( void );
|
||||
virtual float LastBoneChangedTime();
|
||||
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
HSCRIPT ScriptGetRagdollObject( int iIndex );
|
||||
int ScriptGetRagdollObjectCount();
|
||||
#endif
|
||||
|
||||
bool m_bFadeOut;
|
||||
bool m_bImportant;
|
||||
float m_flEffectTime;
|
||||
|
@ -166,6 +166,7 @@ BEGIN_ENT_SCRIPTDESC( CRagdollProp, CBaseAnimating, "Ragdoll physics prop." )
|
||||
DEFINE_SCRIPTFUNC( SetSourceClassName, "Sets the ragdoll's source classname." )
|
||||
DEFINE_SCRIPTFUNC( HasPhysgunInteraction, "Checks if the ragdoll has the specified interaction." )
|
||||
|
||||
// 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." )
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user