Skip to content

Commit

Permalink
Bots only attack breakable objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaqtincha committed Jun 8, 2021
1 parent 2c52c4f commit 64df2f9
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions regamedll/dlls/bot/cs_bot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,27 +295,33 @@ void CCSBot::BotTouch(CBaseEntity *pOther)
// See if it's breakable
if (FClassnameIs(pOther->pev, "func_breakable"))
{
Vector center = (pOther->pev->absmax + pOther->pev->absmin) / 2.0f;
bool breakIt = true;

if (m_pathLength)
{
Vector goal = m_goalPosition + Vector(0, 0, HalfHumanHeight);
breakIt = IsIntersectingBox(pev->origin, goal, pOther->pev->absmin, pOther->pev->absmax);
}

if (breakIt)
#ifdef REGAMEDLL_FIXES
// Is breakable ? spawnflags has SF_BREAK_TRIGGER_ONLY or material type matUnbreakableGlass
if (pOther->pev->takedamage != DAMAGE_NO || !(pOther->pev->flags |= FL_WORLDBRUSH))
#endif
{
// it's breakable - try to shoot it.
SetLookAt("Breakable", &center, PRIORITY_HIGH, 0.2, 0, 5.0);
Vector center = (pOther->pev->absmax + pOther->pev->absmin) / 2.0f;
bool breakIt = true;

if (IsUsingGrenade())
if (m_pathLength)
{
EquipBestWeapon();
return;
Vector goal = m_goalPosition + Vector(0, 0, HalfHumanHeight);
breakIt = IsIntersectingBox(pev->origin, goal, pOther->pev->absmin, pOther->pev->absmax);
}

PrimaryAttack();
if (breakIt)
{
// it's breakable - try to shoot it.
SetLookAt("Breakable", &center, PRIORITY_HIGH, 0.2, 0, 5.0);

if (IsUsingGrenade())
{
EquipBestWeapon();
return;
}

PrimaryAttack();
}
}
}
}
Expand Down

0 comments on commit 64df2f9

Please sign in to comment.