bot: always remove bomb entities from ignore item list
This commit is contained in:
parent
8c0e603e55
commit
78d9e88caf
2 changed files with 12 additions and 2 deletions
|
|
@ -263,7 +263,7 @@ public:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// simple accessor to c4 model name
|
// simple accessors to c4 model name
|
||||||
StringRef getBombModelName () {
|
StringRef getBombModelName () {
|
||||||
return fetchCustom ("C4ModelName");
|
return fetchCustom ("C4ModelName");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,11 @@ int Bot::findBestGoalWhenBombAction () {
|
||||||
result = graph.getNearest (game.getEntityOrigin (ent));
|
result = graph.getNearest (game.getEntityOrigin (ent));
|
||||||
|
|
||||||
if (graph.exists (result)) {
|
if (graph.exists (result)) {
|
||||||
|
|
||||||
|
// if bomb entity is bot's ignore list, clear ignore list
|
||||||
|
if (isIgnoredItem (ent)) {
|
||||||
|
m_ignoredItems.clear ();
|
||||||
|
}
|
||||||
return EntitySearchResult::Break;
|
return EntitySearchResult::Break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3158,11 +3163,16 @@ int Bot::getNearestToPlantedBomb () {
|
||||||
auto result = kInvalidNodeIndex;
|
auto result = kInvalidNodeIndex;
|
||||||
|
|
||||||
// search the bomb on the map
|
// search the bomb on the map
|
||||||
game.searchEntities ("classname", "grenade", [&result, &bombModel] (edict_t *ent) {
|
game.searchEntities ("classname", "grenade", [&] (edict_t *ent) {
|
||||||
if (util.isModel (ent, bombModel)) {
|
if (util.isModel (ent, bombModel)) {
|
||||||
result = graph.getNearest (game.getEntityOrigin (ent));
|
result = graph.getNearest (game.getEntityOrigin (ent));
|
||||||
|
|
||||||
if (graph.exists (result)) {
|
if (graph.exists (result)) {
|
||||||
|
|
||||||
|
// if bomb entity is bot's ignore list, clear ignore list
|
||||||
|
if (isIgnoredItem (ent)) {
|
||||||
|
m_ignoredItems.clear ();
|
||||||
|
}
|
||||||
return EntitySearchResult::Break;
|
return EntitySearchResult::Break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue