fix: hostage code (#269)
fix: hostage code add: yb_random_knife_attacks cvar
This commit is contained in:
parent
0b5658c065
commit
f55ac6c5c4
5 changed files with 100 additions and 8 deletions
|
|
@ -79,9 +79,7 @@ int Bot::findBestGoal () {
|
|||
return findGoalPost (tactic, defensiveNodes, offensiveNodes);
|
||||
}
|
||||
else if (m_team == Team::CT && hasHostage ()) {
|
||||
tactic = 2;
|
||||
offensiveNodes = &graph.m_rescuePoints;
|
||||
|
||||
tactic = 4;
|
||||
return findGoalPost (tactic, defensiveNodes, offensiveNodes);
|
||||
}
|
||||
|
||||
|
|
@ -208,6 +206,31 @@ int Bot::findGoalPost (int tactic, IntArray *defensive, IntArray *offsensive) {
|
|||
postprocessGoals (graph.m_goalPoints, goalChoices);
|
||||
}
|
||||
}
|
||||
else if (tactic == 4 && !graph.m_rescuePoints.empty ()) // rescue goal
|
||||
{
|
||||
// force ct with hostage(s) to select closest rescue goal
|
||||
float minDist = kInfiniteDistance;
|
||||
int count = 0;
|
||||
|
||||
for (auto &point : graph.m_rescuePoints) {
|
||||
float distance = graph[point].origin.distanceSq (pev->origin);
|
||||
|
||||
if (distance < minDist) {
|
||||
goalChoices[count] = point;
|
||||
|
||||
if (++count > 3) {
|
||||
count = 0;
|
||||
}
|
||||
minDist = distance;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &choice : goalChoices) {
|
||||
if (choice == kInvalidNodeIndex) {
|
||||
choice = graph.m_rescuePoints.random ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!graph.exists (m_currentNodeIndex)) {
|
||||
m_currentNodeIndex = changePointIndex (findNearestNode ());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue