bot: minor tweak to button selection while with knife

This commit is contained in:
jeefo 2023-04-13 23:02:00 +03:00
commit c856b55302
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED

View file

@ -886,7 +886,9 @@ void Bot::selectWeapons (float distance, int index, int id, int choosen) {
if (distance < kSprayDistance || m_blindTime > game.time () || usesKnife ()) { if (distance < kSprayDistance || m_blindTime > game.time () || usesKnife ()) {
if (id == Weapon::Knife) { if (id == Weapon::Knife) {
if (distance < 64.0f) { if (distance < 64.0f) {
if (rg.chance (40) || hasShield ()) { const auto primaryAtackChance = (m_oldButtons & IN_ATTACK2) ? 80 : 40;
if (rg.chance (primaryAtackChance) || hasShield ()) {
pev->button |= IN_ATTACK; // use primary attack pev->button |= IN_ATTACK; // use primary attack
} }
else { else {