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_changeViewTime {}; // timestamp to change look at while at freezetime
float m_breakableTime {}; // breakeble acquired time float m_breakableTime {}; // breakeble acquired time
float m_jumpDistance {}; // last jump distance 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_moveToGoal {}; // bot currently moving to goal??
bool m_isStuck {}; // bot is stuck bool m_isStuck {}; // bot is stuck

View file

@ -1599,7 +1599,7 @@ void Bot::overrideConditions () {
} }
// special handling for reloading // 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))) { if (m_seeEnemyTime + 2.5f < game.time () && (m_states & (Sense::SuspectEnemy | Sense::HearingEnemy))) {
m_moveSpeed = m_fearLevel > m_agressionLevel ? 0.0f : getShiftSpeed (); m_moveSpeed = m_fearLevel > m_agressionLevel ? 0.0f : getShiftSpeed ();
m_navTimeset = game.time (); m_navTimeset = game.time ();

View file

@ -1023,7 +1023,6 @@ bool Bot::isWeaponBadAtDistance (int weaponIndex, float distance) {
// to attack our enemy, since current weapon is not very good in this situation. // to attack our enemy, since current weapon is not very good in this situation.
// do not switch weapons when crossing the distance line // 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 ()) { if (m_difficulty < Difficulty::Normal || !hasSecondaryWeapon ()) {
@ -1042,16 +1041,13 @@ bool Bot::isWeaponBadAtDistance (int weaponIndex, float distance) {
// better use pistol in short range distances, when using sniper weapons // better use pistol in short range distances, when using sniper weapons
if (weaponType == WeaponType::Sniper && distance < 400.0f) { if (weaponType == WeaponType::Sniper && distance < 400.0f) {
m_lastBadWeaponSwitchTime = game.time ();
return true; return true;
} }
// shotguns is too inaccurate at long distances, so weapon is bad // shotguns is too inaccurate at long distances, so weapon is bad
if (weaponType == WeaponType::Shotgun && distance > 750.0f) { if (weaponType == WeaponType::Shotgun && distance > 750.0f) {
m_lastBadWeaponSwitchTime = game.time ();
return true; return true;
} }
}
return false; return false;
} }

View file

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