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/NextBot/NextBotContextualQueryInterface.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/NextBot/NextBotContextualQueryInterface.h')
| -rw-r--r-- | game/server/NextBot/NextBotContextualQueryInterface.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/game/server/NextBot/NextBotContextualQueryInterface.h b/game/server/NextBot/NextBotContextualQueryInterface.h new file mode 100644 index 0000000..d117bca --- /dev/null +++ b/game/server/NextBot/NextBotContextualQueryInterface.h @@ -0,0 +1,102 @@ +// NextBotContextualQueryInterface.h +// Queries within the context of the bot's current behavior state +// Author: Michael Booth, June 2007 +//========= Copyright Valve Corporation, All rights reserved. ============// + +#ifndef _NEXT_BOT_CONTEXTUAL_QUERY_H_ +#define _NEXT_BOT_CONTEXTUAL_QUERY_H_ + +class INextBot; +class CBaseEntity; +class CBaseCombatCharacter; +class Path; +class CKnownEntity; + +/** + * Since behaviors can have several concurrent actions active, we ask + * the topmost child action first, and if it defers, its parent, and so + * on, until we get a definitive answer. + */ +enum QueryResultType +{ + ANSWER_NO, + ANSWER_YES, + ANSWER_UNDEFINED +}; + +// Can pass this into IContextualQuery::IsHindrance to see if any hindrance is ever possible +#define IS_ANY_HINDRANCE_POSSIBLE ( (CBaseEntity*)0xFFFFFFFF ) + + +//---------------------------------------------------------------------------------------------------------------- +/** + * The interface for queries that are dependent on the bot's current behavior state + */ +class IContextualQuery +{ +public: + virtual ~IContextualQuery() { } + + virtual QueryResultType ShouldPickUp( const INextBot *me, CBaseEntity *item ) const; // if the desired item was available right now, should we pick it up? + 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 QueryResultType IsHindrance( const INextBot *me, CBaseEntity *blocker ) const; // return true if we should wait for 'blocker' that is across our path somewhere up ahead. + + virtual Vector SelectTargetPoint( const INextBot *me, const CBaseCombatCharacter *subject ) const; // given a subject, return the world space position we should aim at + + /** + * Allow bot to approve of positions game movement tries to put him into. + * This is most useful for bots derived from CBasePlayer that go through + * the player movement system. + */ + virtual QueryResultType IsPositionAllowed( const INextBot *me, const Vector &pos ) const; + + virtual const CKnownEntity * SelectMoreDangerousThreat( const INextBot *me, + const CBaseCombatCharacter *subject, + const CKnownEntity *threat1, + const CKnownEntity *threat2 ) const; // return the more dangerous of the two threats to 'subject', or NULL if we have no opinion +}; + +inline QueryResultType IContextualQuery::ShouldPickUp( const INextBot *me, CBaseEntity *item ) const +{ + return ANSWER_UNDEFINED; +} + +inline QueryResultType IContextualQuery::ShouldHurry( const INextBot *me ) const +{ + return ANSWER_UNDEFINED; +} + +inline QueryResultType IContextualQuery::ShouldRetreat( const INextBot *me ) const +{ + return ANSWER_UNDEFINED; +} + +inline QueryResultType IContextualQuery::ShouldAttack( const INextBot *me, const CKnownEntity *them ) const +{ + return ANSWER_UNDEFINED; +} + +inline QueryResultType IContextualQuery::IsHindrance( const INextBot *me, CBaseEntity *blocker ) const +{ + return ANSWER_UNDEFINED; +} + +inline Vector IContextualQuery::SelectTargetPoint( const INextBot *me, const CBaseCombatCharacter *subject ) const +{ + return vec3_origin; +} + +inline QueryResultType IContextualQuery::IsPositionAllowed( const INextBot *me, const Vector &pos ) const +{ + return ANSWER_UNDEFINED; +} + +inline const CKnownEntity *IContextualQuery::SelectMoreDangerousThreat( const INextBot *me, const CBaseCombatCharacter *subject, const CKnownEntity *threat1, const CKnownEntity *threat2 ) const +{ + return NULL; +} + + +#endif // _NEXT_BOT_CONTEXTUAL_QUERY_H_ |