bot: remove check for weapon switch time by now

This commit is contained in:
jeefo 2023-04-12 11:28:57 +03:00
commit 085c4aab85
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
4 changed files with 20 additions and 26 deletions

View file

@ -686,7 +686,6 @@ private:
float m_changeViewTime {}; // timestamp to change look at while at freezetime
float m_breakableTime {}; // breakeble acquired time
float m_jumpDistance {}; // last jump distance
float m_lastBadWeaponSwitchTime {}; // last time we're switched weapon as it's bad
bool m_moveToGoal {}; // bot currently moving to goal??
bool m_isStuck {}; // bot is stuck

View file

@ -1599,7 +1599,7 @@ void Bot::overrideConditions () {
}
// special handling for reloading
if (getCurrentTaskId () == Task::Normal && m_reloadState != Reload::None && m_isReloading && !isInNarrowPlace ()) {
if (getCurrentTaskId () == Task::Normal && m_reloadState != Reload::None && m_isReloading && !isDucking () && !isInNarrowPlace ()) {
if (m_seeEnemyTime + 2.5f < game.time () && (m_states & (Sense::SuspectEnemy | Sense::HearingEnemy))) {
m_moveSpeed = m_fearLevel > m_agressionLevel ? 0.0f : getShiftSpeed ();
m_navTimeset = game.time ();

View file

@ -1023,34 +1023,30 @@ bool Bot::isWeaponBadAtDistance (int weaponIndex, float distance) {
// to attack our enemy, since current weapon is not very good in this situation.
// do not switch weapons when crossing the distance line
if (m_lastBadWeaponSwitchTime + 3.0f < game.time ()) {
auto &info = conf.getWeapons ();
auto &info = conf.getWeapons ();
if (m_difficulty < Difficulty::Normal || !hasSecondaryWeapon ()) {
return false;
}
auto weaponType = info[weaponIndex].type;
if (m_difficulty < Difficulty::Normal || !hasSecondaryWeapon ()) {
return false;
}
auto weaponType = info[weaponIndex].type;
if (weaponType == WeaponType::Melee) {
return false;
}
if (weaponType == WeaponType::Melee) {
return false;
}
// check is ammo available for secondary weapon
if (m_ammoInClip[info[bestSecondaryCarried ()].id] >= 3) {
return false;
}
// check is ammo available for secondary weapon
if (m_ammoInClip[info[bestSecondaryCarried ()].id] >= 3) {
return false;
}
// better use pistol in short range distances, when using sniper weapons
if (weaponType == WeaponType::Sniper && distance < 400.0f) {
m_lastBadWeaponSwitchTime = game.time ();
return true;
}
// better use pistol in short range distances, when using sniper weapons
if (weaponType == WeaponType::Sniper && distance < 400.0f) {
return true;
}
// shotguns is too inaccurate at long distances, so weapon is bad
if (weaponType == WeaponType::Shotgun && distance > 750.0f) {
m_lastBadWeaponSwitchTime = game.time ();
return true;
}
// shotguns is too inaccurate at long distances, so weapon is bad
if (weaponType == WeaponType::Shotgun && distance > 750.0f) {
return true;
}
return false;
}

View file

@ -1411,7 +1411,6 @@ void Bot::newRound () {
m_combatStrafeDir = Dodge::None;
m_fightStyle = Fight::None;
m_lastFightStyleCheck = 0.0f;
m_lastBadWeaponSwitchTime = 0.0f;
m_checkWeaponSwitch = true;
m_checkKnifeSwitch = true;