diff --git a/source/basecode.cpp b/source/basecode.cpp index 087f164..fff6607 100644 --- a/source/basecode.cpp +++ b/source/basecode.cpp @@ -391,7 +391,7 @@ void Bot::checkBreakable (edict_t *touch) { m_breakableEntity = lookupBreakable (); if (game.isNullEntity (m_breakableEntity)) { -return; + return; } m_campButtons = pev->button & IN_DUCK; startTask (Task::ShootBreakable, TaskPri::ShootBreakable, kInvalidNodeIndex, 0.0f, false); @@ -3038,7 +3038,7 @@ void Bot::normal_ () { m_prevGoalIndex = kInvalidNodeIndex; // spray logo sometimes if allowed to do so - if (m_timeLogoSpray < game.time () && yb_spraypaints.bool_ () && rg.chance (60) && m_moveSpeed > getShiftSpeed () && game.isNullEntity (m_pickupItem)) { + if (!(m_states & (Sense::SeeingEnemy | Sense::SuspectEnemy)) && m_seeEnemyTime + 5.0f < game.time () && !m_reloadState && m_timeLogoSpray < game.time () && yb_spraypaints.bool_ () && rg.chance (50) && m_moveSpeed > getShiftSpeed () && game.isNullEntity (m_pickupItem)) { if (!(game.mapIs (MapFlags::Demolition) && bots.isBombPlanted () && m_team == Team::CT)) { startTask (Task::Spraypaint, TaskPri::Spraypaint, kInvalidNodeIndex, game.time () + 1.0f, false); } diff --git a/source/combat.cpp b/source/combat.cpp index f87be3d..699f982 100644 --- a/source/combat.cpp +++ b/source/combat.cpp @@ -11,7 +11,7 @@ ConVar yb_shoots_thru_walls ("yb_shoots_thru_walls", "2", "Specifies whether bots able to fire at enemies behind the wall, if they hearing or suspecting them.", true, 0.0f, 3.0f); ConVar yb_ignore_enemies ("yb_ignore_enemies", "0", "Enables or disables searching world for enemies."); ConVar yb_check_enemy_rendering ("yb_check_enemy_rendering", "0", "Enables or disables checking enemy rendering flags. Useful for some mods."); - +ConVar yb_stab_close_enemies ("yb_stab_close_enemies", "1", "Enables or disables bot ability to stab the enemy with knife if bot is in good condition."); ConVar mp_friendlyfire ("mp_friendlyfire", nullptr, Var::NoRegister); int Bot::numFriendsNear (const Vector &origin, float radius) { @@ -883,7 +883,7 @@ void Bot::fireWeapons () { } // use knife if near and good difficulty (l33t dude!) - if (m_difficulty >= 3 && pev->health > 80.0f && !game.isNullEntity (enemy) && pev->health >= enemy->v.health && distance < 100.0f && !isOnLadder () && !isGroupOfEnemies (pev->origin)) { + if (yb_stab_close_enemies.bool_ () && m_difficulty >= 3 && pev->health > 80.0f && !game.isNullEntity (enemy) && pev->health >= enemy->v.health && distance < 100.0f && !isOnLadder () && !isGroupOfEnemies (pev->origin)) { selectWeapons (distance, selectIndex, selectId, choosenWeapon); return; }