bool CASWTraceFilterShot::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) { Assert( pHandleEntity ); if ( !PassServerEntityFilter( pHandleEntity, m_pPassEnt2 ) ) return false; CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); // don't collide with other projectiles if ( dynamic_cast<CASW_Flamer_Projectile*>( pEntity ) != NULL ) return false; if ( dynamic_cast<CASW_Extinguisher_Projectile*>( pEntity ) != NULL ) return false; if ( pEntity && pEntity->Classify() == CLASS_ASW_MARINE ) { if ( m_bSkipMarines ) return false; CASW_Marine *pMarine = assert_cast<CASW_Marine*>( pEntity ); if ( m_bSkipRollingMarines && pMarine->GetCurrentMeleeAttack() && pMarine->GetCurrentMeleeAttack()->m_nAttackID == CASW_Melee_System::s_nRollAttackID ) return false; if ( m_bSkipMarinesReflectingProjectiles && pMarine->IsReflectingProjectiles() ) return false; } if ( m_bSkipAliens && pEntity && IsAlienClass( pEntity->Classify() ) ) return false; return BaseClass::ShouldHitEntity( pHandleEntity, contentsMask ); }
int CASW_Simple_Alien::OnTakeDamage( const CTakeDamageInfo &info ) { // don't get hurt if our attacker is our friend if (info.GetAttacker() && info.GetAttacker()->Classify() != CLASS_NONE) { // Proper way to check, but BCC default relationship array is private :/ //Disposition_t disp = CBaseCombatCharacter::m_DefaultRelationship[Classify()][info.GetAttacker()->Classify()].disposition; //if (disp == D_LI) //return 0; // Hacky way to stop simple aliens getting hurt by other Infested aliens Class_T c = info.GetAttacker()->Classify(); if ( IsAlienClass( c ) ) return 0; } if (asw_debug_alien_damage.GetBool()) { Msg("%d %s hurt by %f dmg\n", entindex(), GetClassname(), info.GetDamage()); } int iDamage = BaseClass::OnTakeDamage(info); if (iDamage > 0 && GetHealth() > 0) { PainSound(info); } return iDamage; }
// don't allow us to be hurt by allies bool CASW_Queen_Divers::PassesDamageFilter( const CTakeDamageInfo &info ) { if (info.GetAttacker()) { if ( IsAlienClass( info.GetAttacker()->Classify() ) ) return false; } return BaseClass::PassesDamageFilter(info); }