Skip to content

Commit 8729d72

Browse files
committed
Bots pause firing after inflicting team damage
1 parent 36087ff commit 8729d72

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

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
@@ -3228,9 +3228,16 @@ int CNEO_Player::OnTakeDamage_Alive(const CTakeDamageInfo& info)
32283228
attacker->m_iTeamDamageInflicted += iDamage;
32293229
}
32303230

3231-
if (info.GetDamageType() & (DMG_BULLET | DMG_SLASH | DMG_BUCKSHOT)) {
3231+
constexpr const int botDamageTypes = DMG_SLASH | DMG_BULLET | DMG_BUCKSHOT;
3232+
if (info.GetDamageType() & botDamageTypes)
3233+
{
32323234
++m_iBotDetectableBleedingInjuryEvents;
32333235
}
3236+
3237+
if (bIsTeamDmg && NEORules()->IsTeamplay() && attacker->IsBot() && (info.GetDamageType() & botDamageTypes))
3238+
{
3239+
attacker->m_botPauseFiringTimer.Start(1.0f);
3240+
}
32343241
}
32353242
}
32363243
}

src/game/server/neo/neo_player.h

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

183184
virtual void StartAutoSprint(void) OVERRIDE;
@@ -243,6 +244,8 @@ class CNEO_Player : public CHL2MP_Player
243244

244245
// tracks time since last cloak disruption event for bots who can't actually see
245246
CountdownTimer m_botThermOpticCamoDisruptedTimer;
247+
// cooldown after inflicting accidental team damage
248+
CountdownTimer m_botPauseFiringTimer;
246249

247250
private:
248251
float GetActiveWeaponSpeedScale() const;

0 commit comments

Comments
 (0)