Skip to content

Commit fc6d24c

Browse files
committed
allow bots to use the shortstop shove
1 parent 4684e8d commit fc6d24c

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

src/game/server/tf/bot/behavior/tf_bot_behavior.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "bot/behavior/tf_bot_dead.h"
2323
#ifdef BDSBASE
2424
#include "bot/behavior/tf_bot_freeze_input.h"
25+
#include "tf_weapon_pistol.h"
2526
#endif
2627
#include "NextBot/NavMeshEntities/func_nav_prerequisite.h"
2728
#include "bot/behavior/nav_entities/tf_bot_nav_ent_destroy_entity.h"
@@ -1397,6 +1398,20 @@ void CTFBotMainAction::FireWeaponAtEnemy( CTFBot *me )
13971398

13981399
return;
13991400
}
1401+
#ifdef BDSBASE
1402+
else if (myWeapon->IsWeapon(TF_WEAPON_HANDGUN_SCOUT_PRIMARY))
1403+
{
1404+
CTFPistol_ScoutPrimary* pPistolPrimary = assert_cast<CTFPistol_ScoutPrimary*>(myWeapon);
1405+
// watch for enemy projectiles heading our way
1406+
if (pPistolPrimary->CanUsePush() && me->ShouldFireCompressionBlast())
1407+
{
1408+
// bounce missiles with compression blast
1409+
me->PressAltFireButton();
1410+
}
1411+
1412+
return;
1413+
}
1414+
#endif
14001415

14011416
float threatRange = ( threat->GetEntity()->GetAbsOrigin() - me->GetAbsOrigin() ).Length();
14021417

src/game/server/tf/bot/tf_bot.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4393,6 +4393,13 @@ bool CTFBot::ShouldFireCompressionBlast( void )
43934393
}
43944394
}
43954395

4396+
#ifdef BDSBASE
4397+
// if we use the shortstop, we shouldn't try to push enemy projectiles here.
4398+
CTFWeaponBase* myWeapon = m_Shared.GetActiveTFWeapon();
4399+
4400+
if (myWeapon->IsWeapon(TF_WEAPON_HANDGUN_SCOUT_PRIMARY))
4401+
return false;
4402+
#endif
43964403

43974404
Vector vecEye = EyePosition();
43984405
Vector vecForward, vecRight, vecUp;

src/game/shared/tf/tf_weapon_pistol.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ void CTFPistol_ScoutPrimary::ItemBusyFrame()
227227
SecondaryAttack();
228228
}
229229
}
230+
231+
bool CTFPistol_ScoutPrimary::CanUsePush()
232+
{
233+
return (m_flPushTime > -1.f && gpGlobals->curtime > m_flPushTime);
234+
}
230235
#endif
231236

232237
//-----------------------------------------------------------------------------
@@ -236,7 +241,11 @@ void CTFPistol_ScoutPrimary::ItemBusyFrame()
236241
void CTFPistol_ScoutPrimary::ItemPostFrame()
237242
{
238243
// Check for smack.
244+
#ifdef BDSBASE
245+
if (CanUsePush())
246+
#else
239247
if ( m_flPushTime > -1.f && gpGlobals->curtime > m_flPushTime )
248+
#endif
240249
{
241250
Push();
242251
m_flPushTime = -1.f;

src/game/shared/tf/tf_weapon_pistol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class CTFPistol_ScoutPrimary : public CTFPistol_Scout
8080
virtual void SecondaryAttack( void );
8181
#ifdef BDSBASE
8282
virtual void ItemBusyFrame();
83+
bool CanUsePush();
8384
#endif
8485
virtual void ItemPostFrame();
8586
virtual bool Holster( CBaseCombatWeapon *pSwitchingTo );

0 commit comments

Comments
 (0)