Added functions to create and modify force behavior of client-side "death ragdolls"

This commit is contained in:
Blixibon 2021-01-23 13:20:07 -06:00
parent 8af9c0dc61
commit e3550438b9
2 changed files with 22 additions and 0 deletions

View File

@ -335,6 +335,12 @@ BEGIN_ENT_SCRIPTDESC( C_BaseAnimating, C_BaseEntity, "Animating models client-si
DEFINE_SCRIPTFUNC( GetSkin, "Gets the model's skin" )
DEFINE_SCRIPTFUNC( SetSkin, "Sets the model's skin" )
DEFINE_SCRIPTFUNC( GetForceBone, "Gets the entity's force bone, which is used to determine which bone a ragdoll should apply its force to." )
DEFINE_SCRIPTFUNC( SetForceBone, "Sets the entity's force bone, which is used to determine which bone a ragdoll should apply its force to." )
DEFINE_SCRIPTFUNC( GetRagdollForce, "Gets the entity's ragdoll force, which is used to apply velocity to a ragdoll." )
DEFINE_SCRIPTFUNC( SetRagdollForce, "Sets the entity's ragdoll force, which is used to apply velocity to a ragdoll." )
DEFINE_SCRIPTFUNC_NAMED( ScriptBecomeRagdollOnClient, "BecomeRagdollOnClient", "" )
DEFINE_SCRIPTFUNC( IsRagdoll, "" )
BEGIN_SCRIPTHOOK( C_BaseAnimating::g_Hook_OnClientRagdoll, "OnClientRagdoll", FIELD_VOID, "Called when this entity turns into a client-side ragdoll." )
@ -1530,6 +1536,15 @@ void C_BaseAnimating::ScriptGetBoneTransform( int iBone, HSCRIPT hTransform )
GetBoneTransform( iBone, *HScriptToClass<matrix3x4_t>( hTransform ) );
}
HSCRIPT C_BaseAnimating::ScriptBecomeRagdollOnClient()
{
C_BaseAnimating *pRagdoll = BecomeRagdollOnClient();
if (!pRagdoll)
return NULL;
return pRagdoll->GetScriptInstance();
}
float C_BaseAnimating::ScriptGetPoseParameter( const char* szName )
{
CStudioHdr* pHdr = GetModelPtr();

View File

@ -467,6 +467,13 @@ public:
// For VScript
void SetSkin( int iSkin ) { m_nSkin = iSkin; }
int GetForceBone() { return m_nForceBone; }
void SetForceBone( int iBone ) { m_nForceBone = iBone; }
const Vector& GetRagdollForce() { return m_vecForce; }
void SetRagdollForce( const Vector &vecForce ) { m_vecForce = vecForce; }
HSCRIPT ScriptBecomeRagdollOnClient();
static ScriptHook_t g_Hook_OnClientRagdoll;
float ScriptGetPoseParameter(const char* szName);