nav: allow bots to duck on goal and camp nodes if it's a route end
This commit is contained in:
parent
cc01693de9
commit
b790e7a4bb
1 changed files with 7 additions and 3 deletions
|
|
@ -819,8 +819,12 @@ void Bot::moveToGoal () {
|
||||||
findValidNode ();
|
findValidNode ();
|
||||||
|
|
||||||
// press duck button if we need to
|
// press duck button if we need to
|
||||||
if ((m_pathFlags & NodeFlag::Crouch) && !(m_pathFlags & (NodeFlag::Camp | NodeFlag::Goal))) {
|
if (m_pathFlags & NodeFlag::Crouch) {
|
||||||
pev->button |= IN_DUCK;
|
constexpr auto kEndRouteThreshold = 3;
|
||||||
|
|
||||||
|
if (!(m_pathFlags & (NodeFlag::Camp | NodeFlag::Goal)) || m_pathWalk.length () < kEndRouteThreshold) {
|
||||||
|
pev->button |= IN_DUCK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_lastUsedNodesTime = game.time ();
|
m_lastUsedNodesTime = game.time ();
|
||||||
|
|
||||||
|
|
@ -1114,7 +1118,7 @@ bool Bot::updateNavigation () {
|
||||||
}
|
}
|
||||||
|
|
||||||
float desiredDistanceSq = cr::sqrf (4.0f);
|
float desiredDistanceSq = cr::sqrf (4.0f);
|
||||||
const float nodeDistanceSq = pev->origin.distanceSq2d (m_pathOrigin);
|
const float nodeDistanceSq = pev->origin.distanceSq (m_pathOrigin);
|
||||||
|
|
||||||
// initialize the radius for a special node type, where the node is considered to be reached
|
// initialize the radius for a special node type, where the node is considered to be reached
|
||||||
if (m_pathFlags & NodeFlag::Lift) {
|
if (m_pathFlags & NodeFlag::Lift) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue