fixed shooting at guy behind shield
thank goes to KWo
This commit is contained in:
parent
2b005a6a98
commit
c12437689c
3 changed files with 12 additions and 28 deletions
|
|
@ -277,12 +277,12 @@ public:
|
|||
|
||||
inline int Long (int low, int high)
|
||||
{
|
||||
return static_cast <int> (Random () * (static_cast <double> (high)-static_cast <double> (low)+1.0) / m_divider + static_cast <double> (low));
|
||||
return static_cast <int> (Random () * (static_cast <double> (high) - static_cast <double> (low) + 1.0) / m_divider + static_cast <double> (low));
|
||||
}
|
||||
|
||||
inline float Float (float low, float high)
|
||||
{
|
||||
return static_cast <float> (Random () * (static_cast <double> (high)-static_cast <double> (low)) / (m_divider - 1) + static_cast <double> (low));
|
||||
return static_cast <float> (Random () * (static_cast <double> (high) - static_cast <double> (low)) / (m_divider - 1) + static_cast <double> (low));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <core.h>
|
||||
|
||||
ConVar yb_shoots_thru_walls ("yb_shoots_thru_walls", "1");
|
||||
ConVar yb_shoots_thru_walls ("yb_shoots_thru_walls", "2");
|
||||
ConVar yb_ignore_enemies ("yb_ignore_enemies", "0");
|
||||
ConVar yb_csdm_mode ("yb_csdm_mode", "0", VT_NOSERVER);
|
||||
|
||||
|
|
@ -128,9 +128,6 @@ bool Bot::LookupEnemy (void)
|
|||
|
||||
if (distance < nearestDistance)
|
||||
{
|
||||
if (IsEnemyProtectedByShield (player))
|
||||
continue;
|
||||
|
||||
nearestDistance = distance;
|
||||
newEnemy = player;
|
||||
|
||||
|
|
@ -537,6 +534,12 @@ bool Bot::DoFirePause (float distance, FireDelay *fireDelay)
|
|||
if (m_firePause > GetWorldTime ())
|
||||
return true;
|
||||
|
||||
if ((m_aimFlags & AIM_ENEMY) && m_enemyOrigin != nullvec)
|
||||
{
|
||||
if (IsEnemyProtectedByShield (m_enemy) && GetShootingConeDeviation (GetEntity (), &m_enemyOrigin) > 0.92f)
|
||||
return true;
|
||||
}
|
||||
|
||||
float offset = 0.0f;
|
||||
const float BurstDistance = 300.0f;
|
||||
|
||||
|
|
@ -932,9 +935,6 @@ void Bot::CombatFight (void)
|
|||
if ((m_states & STATE_SEEING_ENEMY) && !m_hasC4)
|
||||
StartTask (TASK_SEEKCOVER, TASKPRI_SEEKCOVER, -1, Random.Long (10, 20), true);
|
||||
}
|
||||
// If using sniper do not jump around !
|
||||
if (UsesSniper () && m_states & STATE_SEEING_ENEMY || IsEnemyViewable (m_enemy) && !m_isStuck)
|
||||
pev->button &= ~IN_JUMP;
|
||||
|
||||
// only take cover when bomb is not planted and enemy can see the bot or the bot is VIP
|
||||
if (approach < 30 && !g_bombPlanted && (IsInViewCone (m_enemy->v.origin) || m_isVIP))
|
||||
|
|
@ -1040,10 +1040,10 @@ void Bot::CombatFight (void)
|
|||
}
|
||||
}
|
||||
|
||||
if (m_difficulty >= 3 && (m_jumpTime + 5.0 < GetWorldTime () && IsOnFloor () && Random.Long (0, 1000) < (m_isReloading ? 8 : 2) && pev->velocity.GetLength2D () > 150.0))
|
||||
if (m_difficulty >= 3 && (m_jumpTime + 5.0 < GetWorldTime () && IsOnFloor () && Random.Long (0, 1000) < (m_isReloading ? 8 : 2) && pev->velocity.GetLength2D () > 150.0) && !UsesSniper ())
|
||||
pev->button |= IN_JUMP;
|
||||
|
||||
if (m_moveSpeed > 0.0 && distance > 150.0 && m_currentWeapon != WEAPON_KNIFE)
|
||||
if (m_moveSpeed > 0.0 && distance > 100.0 && m_currentWeapon != WEAPON_KNIFE)
|
||||
m_moveSpeed = 0.0;
|
||||
|
||||
if (m_currentWeapon == WEAPON_KNIFE)
|
||||
|
|
@ -1133,7 +1133,7 @@ bool Bot::IsEnemyProtectedByShield (edict_t *enemy)
|
|||
{
|
||||
// this function returns true, if enemy protected by the shield
|
||||
|
||||
if (IsEntityNull (enemy) || (HasShield () && IsShieldDrawn ()))
|
||||
if (IsEntityNull (enemy) || IsShieldDrawn ())
|
||||
return false;
|
||||
|
||||
// check if enemy has shield and this shield is drawn
|
||||
|
|
|
|||
|
|
@ -186,22 +186,6 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c
|
|||
}
|
||||
}
|
||||
|
||||
// some debug routines
|
||||
else if (stricmp (arg0, "debug") == 0)
|
||||
{
|
||||
// test random number generator
|
||||
if (stricmp (arg0, "randgen") == 0)
|
||||
{
|
||||
for (int i = 0; i < 500; i++)
|
||||
ServerPrint ("Result Range[0 - 100]: %d", Random.Long (0, 100));
|
||||
}
|
||||
#if defined (MMGR_H)
|
||||
// dump memory information
|
||||
else if (stricmp (arg0, "memrep") == 0)
|
||||
m_dumpMemoryReport ();
|
||||
#endif
|
||||
}
|
||||
|
||||
// waypoint manimupulation (really obsolete, can be edited through menu) (supported only on listen server)
|
||||
else if (stricmp (arg0, "waypoint") == 0 || stricmp (arg0, "wp") == 0 || stricmp (arg0, "wpt") == 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue