a little fixes
This commit is contained in:
parent
0314cee6d3
commit
02fe78ceee
4 changed files with 36 additions and 74 deletions
|
|
@ -100,6 +100,8 @@ typedef struct
|
||||||
int iHitgroup; // 0 == generic, non zero is specific body part
|
int iHitgroup; // 0 == generic, non zero is specific body part
|
||||||
} TraceResult;
|
} TraceResult;
|
||||||
|
|
||||||
|
typedef edict_t *entity_t;
|
||||||
|
|
||||||
typedef uint32 CRC32_t;
|
typedef uint32 CRC32_t;
|
||||||
|
|
||||||
// Engine hands this to DLLs for functionality callbacks
|
// Engine hands this to DLLs for functionality callbacks
|
||||||
|
|
|
||||||
|
|
@ -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,6 +4854,8 @@ void Bot::BotAI (void)
|
||||||
SetConditions ();
|
SetConditions ();
|
||||||
|
|
||||||
// some stuff required by by chatter engine
|
// some stuff required by by chatter engine
|
||||||
|
if (yb_communication_type.GetInt () == 2)
|
||||||
|
{
|
||||||
if ((m_states & STATE_SEEING_ENEMY) && !IsEntityNull (m_enemy))
|
if ((m_states & STATE_SEEING_ENEMY) && !IsEntityNull (m_enemy))
|
||||||
{
|
{
|
||||||
if (Random.Long (0, 100) < 45 && GetNearbyFriendsNearPosition (pev->origin, 512) == 0 && (m_enemy->v.weapons & (1 << WEAPON_C4)))
|
if (Random.Long (0, 100) < 45 && GetNearbyFriendsNearPosition (pev->origin, 512) == 0 && (m_enemy->v.weapons & (1 << WEAPON_C4)))
|
||||||
|
|
@ -4869,16 +4872,16 @@ void Bot::BotAI (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if bot is trapped under shield yell for help !
|
// if bot is trapped under shield yell for help !
|
||||||
if (GetTaskId () == TASK_CAMP && HasShield() && IsShieldDrawn () && GetNearbyEnemiesNearPosition (pev->origin, 650) >= 2 && IsEnemyViewable(m_enemy))
|
if (GetTaskId () == TASK_CAMP && HasShield () && IsShieldDrawn () && GetNearbyEnemiesNearPosition (pev->origin, 650) >= 2 && IsEnemyViewable (m_enemy))
|
||||||
InstantChatterMessage(Chatter_Pinned_Down);
|
InstantChatterMessage (Chatter_Pinned_Down);
|
||||||
|
|
||||||
// if bomb planted warn teammates !
|
// if bomb planted warn teammates !
|
||||||
if (g_canSayBombPlanted && g_bombPlanted && GetTeam (GetEntity()) == TEAM_CF)
|
if (g_canSayBombPlanted && g_bombPlanted && GetTeam (GetEntity ()) == TEAM_CF)
|
||||||
{
|
{
|
||||||
g_canSayBombPlanted = false;
|
g_canSayBombPlanted = false;
|
||||||
ChatterMessage (Chatter_GottaFindTheBomb);
|
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)
|
||||||
|
|
|
||||||
|
|
@ -997,12 +997,12 @@ void Touch (edict_t *pentTouched, edict_t *pentOther)
|
||||||
// the two entities both have velocities, for example two players colliding, this function
|
// the two entities both have velocities, for example two players colliding, this function
|
||||||
// is called twice, once for each entity moving.
|
// is called twice, once for each entity moving.
|
||||||
|
|
||||||
if (!IsEntityNull (pentTouched) && (pentTouched->v.flags & FL_FAKECLIENT))
|
if (!IsEntityNull (pentOther) && (pentOther->v.flags & FL_FAKECLIENT))
|
||||||
{
|
{
|
||||||
Bot *touched = g_botManager->GetBot (pentTouched);
|
Bot *bot = g_botManager->GetBot (pentOther);
|
||||||
|
|
||||||
if (touched != NULL)
|
if (bot != NULL)
|
||||||
touched->VerifyBreakable (pentOther);
|
bot->VerifyBreakable (pentTouched);
|
||||||
}
|
}
|
||||||
if (g_isMetamod)
|
if (g_isMetamod)
|
||||||
RETURN_META (MRES_IGNORED);
|
RETURN_META (MRES_IGNORED);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue