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/map_entities/tf_bot_hint_sentrygun.cpp | |
| 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/map_entities/tf_bot_hint_sentrygun.cpp')
| -rw-r--r-- | game/server/tf/bot/map_entities/tf_bot_hint_sentrygun.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/game/server/tf/bot/map_entities/tf_bot_hint_sentrygun.cpp b/game/server/tf/bot/map_entities/tf_bot_hint_sentrygun.cpp new file mode 100644 index 0000000..4cc804d --- /dev/null +++ b/game/server/tf/bot/map_entities/tf_bot_hint_sentrygun.cpp @@ -0,0 +1,42 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// tf_bot_hint_sentrygun.cpp +// Designer-placed hint for bot sentry placement +// Michael Booth, October 2009 + +#include "cbase.h" +#include "bot/tf_bot.h" +#include "tf_bot_hint_sentrygun.h" + + +BEGIN_DATADESC( CTFBotHintSentrygun ) + DEFINE_KEYFIELD( m_isSticky, FIELD_BOOLEAN, "sticky" ), + DEFINE_OUTPUT( m_outputOnSentryGunDestroyed, "OnSentryGunDestroyed" ), +END_DATADESC() + +LINK_ENTITY_TO_CLASS( bot_hint_sentrygun, CTFBotHintSentrygun ); + +//------------------------------------------------------------------------------ +CTFBotHintSentrygun::CTFBotHintSentrygun( void ) + : m_isSticky( false ) + , m_iUseCount( 0 ) +{ +} + +//------------------------------------------------------------------------------ +void CTFBotHintSentrygun::OnSentryGunDestroyed( CBaseEntity *pEntity ) +{ + m_outputOnSentryGunDestroyed.FireOutput( pEntity, pEntity ); +} + +//------------------------------------------------------------------------------ +bool CTFBotHintSentrygun::IsAvailableForSelection( CTFPlayer *pRequestingPlayer ) const +{ + // sentry hint is eligible as long as there is no owner (or the owner is no longer an engineer) + // if the hint is enabled and the hint is not in use and it is on the same team as me + if ( ( GetPlayerOwner() == NULL || !GetPlayerOwner()->IsPlayerClass( TF_CLASS_ENGINEER ) ) && + ( IsEnabled() && IsInUse() == false && InSameTeam( pRequestingPlayer ) ) ) + { + return true; + } + return false; +} |