Skip to content

Commit c669c39

Browse files
authored
Bots pause firing after inflicting team damage (#1810)
1 parent b654b37 commit c669c39

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/game/server/neo/bot/neo_bot.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ void CNEOBot::PressFireButton(float duration)
469469
{
470470
// can't fire if stunned
471471
// @todo Tom Bui: Eventually, we'll probably want to check the actual weapon for supress fire
472-
if (HasAttribute(CNEOBot::SUPPRESS_FIRE))
472+
if ( GetBotPauseFiring() || HasAttribute(CNEOBot::SUPPRESS_FIRE) )
473473
{
474474
ReleaseFireButton();
475475
return;

src/game/server/neo/neo_player.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3273,9 +3273,16 @@ int CNEO_Player::OnTakeDamage_Alive(const CTakeDamageInfo& info)
32733273
attacker->m_iTeamDamageInflicted += iDamage;
32743274
}
32753275

3276-
if (info.GetDamageType() & (DMG_BULLET | DMG_SLASH | DMG_BUCKSHOT)) {
3276+
constexpr const int botDamageTypes = DMG_SLASH | DMG_BULLET | DMG_BUCKSHOT;
3277+
if (info.GetDamageType() & botDamageTypes)
3278+
{
32773279
++m_iBotDetectableBleedingInjuryEvents;
32783280
}
3281+
3282+
if (bIsTeamDmg && NEORules()->IsTeamplay() && attacker->IsBot() && (info.GetDamageType() & botDamageTypes))
3283+
{
3284+
attacker->m_botPauseFiringTimer.Start(1.0f);
3285+
}
32793286
}
32803287
}
32813288
}

src/game/server/neo/neo_player.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ class CNEO_Player : public CHL2MP_Player
180180
bool GetInThermOpticCamo() const { return m_bInThermOpticCamo; }
181181
// bots can't see anything, so they need an additional timer for cloak disruption events
182182
bool GetBotCloakStateDisrupted() const { return !m_botThermOpticCamoDisruptedTimer.IsElapsed(); }
183+
bool GetBotPauseFiring() const { return !m_botPauseFiringTimer.IsElapsed(); }
183184
bool GetSpectatorTakeoverPlayerPending() const { return m_bSpectatorTakeoverPlayerPending; }
184185

185186
virtual void StartAutoSprint(void) OVERRIDE;
@@ -245,6 +246,8 @@ class CNEO_Player : public CHL2MP_Player
245246

246247
// tracks time since last cloak disruption event for bots who can't actually see
247248
CountdownTimer m_botThermOpticCamoDisruptedTimer;
249+
// cooldown after inflicting accidental team damage
250+
CountdownTimer m_botPauseFiringTimer;
248251

249252
private:
250253
float GetActiveWeaponSpeedScale() const;

0 commit comments

Comments
 (0)