//----------------------------------------------------------------------------- // Purpose: LeapTouch - this is the headcrab's touch function when it is in the air. // Input : *pOther - //----------------------------------------------------------------------------- void CNPC_Headcrab::LeapTouch( CBaseEntity *pOther ) { if ( pOther->Classify() == Classify() ) { return; } // Don't hit if back on ground if ( !(GetFlags() & FL_ONGROUND) ) { BiteSound(); TouchDamage( pOther ); } SetTouch( NULL ); }
void CASW_Parasite::LeapTouch( CBaseEntity *pOther ) { m_bMidJump = false; if ( IRelationType( pOther ) == D_HT ) { if (m_bDefanged) { if ( pOther->m_takedamage != DAMAGE_NO ) { BiteSound(); TouchDamage( pOther ); //ClearSchedule( "About to gib self" ); // gib us CTakeDamageInfo info(NULL, NULL, Vector(0,0,0), GetAbsOrigin(), GetHealth() * 2, DMG_ACID); TakeDamage(info); SetSchedule( SCHED_DIE ); return; } else { //ImpactSound(); } } // Don't hit if back on ground //if ( !( GetFlags() & FL_ONGROUND ) && m_bDefanged) // if we're defanged, don't infest, just do some combat damage //{ //} //else //{ //ImpactSound(); //} } else if( !(GetFlags() & FL_ONGROUND) ) { // Still in the air... if( gpGlobals->curtime < m_flIgnoreWorldCollisionTime ) { // Headcrabs try to ignore the world, static props, and friends for a // fraction of a second after they jump. This is because they often brush // doorframes or props as they leap, and touching those objects turns off // this touch function, which can cause them to hit the player and not bite. // A timer probably isn't the best way to fix this, but it's one of our // safer options at this point (sjb). return; } if( !pOther->IsSolid() ) { // Touching a trigger or something. return; } } // make sure we're solid RemoveSolidFlags( FSOLID_NOT_SOLID ); // Shut off the touch function. SetTouch( &CASW_Parasite::NormalTouch ); SetThink ( &CASW_Parasite::CallNPCThink ); SetCollisionGroup( ASW_COLLISION_GROUP_PARASITE ); // if we hit a marine, infest him and go away NormalTouch( pOther ); }