removed brain-damaged shield-code
This commit is contained in:
parent
0314cee6d3
commit
46a46b4b24
2 changed files with 31 additions and 71 deletions
|
|
@ -104,7 +104,7 @@ bool Bot::CheckVisibility (entvars_t *targetEntity, Vector *origin, byte *bodyPa
|
||||||
{
|
{
|
||||||
// this function checks visibility of a bot target.
|
// this function checks visibility of a bot target.
|
||||||
|
|
||||||
Vector botHead = EyePosition ();
|
const Vector &botHead = EyePosition ();
|
||||||
TraceResult tr;
|
TraceResult tr;
|
||||||
|
|
||||||
*bodyPart = 0;
|
*bodyPart = 0;
|
||||||
|
|
@ -2896,11 +2896,11 @@ void Bot::ChooseAimDirection (void)
|
||||||
GetValidWaypoint ();
|
GetValidWaypoint ();
|
||||||
|
|
||||||
// check if last enemy vector valid
|
// check if last enemy vector valid
|
||||||
if (m_lastEnemyOrigin != nullvec)
|
if (m_seeEnemyTime + 7.0 < GetWorldTime () && m_lastEnemyOrigin != nullvec)
|
||||||
{
|
{
|
||||||
TraceLine (EyePosition (), m_lastEnemyOrigin, false, true, GetEntity (), &tr);
|
TraceLine (EyePosition (), m_lastEnemyOrigin, false, true, GetEntity (), &tr);
|
||||||
|
|
||||||
if ((pev->origin - m_lastEnemyOrigin).GetLength () >= 1600 && IsEntityNull (m_enemy) && !UsesSniper () || (tr.flFraction <= 0.2 && tr.pHit == g_hostEntity) && m_seeEnemyTime + 7.0 < GetWorldTime ())
|
if ((pev->origin - m_lastEnemyOrigin).GetLength () >= 1600 && IsEntityNull (m_enemy) && !UsesSniper () || (tr.flFraction <= 0.2 && tr.pHit == g_hostEntity))
|
||||||
{
|
{
|
||||||
if ((m_aimFlags & (AIM_LAST_ENEMY | AIM_PREDICT_PATH)) && m_wantsToFire)
|
if ((m_aimFlags & (AIM_LAST_ENEMY | AIM_PREDICT_PATH)) && m_wantsToFire)
|
||||||
m_wantsToFire = false;
|
m_wantsToFire = false;
|
||||||
|
|
@ -2909,12 +2909,13 @@ void Bot::ChooseAimDirection (void)
|
||||||
m_aimFlags &= ~(AIM_LAST_ENEMY | AIM_PREDICT_PATH);
|
m_aimFlags &= ~(AIM_LAST_ENEMY | AIM_PREDICT_PATH);
|
||||||
|
|
||||||
flags &= ~(AIM_LAST_ENEMY | AIM_PREDICT_PATH);
|
flags &= ~(AIM_LAST_ENEMY | AIM_PREDICT_PATH);
|
||||||
|
flags = m_aimFlags;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_aimFlags &= ~(AIM_LAST_ENEMY | AIM_PREDICT_PATH);
|
m_aimFlags &= ~(AIM_LAST_ENEMY | AIM_PREDICT_PATH);
|
||||||
flags &= ~(AIM_LAST_ENEMY | AIM_PREDICT_PATH);
|
flags = m_aimFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't allow bot to look at danger positions under certain circumstances
|
// don't allow bot to look at danger positions under certain circumstances
|
||||||
|
|
@ -4853,32 +4854,34 @@ void Bot::BotAI (void)
|
||||||
SetConditions ();
|
SetConditions ();
|
||||||
|
|
||||||
// some stuff required by by chatter engine
|
// some stuff required by by chatter engine
|
||||||
if ((m_states & STATE_SEEING_ENEMY) && !IsEntityNull (m_enemy))
|
if (yb_communication_type.GetInt () == 2)
|
||||||
{
|
{
|
||||||
if (Random.Long (0, 100) < 45 && GetNearbyFriendsNearPosition (pev->origin, 512) == 0 && (m_enemy->v.weapons & (1 << WEAPON_C4)))
|
if ((m_states & STATE_SEEING_ENEMY) && !IsEntityNull (m_enemy))
|
||||||
ChatterMessage (Chatter_SpotTheBomber);
|
{
|
||||||
|
if (Random.Long (0, 100) < 45 && GetNearbyFriendsNearPosition (pev->origin, 512) == 0 && (m_enemy->v.weapons & (1 << WEAPON_C4)))
|
||||||
|
ChatterMessage (Chatter_SpotTheBomber);
|
||||||
|
|
||||||
if (Random.Long (0, 100) < 45 && m_team == TEAM_TF && GetNearbyFriendsNearPosition (pev->origin, 512) == 0 && *g_engfuncs.pfnInfoKeyValue (g_engfuncs.pfnGetInfoKeyBuffer (m_enemy), "model") == 'v')
|
if (Random.Long (0, 100) < 45 && m_team == TEAM_TF && GetNearbyFriendsNearPosition (pev->origin, 512) == 0 && *g_engfuncs.pfnInfoKeyValue (g_engfuncs.pfnGetInfoKeyBuffer (m_enemy), "model") == 'v')
|
||||||
ChatterMessage (Chatter_VIPSpotted);
|
ChatterMessage (Chatter_VIPSpotted);
|
||||||
|
|
||||||
if (Random.Long (0, 100) < 50 && GetNearbyFriendsNearPosition (pev->origin, 450) == 0 && GetTeam (m_enemy) != m_team && IsGroupOfEnemies (m_enemy->v.origin, 2, 384))
|
if (Random.Long (0, 100) < 50 && GetNearbyFriendsNearPosition (pev->origin, 450) == 0 && GetTeam (m_enemy) != m_team && IsGroupOfEnemies (m_enemy->v.origin, 2, 384))
|
||||||
ChatterMessage (Chatter_ScaredEmotion);
|
ChatterMessage (Chatter_ScaredEmotion);
|
||||||
|
|
||||||
if (Random.Long (0, 100) < 40 && GetNearbyFriendsNearPosition (pev->origin, 1024) == 0 && ((m_enemy->v.weapons & (1 << WEAPON_AWP)) || (m_enemy->v.weapons & (1 << WEAPON_SCOUT)) || (m_enemy->v.weapons & (1 << WEAPON_G3SG1)) || (m_enemy->v.weapons & (1 << WEAPON_SG550))))
|
if (Random.Long (0, 100) < 40 && GetNearbyFriendsNearPosition (pev->origin, 1024) == 0 && ((m_enemy->v.weapons & (1 << WEAPON_AWP)) || (m_enemy->v.weapons & (1 << WEAPON_SCOUT)) || (m_enemy->v.weapons & (1 << WEAPON_G3SG1)) || (m_enemy->v.weapons & (1 << WEAPON_SG550))))
|
||||||
ChatterMessage (Chatter_SniperWarning);
|
ChatterMessage (Chatter_SniperWarning);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if bot is trapped under shield yell for help !
|
||||||
|
if (GetTaskId () == TASK_CAMP && HasShield () && IsShieldDrawn () && GetNearbyEnemiesNearPosition (pev->origin, 650) >= 2 && IsEnemyViewable (m_enemy))
|
||||||
|
InstantChatterMessage (Chatter_Pinned_Down);
|
||||||
|
|
||||||
|
// if bomb planted warn teammates !
|
||||||
|
if (g_canSayBombPlanted && g_bombPlanted && GetTeam (GetEntity ()) == TEAM_CF)
|
||||||
|
{
|
||||||
|
g_canSayBombPlanted = false;
|
||||||
|
ChatterMessage (Chatter_GottaFindTheBomb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if bot is trapped under shield yell for help !
|
|
||||||
if (GetTaskId () == TASK_CAMP && HasShield() && IsShieldDrawn () && GetNearbyEnemiesNearPosition (pev->origin, 650) >= 2 && IsEnemyViewable(m_enemy))
|
|
||||||
InstantChatterMessage(Chatter_Pinned_Down);
|
|
||||||
|
|
||||||
// if bomb planted warn teammates !
|
|
||||||
if (g_canSayBombPlanted && g_bombPlanted && GetTeam (GetEntity()) == TEAM_CF)
|
|
||||||
{
|
|
||||||
g_canSayBombPlanted = false;
|
|
||||||
ChatterMessage (Chatter_GottaFindTheBomb);
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector src, destination;
|
Vector src, destination;
|
||||||
|
|
||||||
m_checkTerrain = true;
|
m_checkTerrain = true;
|
||||||
|
|
@ -5781,7 +5784,7 @@ byte Bot::ThrottledMsec (void)
|
||||||
|
|
||||||
if (newMsec < 10)
|
if (newMsec < 10)
|
||||||
{
|
{
|
||||||
msecVal = msecVal - static_cast <float> (newMsec) + m_msecValRest;
|
msecVal -= static_cast <float> (newMsec) + m_msecValRest;
|
||||||
msecRest = static_cast <int> (msecVal);
|
msecRest = static_cast <int> (msecVal);
|
||||||
|
|
||||||
m_msecValRest = msecVal - static_cast <float> (msecRest);
|
m_msecValRest = msecVal - static_cast <float> (msecRest);
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ bool Bot::LookupEnemy (void)
|
||||||
|
|
||||||
if (friendBot != NULL)
|
if (friendBot != NULL)
|
||||||
{
|
{
|
||||||
if (friendBot->m_seeEnemyTime + 2.0 < GetWorldTime () || IsEntityNull (friendBot->m_lastEnemy))
|
if (friendBot->m_seeEnemyTime + 2.0f < GetWorldTime () || IsEntityNull (friendBot->m_lastEnemy))
|
||||||
{
|
{
|
||||||
if (IsVisible (pev->origin, ENT (friendBot->pev)))
|
if (IsVisible (pev->origin, ENT (friendBot->pev)))
|
||||||
{
|
{
|
||||||
|
|
@ -648,49 +648,6 @@ void Bot::FireWeapon (void)
|
||||||
selectId = WEAPON_KNIFE; // no available ammo, use knife!
|
selectId = WEAPON_KNIFE; // no available ammo, use knife!
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore enemies protected by shields
|
|
||||||
if (IsEnemyProtectedByShield (m_enemy) && !(m_currentWeapon == WEAPON_KNIFE) && IsEnemyViewable (m_enemy))
|
|
||||||
{
|
|
||||||
if (!g_bombPlanted && Random.Float (0, 100) < 50)
|
|
||||||
StartTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + Random.Float (5, 10), true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if bot has shield
|
|
||||||
if (HasShield () && m_shieldCheckTime < GetWorldTime () && GetTaskId () != TASK_CAMP && IsEnemyViewable (m_enemy))
|
|
||||||
{
|
|
||||||
if (IsGroupOfEnemies (pev->origin, 3, 750) && !IsShieldDrawn () && !g_bombPlanted)
|
|
||||||
StartTask (TASK_SEEKCOVER, TASKPRI_SEEKCOVER, -1, GetWorldTime () + Random.Float (10, 20), true);
|
|
||||||
|
|
||||||
if (distance >= 750 || ((m_enemy->v.button & IN_ATTACK) && !IsShieldDrawn()))
|
|
||||||
{
|
|
||||||
pev->button |= IN_ATTACK2; // draw the shield
|
|
||||||
pev->button &= ~IN_DUCK;
|
|
||||||
|
|
||||||
if (IsGroupOfEnemies (pev->origin, 3, 550) || (GetNearbyEnemiesNearPosition (pev->origin, 550) >= 3 && IsShieldDrawn ()))
|
|
||||||
{
|
|
||||||
ChooseAimDirection();
|
|
||||||
FacePosition ();
|
|
||||||
}
|
|
||||||
else if(!g_bombPlanted)
|
|
||||||
StartTask (TASK_CAMP, TASKPRI_PAUSE, -1, GetWorldTime () + Random.Float (10, 20), true);
|
|
||||||
|
|
||||||
if (IsEnemyProtectedByShield (m_lastEnemy) && !(m_currentWeapon == WEAPON_KNIFE) && IsEnemyViewable (m_lastEnemy))
|
|
||||||
{
|
|
||||||
pev->button &= ~IN_ATTACK;
|
|
||||||
StartTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + Random.Float (10, 20), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (IsShieldDrawn () || (!IsEntityNull (m_enemy) && (m_enemy->v.button & IN_RELOAD) || !IsEnemyViewable (m_enemy)))
|
|
||||||
{
|
|
||||||
pev->button |= (IN_ATTACK2 | IN_DUCK); // draw out the shield
|
|
||||||
|
|
||||||
if (!g_bombPlanted)
|
|
||||||
StartTask (TASK_SEEKCOVER, TASKPRI_SEEKCOVER, -1, GetWorldTime () + Random.Float (10, 25), true);
|
|
||||||
}
|
|
||||||
m_shieldCheckTime = GetWorldTime () + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
WeaponSelectEnd:
|
WeaponSelectEnd:
|
||||||
// we want to fire weapon, don't reload now
|
// we want to fire weapon, don't reload now
|
||||||
if (!m_isReloading)
|
if (!m_isReloading)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue