Exemple #1
0
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 );
}
Exemple #2
0
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);
}