Пример #1
0
//-----------------------------------------------------------------------------
// Animation event handlers
//-----------------------------------------------------------------------------
void CWeaponZMFists::HandleAnimEventMeleeHit( CBaseCombatCharacter *pOperator )
{
	//do the trace stuff here so we can pass it to the Hit() function
	trace_t traceHit;

	// Try a ray
	CBasePlayer *pOwner = ToBasePlayer(pOperator);
	if ( !pOwner )
		return;

	Vector swingStart = pOwner->Weapon_ShootPosition( );
	Vector forward;

	pOwner->EyeVectors( &forward, NULL, NULL );

	Vector swingEnd = swingStart + forward * GetRange();

#ifndef CLIENT_DLL
	CHL2MP_Player *pPlayer = ToHL2MPPlayer( GetPlayerOwner() );
	// Move other players back to history positions based on local player's lag
	lagcompensation->StartLagCompensation( pPlayer, pPlayer->GetCurrentCommand() );
#endif
	UTIL_TraceLine( swingStart, swingEnd, MASK_SHOT_HULL, pOwner, COLLISION_GROUP_NONE, &traceHit );
	Hit( traceHit, ACT_VM_HITCENTER);
#ifndef CLIENT_DLL
	// Move other players back to history positions based on local player's lag
	lagcompensation->FinishLagCompensation( pPlayer );
#endif
}
//------------------------------------------------------------------------------
// Purpose :
// Input   :
// Output  :
//------------------------------------------------------------------------------
void CBaseHL2MPBludgeonWeapon::PrimaryAttack()
{

#ifndef CLIENT_DLL
    CHL2MP_Player *pPlayer = ToHL2MPPlayer( GetPlayerOwner() );
    // Move other players back to history positions based on local player's lag
    lagcompensation->StartLagCompensation( pPlayer, pPlayer->GetCurrentCommand() );
#endif
    Swing( false );
#ifndef CLIENT_DLL
    // Move other players back to history positions based on local player's lag
    lagcompensation->FinishLagCompensation( pPlayer );
#endif

}