Limit bot vision distance to the farplane

This commit is contained in:
smallmodel 2024-10-02 19:41:25 +02:00
parent 123ca2812a
commit 30f5442728
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512

View file

@ -1080,6 +1080,7 @@ static int sentients_compare(const void *elem1, const void *elem2)
bool PlayerBot::CheckCondition_Attack(void)
{
Container<Sentient *> sents = SentientList;
float maxDistance = 0;
bot_origin = origin;
sents.Sort(sentients_compare);
@ -1110,7 +1111,9 @@ bool PlayerBot::CheckCondition_Attack(void)
}
}
if (CanSee(sent, 80, world->m_fAIVisionDistance, false)) {
maxDistance = Q_min(world->m_fAIVisionDistance, world->farplane_distance * 0.828);
if (CanSee(sent, 80, maxDistance, false)) {
m_pEnemy = sent;
m_iAttackTime = level.inttime + 10000;
return true;