//----------------------------------------------------------------------------- // Purpose: Check to see if our target has moved beyond our length //----------------------------------------------------------------------------- void CHarpoon::ConstrainThink( void ) { if ( !GetImpaledTarget() || !m_hLinkedHarpoon.Get() ) return; // Moved too far away? float flDistSq = m_hLinkedHarpoon->GetAbsOrigin().DistToSqr( GetImpaledTarget()->GetAbsOrigin() ); if ( flDistSq > m_flConstrainLength ) { // Break the rope if ( m_hRope ) { m_hRope->DetachPoint(1); m_hRope->DieAtNextRest(); m_hRope = NULL; } // If we're impaling a player, remove his movement constraint if ( GetImpaledTarget()->IsPlayer() ) { CBaseTFPlayer *pPlayer = (CBaseTFPlayer *)GetImpaledTarget(); pPlayer->DeactivateMovementConstraint(); } SetThink( NULL ); } else { SetNextThink( gpGlobals->curtime + 0.1f ); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CWeaponHarpoon::DetachRope( void ) { #if !defined( CLIENT_DLL ) if ( m_hRope ) { m_hRope->DetachPoint(1); m_hRope->DieAtNextRest(); m_hRope = NULL; } #endif }