mp/src/game/server/sdk/bots/sdk_bot.cpp
// here bot updates important info that is used multiple times along the thinking process
here bot updates important info that is used multiple times along the thinking process
here bot updates important info that is used multiple times along the thinking process
void CSDKBot::InfoGathering()
{
	if (!GetEnemy())
	{
		m_flBotToEnemyDist = 9999;
		m_flHeightDifToEnemy = 0;
		m_bEnemyOnSights = false;
		m_flDistTraveled += fabs(GetLocalVelocity().Length()); 
		return;
	}
	m_flBotToEnemyDist = (GetLocalOrigin() - GetEnemy()->GetLocalOrigin()).Length();
	trace_t tr;
	UTIL_TraceHull( EyePosition(), GetEnemy()->EyePosition() - Vector(0,0,20), -BotTestHull, BotTestHull, MASK_SHOT, this, COLLISION_GROUP_NONE, &tr );
	if( tr.m_pEnt == GetEnemy() ) 
		m_bEnemyOnSights = true;
	else
		m_bEnemyOnSights = false;
	m_bInRangeToAttack = (m_flBotToEnemyDist < m_flMinRangeAttack) && FInViewCone( GetEnemy() );
	m_flDistTraveled += fabs(GetLocalVelocity().Length()); 
	m_flHeightDifToEnemy = GetLocalOrigin().z - GetEnemy()->GetLocalOrigin().z;
}
void CSDKBot :: InfoGathering ( ) { if ( ! GetEnemy ( ) ) { m_flBotToEnemyDist = 9999 ; m_flHeightDifToEnemy = 0 ; m_bEnemyOnSights = false ; m_flDistTraveled += fabs ( GetLocalVelocity ( ) . Length ( ) ) ; return ; } m_flBotToEnemyDist = ( GetLocalOrigin ( ) - GetEnemy ( ) -> GetLocalOrigin ( ) ) . Length ( ) ; trace_t tr ; UTIL_TraceHull ( EyePosition ( ) , GetEnemy ( ) -> EyePosition ( ) - Vector ( 0 , 0 , 20 ) , - BotTestHull , BotTestHull , MASK_SHOT , this , COLLISION_GROUP_NONE , & tr ) ; if ( tr . m_pEnt == GetEnemy ( ) ) m_bEnemyOnSights = true ; else m_bEnemyOnSights = false ; m_bInRangeToAttack = ( m_flBotToEnemyDist < m_flMinRangeAttack ) && FInViewCone ( GetEnemy ( ) ) ; m_flDistTraveled += fabs ( GetLocalVelocity ( ) . Length ( ) ) ; m_flHeightDifToEnemy = GetLocalOrigin ( ) . z - GetEnemy ( ) -> GetLocalOrigin ( ) . z ; }
here bot updates important info that is used multiple times along the thinking process
here bot updates important info that is used multiple times along the thinking process
// this is used for stuck checking, // vision line between both // this is used for stuck checking,