void CTalkMonster::OnTakeDamage( const CTakeDamageInfo& info ) { if ( IsAlive() ) { // if player damaged this entity, have other friends talk about it if (info.GetAttacker() && m_MonsterState != MONSTERSTATE_PRONE && info.GetAttacker()->GetFlags().Any( FL_CLIENT ) ) { CBaseEntity *pFriend = FindNearestFriend( false ); if (pFriend && pFriend->IsAlive()) { // only if not dead or dying! CTalkMonster *pTalkMonster = (CTalkMonster *)pFriend; pTalkMonster->ChangeSchedule( slIdleStopShooting ); } } } CBaseMonster::OnTakeDamage( info ); }
int CTalkMonster :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType) { if ( IsAlive() ) { // if player damaged this entity, have other friends talk about it if (pevAttacker && m_MonsterState != MONSTERSTATE_PRONE && FBitSet(pevAttacker->flags, FL_CLIENT)) { CBaseEntity *pFriend = FindNearestFriend(FALSE); if (pFriend && pFriend->IsAlive()) { // only if not dead or dying! CTalkMonster *pTalkMonster = (CTalkMonster *)pFriend; pTalkMonster->ChangeSchedule( slIdleStopShooting ); } } } return CBaseMonster::TakeDamage(pevInflictor, pevAttacker, flDamage, bitsDamageType); }