Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot fixes #659

Merged
merged 2 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions regamedll/dlls/bot/cs_bot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,15 @@ void CCSBot::BotTouch(CBaseEntity *pOther)
// See if it's breakable
if (FClassnameIs(pOther->pev, "func_breakable"))
{

#ifdef REGAMEDLL_FIXES
CBreakable *pBreak = static_cast<CBreakable *>(pOther);

// Material is "UnbreakableGlass"
if (!pBreak->IsBreakable())
return;
#endif

Vector center = (pOther->pev->absmax + pOther->pev->absmin) / 2.0f;
bool breakIt = true;

Expand Down
8 changes: 5 additions & 3 deletions regamedll/dlls/bot/cs_bot_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,18 @@ void CCSBot::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOt
{
if (event == EVENT_PLAYER_DIED)
{
if (BotRelationship(pPlayer) == BOT_TEAMMATE)
CBasePlayer *pVictim = pPlayer;

if (BotRelationship(pVictim) == BOT_TEAMMATE)
{
CBasePlayer *pKiller = static_cast<CBasePlayer *>(pOther);

// check that attacker is an enemy (for friendly fire, etc)
if (pKiller && pKiller->IsPlayer())
if (pKiller && pKiller->IsPlayer() && BotRelationship(pKiller) == BOT_ENEMY)
{
// check if we saw our friend die - dont check FOV - assume we're aware of our surroundings in combat
// snipers stay put
if (!IsSniper() && IsVisible(&pPlayer->pev->origin))
if (!IsSniper() && IsVisible(&pVictim->pev->origin))
{
// people are dying - we should hurry
Hurry(RANDOM_FLOAT(10.0f, 15.0f));
Expand Down