mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-15 00:07:58 +03:00
Added FireEvent hook to clientside VScript (equivalent of HandleAnimEvent)
This commit is contained in:
parent
6cfcc66cec
commit
3579404668
@ -293,6 +293,7 @@ BEGIN_ENT_SCRIPTDESC( C_ClientRagdoll, C_BaseAnimating, "Client-side ragdolls" )
|
|||||||
END_SCRIPTDESC();
|
END_SCRIPTDESC();
|
||||||
|
|
||||||
ScriptHook_t C_BaseAnimating::g_Hook_OnClientRagdoll;
|
ScriptHook_t C_BaseAnimating::g_Hook_OnClientRagdoll;
|
||||||
|
ScriptHook_t C_BaseAnimating::g_Hook_FireEvent;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BEGIN_ENT_SCRIPTDESC( C_BaseAnimating, C_BaseEntity, "Animating models client-side" )
|
BEGIN_ENT_SCRIPTDESC( C_BaseAnimating, C_BaseEntity, "Animating models client-side" )
|
||||||
@ -346,6 +347,13 @@ BEGIN_ENT_SCRIPTDESC( C_BaseAnimating, C_BaseEntity, "Animating models client-si
|
|||||||
BEGIN_SCRIPTHOOK( C_BaseAnimating::g_Hook_OnClientRagdoll, "OnClientRagdoll", FIELD_VOID, "Called when this entity turns into a client-side ragdoll." )
|
BEGIN_SCRIPTHOOK( C_BaseAnimating::g_Hook_OnClientRagdoll, "OnClientRagdoll", FIELD_VOID, "Called when this entity turns into a client-side ragdoll." )
|
||||||
DEFINE_SCRIPTHOOK_PARAM( "ragdoll", FIELD_HSCRIPT )
|
DEFINE_SCRIPTHOOK_PARAM( "ragdoll", FIELD_HSCRIPT )
|
||||||
END_SCRIPTHOOK()
|
END_SCRIPTHOOK()
|
||||||
|
|
||||||
|
BEGIN_SCRIPTHOOK( C_BaseAnimating::g_Hook_FireEvent, "FireEvent", FIELD_BOOLEAN, "Called when handling animation events. Return false to cancel base handling." )
|
||||||
|
DEFINE_SCRIPTHOOK_PARAM( "origin", FIELD_VECTOR )
|
||||||
|
DEFINE_SCRIPTHOOK_PARAM( "angles", FIELD_VECTOR )
|
||||||
|
DEFINE_SCRIPTHOOK_PARAM( "event", FIELD_INTEGER )
|
||||||
|
DEFINE_SCRIPTHOOK_PARAM( "options", FIELD_CSTRING )
|
||||||
|
END_SCRIPTHOOK()
|
||||||
#endif
|
#endif
|
||||||
END_SCRIPTDESC();
|
END_SCRIPTDESC();
|
||||||
|
|
||||||
@ -3652,6 +3660,10 @@ void C_BaseAnimating::DoAnimationEvents( CStudioHdr *pStudioHdr )
|
|||||||
gpGlobals->curtime );
|
gpGlobals->curtime );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
if (ScriptHookFireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() ) == false)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
FireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() );
|
FireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() );
|
||||||
}
|
}
|
||||||
@ -3684,6 +3696,11 @@ void C_BaseAnimating::DoAnimationEvents( CStudioHdr *pStudioHdr )
|
|||||||
gpGlobals->curtime );
|
gpGlobals->curtime );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
if (ScriptHookFireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() ) == false)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
FireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() );
|
FireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3691,6 +3708,26 @@ void C_BaseAnimating::DoAnimationEvents( CStudioHdr *pStudioHdr )
|
|||||||
m_flPrevEventCycle = flEventCycle;
|
m_flPrevEventCycle = flEventCycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool C_BaseAnimating::ScriptHookFireEvent( const Vector& origin, const QAngle& angles, int event, const char *options )
|
||||||
|
{
|
||||||
|
if (m_ScriptScope.IsInitialized() && g_Hook_FireEvent.CanRunInScope(m_ScriptScope))
|
||||||
|
{
|
||||||
|
// origin, angles, event, options
|
||||||
|
ScriptVariant_t args[] = { origin, angles, event, options };
|
||||||
|
ScriptVariant_t returnValue = true;
|
||||||
|
g_Hook_FireEvent.Call( m_ScriptScope, &returnValue, args );
|
||||||
|
|
||||||
|
return returnValue.m_bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Parses a muzzle effect event and sends it out for drawing
|
// Purpose: Parses a muzzle effect event and sends it out for drawing
|
||||||
// Input : *options - event parameters in text format
|
// Input : *options - event parameters in text format
|
||||||
|
@ -164,6 +164,10 @@ public:
|
|||||||
virtual void FireObsoleteEvent( const Vector& origin, const QAngle& angles, int event, const char *options );
|
virtual void FireObsoleteEvent( const Vector& origin, const QAngle& angles, int event, const char *options );
|
||||||
virtual const char* ModifyEventParticles( const char* token ) { return token; }
|
virtual const char* ModifyEventParticles( const char* token ) { return token; }
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
bool ScriptHookFireEvent( const Vector& origin, const QAngle& angles, int event, const char *options );
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined ( SDK_DLL ) || defined ( HL2MP )
|
#if defined ( SDK_DLL ) || defined ( HL2MP )
|
||||||
virtual void ResetEventsParity() { m_nPrevResetEventsParity = -1; } // used to force animation events to function on players so the muzzleflashes and other events occur
|
virtual void ResetEventsParity() { m_nPrevResetEventsParity = -1; } // used to force animation events to function on players so the muzzleflashes and other events occur
|
||||||
// so new functions don't have to be made to parse the models like CSS does in ProcessMuzzleFlashEvent
|
// so new functions don't have to be made to parse the models like CSS does in ProcessMuzzleFlashEvent
|
||||||
@ -477,6 +481,7 @@ public:
|
|||||||
HSCRIPT ScriptBecomeRagdollOnClient();
|
HSCRIPT ScriptBecomeRagdollOnClient();
|
||||||
|
|
||||||
static ScriptHook_t g_Hook_OnClientRagdoll;
|
static ScriptHook_t g_Hook_OnClientRagdoll;
|
||||||
|
static ScriptHook_t g_Hook_FireEvent;
|
||||||
|
|
||||||
float ScriptGetPoseParameter(const char* szName);
|
float ScriptGetPoseParameter(const char* szName);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user