bot: perform a seek cover search mission to avoid infected creatures. (#707)

bot: perform a seek cover search mission to avoid infected creatures.
nav: several changes in controlling the terrain.
This commit is contained in:
commandcobra7 2025-08-06 15:44:07 +03:00 committed by GitHub
commit 286e1c8621
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 155 additions and 114 deletions

View file

@ -121,7 +121,7 @@ void Bot::normal_ () {
if (allowedCampWeapon && m_timeCamping + 10.0f < game.time () && !m_hasHostage) {
bool campingAllowed = true;
// Check if it's not allowed for this team to camp here
// check if it's not allowed for this team to camp here
if (m_team == Team::Terrorist) {
if (m_pathFlags & NodeFlag::CTOnly) {
campingAllowed = false;
@ -134,27 +134,20 @@ void Bot::normal_ () {
}
// don't allow vip on as_ maps to camp + don't allow terrorist carrying c4 to camp
if (campingAllowed
&& (m_isVIP || (game.mapIs (MapFlags::Demolition) && m_team == Team::Terrorist && !bots.isBombPlanted () && m_hasC4))) {
if (m_isVIP || (game.mapIs (MapFlags::Demolition) && m_team == Team::Terrorist && !bots.isBombPlanted () && m_hasC4)) {
campingAllowed = false;
}
// check if another bot is already camping here
if (campingAllowed && isOccupiedNode (m_currentNodeIndex)) {
if (isOccupiedNode (m_currentNodeIndex)) {
campingAllowed = false;
}
// skip sniper node if we don't have sniper weapon
if (campingAllowed && !usesSniper () && (m_pathFlags & NodeFlag::Sniper)) {
if (!usesSniper () && (m_pathFlags & NodeFlag::Sniper)) {
campingAllowed = false;
}
// if the bot is about to come to the camp spot, but there is already someone else camping
if (!campingAllowed && getTask ()->data == m_currentNodeIndex && getTask ()->data != kInvalidNodeIndex) {
clearSearchNodes ();
getTask ()->data = kInvalidNodeIndex;
}
if (campingAllowed) {
// crouched camping here?
if (m_pathFlags & NodeFlag::Crouch) {
@ -406,13 +399,12 @@ void Bot::huntEnemy_ () {
}
// bots skill higher than 60?
if (cv_walking_allowed && mp_footsteps && m_difficulty >= Difficulty::Normal && !isKnifeMode ()) {
if (cv_walking_allowed && mp_footsteps && m_difficulty >= Difficulty::Normal) {
// then make him move slow if near enemy
if (!(m_currentTravelFlags & PathFlag::Jump)) {
if (m_currentNodeIndex != kInvalidNodeIndex) {
if (m_path->radius < 32.0f && !isOnLadder () && !isInWater () && m_seeEnemyTime + 4.0f > game.time ()) {
m_moveSpeed = getShiftSpeed ();
}
if (m_currentNodeIndex != kInvalidNodeIndex && !(m_currentTravelFlags & PathFlag::Jump)) {
if (m_path->radius < 32.0f && !isOnLadder () && !isInWater () && m_seeEnemyTime + 4.0f > game.time ()) {
m_moveSpeed = getShiftSpeed ();
}
}
}
@ -623,7 +615,7 @@ void Bot::blind_ () {
}
void Bot::camp_ () {
if (!cv_camping_allowed || m_isCreature) {
if (!cv_camping_allowed || isKnifeMode ()) {
completeTask ();
return;
}
@ -1480,7 +1472,7 @@ void Bot::shootBreakable_ () {
m_ignoredBreakable.push (tr.pHit);
m_breakableEntity = nullptr;
m_breakableOrigin = nullptr;
m_breakableOrigin.clear ();
completeTask ();
return;
@ -1514,7 +1506,7 @@ void Bot::shootBreakable_ () {
// if with knife with no ammo, recompute breakable distance
if (!hasAnyAmmoInClip ()
&& usesKnife ()
&& distToObstacle > cr::sqrf (72.0f)) {
&& distToObstacle > cr::sqrf (32.0f)) {
completeTask ();
}