diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/tf/bot/behavior/tf_bot_destroy_enemy_sentry.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/tf/bot/behavior/tf_bot_destroy_enemy_sentry.h')
| -rw-r--r-- | game/server/tf/bot/behavior/tf_bot_destroy_enemy_sentry.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/game/server/tf/bot/behavior/tf_bot_destroy_enemy_sentry.h b/game/server/tf/bot/behavior/tf_bot_destroy_enemy_sentry.h new file mode 100644 index 0000000..f12d31a --- /dev/null +++ b/game/server/tf/bot/behavior/tf_bot_destroy_enemy_sentry.h @@ -0,0 +1,79 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// tf_bot_destroy_enemy_sentry.h +// Destroy an enemy sentry gun +// Michael Booth, June 2010 + +#ifndef TF_BOT_DESTROY_ENEMY_SENTRY_H +#define TF_BOT_DESTROY_ENEMY_SENTRY_H + +#include "Path/NextBotChasePath.h" + +//--------------------------------------------------------------------------------- +class CTFBotDestroyEnemySentry : public Action< CTFBot > +{ +public: + static bool IsPossible( CTFBot *me ); // return true if this Action has what it needs to perform right now + + virtual ActionResult< CTFBot > OnStart( CTFBot *me, Action< CTFBot > *priorAction ); + virtual ActionResult< CTFBot > Update( CTFBot *me, float interval ); + + virtual ActionResult< CTFBot > OnResume( CTFBot *me, Action< CTFBot > *interruptingAction ); + + virtual QueryResultType ShouldHurry( const INextBot *me ) const; // are we in a hurry? + virtual QueryResultType ShouldRetreat( const INextBot *me ) const; // is it time to retreat? + virtual QueryResultType ShouldAttack( const INextBot *me, const CKnownEntity *them ) const; // should we attack "them"? + + virtual const char *GetName( void ) const { return "DestroyEnemySentry"; }; + +private: + PathFollower m_path; + CountdownTimer m_repathTimer; + + bool m_canMove; + +#ifdef TF_CREEP_MODE + CountdownTimer m_creepTimer; +#endif + + Vector m_safeAttackSpot; + bool m_hasSafeAttackSpot; + void ComputeSafeAttackSpot( CTFBot *me ); + void ComputeCornerAttackSpot( CTFBot *me ); + + bool m_isAttackingSentry; + bool m_wasUber; + + ActionResult< CTFBot > EquipLongRangeWeapon( CTFBot *me ); + + CHandle< CObjectSentrygun > m_targetSentry; +}; + + +//--------------------------------------------------------------------------------- +class CTFBotUberAttackEnemySentry : public Action< CTFBot > +{ +public: + CTFBotUberAttackEnemySentry( CObjectSentrygun *sentryTarget ); + virtual ~CTFBotUberAttackEnemySentry() { } + + virtual ActionResult< CTFBot > OnStart( CTFBot *me, Action< CTFBot > *priorAction ); + virtual ActionResult< CTFBot > Update( CTFBot *me, float interval ); + virtual void OnEnd( CTFBot *me, Action< CTFBot > *nextAction ); + + virtual QueryResultType ShouldHurry( const INextBot *me ) const; // are we in a hurry? + virtual QueryResultType ShouldRetreat( const INextBot *me ) const; // is it time to retreat? + virtual QueryResultType ShouldAttack( const INextBot *me, const CKnownEntity *them ) const; // should we attack "them"? + + virtual const char *GetName( void ) const { return "UberAttackEnemySentry"; }; + +private: + bool m_wasIgnoringEnemies; + + PathFollower m_path; + CountdownTimer m_repathTimer; + + CHandle< CObjectSentrygun > m_targetSentry; +}; + + +#endif // TF_BOT_DESTROY_ENEMY_SENTRY_H |