fix: texts have been corrected. (#477)

task: normal: skip sniper node if no sniper weapon.
task: normal: don't walk if there are no enemies left and they are using knives.
task: attack: get proper function if bots lose close node after attack task.
nav: unnecessary codes cleared.
combat: attack movements reviewed.
bot: enemy hearing is now better. (thanks for the @spodlesniy idea)
desire: increased desire to seek cover by distance. (made for zombie plague mod)
---------
Co-authored-by: jeefo <jeefo@rwsh.ru>
This commit is contained in:
commandcobra7 2023-09-10 11:12:15 +03:00 committed by GitHub
commit ae9beff151
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 92 additions and 84 deletions

View file

@ -13,6 +13,8 @@ ConVar cv_camping_allowed ("camping_allowed", "1", "Allows or disallows bots to
ConVar cv_camping_time_min ("camping_time_min", "15.0", "Lower bound of time from which time for camping is calculated", true, 5.0f, 90.0f);
ConVar cv_camping_time_max ("camping_time_max", "45.0", "Upper bound of time until which time for camping is calculated", true, 15.0f, 120.0f);
ConVar cv_random_knife_attacks ("random_knife_attacks", "1", "Allows or disallows the ability for random knife attacks when bot is rushing and no enemy is nearby.");
void Bot::normal_ () {
m_aimFlags |= AimFlags::Nav;
@ -95,6 +97,11 @@ void Bot::normal_ () {
campingAllowed = false;
}
// skip sniper node if we don't have sniper weapon
if (campingAllowed && !usesSniper () && (m_pathFlags & NodeFlag::Sniper)) {
campingAllowed = false;
}
if (campingAllowed) {
// crouched camping here?
if (m_pathFlags & NodeFlag::Crouch) {
@ -446,7 +453,11 @@ void Bot::attackEnemy_ () {
}
else {
completeTask ();
m_destOrigin = m_lastEnemyOrigin;
findNextBestNode ();
if (!m_lastEnemyOrigin.empty ()) {
m_destOrigin = m_lastEnemyOrigin;
}
}
m_navTimeset = game.time ();
}
@ -1034,7 +1045,7 @@ void Bot::followUser_ () {
// didn't choose goal node yet?
if (!hasActiveGoal ()) {
int destIndex = graph.getNearest (m_targetEntity->v.origin);
auto points = graph.getNarestInRadius (200.0f, m_targetEntity->v.origin);
auto points = graph.getNearestInRadius (200.0f, m_targetEntity->v.origin);
for (auto &newIndex : points) {
// if node not yet used, assign it as dest
@ -1560,7 +1571,7 @@ void Bot::pickupItem_ () {
int nearestHostageNodeIndex = kInvalidNodeIndex;
// find the nearest 'unused' hostage within the area
game.searchEntities (pev->origin, 768.0f, [&] (edict_t *ent) {
game.searchEntities (pev->origin, 1024.0f, [&] (edict_t *ent) {
if (!util.isHostageEntity (ent)) {
return EntitySearchResult::Continue;
}