nav: avoid players that are in view cone only
This commit is contained in:
parent
abb50a64c4
commit
f22f495940
1 changed files with 11 additions and 5 deletions
|
|
@ -533,12 +533,18 @@ void Bot::doPlayerAvoidance (const Vector &normal) {
|
||||||
m_avoidAction = Dodge::None;
|
m_avoidAction = Dodge::None;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (m_avoidAction != Dodge::None) {
|
else {
|
||||||
if (m_avoidAction == Dodge::Left) {
|
if (util.getConeDeviation (ent (), m_hindrance->v.origin) < 0.8f) {
|
||||||
setStrafeSpeed (normal, pev->maxspeed);
|
return;
|
||||||
}
|
}
|
||||||
else if (m_avoidAction == Dodge::Right) {
|
|
||||||
setStrafeSpeed (normal, -pev->maxspeed);
|
if (m_avoidAction != Dodge::None) {
|
||||||
|
if (m_avoidAction == Dodge::Left) {
|
||||||
|
setStrafeSpeed (normal, pev->maxspeed);
|
||||||
|
}
|
||||||
|
else if (m_avoidAction == Dodge::Right) {
|
||||||
|
setStrafeSpeed (normal, -pev->maxspeed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const float interval = m_frameInterval * (!isDucking () && pev->velocity.lengthSq2d () > 0.0f ? 6.0f : 2.0f);
|
const float interval = m_frameInterval * (!isDucking () && pev->velocity.lengthSq2d () > 0.0f ? 6.0f : 2.0f);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue