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/hl2/ai_behavior_police.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/hl2/ai_behavior_police.h')
| -rw-r--r-- | game/server/hl2/ai_behavior_police.h | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/game/server/hl2/ai_behavior_police.h b/game/server/hl2/ai_behavior_police.h new file mode 100644 index 0000000..84f132b --- /dev/null +++ b/game/server/hl2/ai_behavior_police.h @@ -0,0 +1,106 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#ifndef AI_BEHAVIOR_POLICE_H +#define AI_BEHAVIOR_POLICE_H +#ifdef _WIN32 +#pragma once +#endif + +#include "ai_behavior.h" +#include "ai_goal_police.h" +#include "ai_sentence.h" + +#define PATROL_RADIUS_RATIO 2.0f +#define POLICE_MAX_WARNINGS 4 + +class CAI_PolicingBehavior : public CAI_SimpleBehavior +{ + DECLARE_CLASS( CAI_PolicingBehavior, CAI_SimpleBehavior ); +public: + DECLARE_DATADESC(); + CAI_PolicingBehavior(); + + enum + { + // Schedules + SCHED_POLICE_RETURN_FROM_HARASS = BaseClass::NEXT_SCHEDULE, + SCHED_POLICE_WARN_TARGET, + SCHED_POLICE_HARASS_TARGET, + SCHED_POLICE_SUPPRESS_TARGET, + SCHED_POLICE_FACE_ALONG_GOAL, + SCHED_POLICE_TRACK_TARGET, + NEXT_SCHEDULE, + + // Tasks + TASK_POLICE_GET_PATH_TO_HARASS_GOAL = BaseClass::NEXT_TASK, + TASK_POLICE_GET_PATH_TO_POLICE_GOAL, + TASK_POLICE_FACE_ALONG_GOAL, + TASK_POLICE_ANNOUNCE_HARASS, + NEXT_TASK, + + // Conditions + COND_POLICE_TARGET_TOO_CLOSE_HARASS = BaseClass::NEXT_CONDITION, + COND_POLICE_TARGET_TOO_CLOSE_SUPPRESS, + NEXT_CONDITION, + }; + + virtual const char *GetName() { return "Policing"; } + + void Enable( CAI_PoliceGoal *pGoal ); + void Disable( void ); + bool CanSelectSchedule( void ); + void BuildScheduleTestBits( void ); + + bool IsEnabled( void ) { return m_bEnabled; } + bool TargetIsHostile( void ); + + bool ShouldKnockOutTarget( CBaseEntity *pTarget ); + void KnockOutTarget( CBaseEntity *pTarget ); + + int SelectFailSchedule( int failedSchedule, int failedTask, AI_TaskFailureCode_t taskFailCode ); + + CBaseEntity *GetGoalTarget( void ); + +private: + + void HostSpeakSentence( const char *pSentence, SentencePriority_t nSoundPriority, SentenceCriteria_t nCriteria ); + + int TranslateSchedule( int scheduleType ); + + int SelectSchedule( void ); + int SelectSuppressSchedule( void ); + int SelectHarassSchedule( void ); + + Activity NPC_TranslateActivity( Activity newActivity ); + void GatherConditions( void ); + bool OverrideMoveFacing( const AILocalMoveGoal_t &move, float flInterval ); + void StartTask( const Task_t *pTask ); + void RunTask( const Task_t *pTask ); + + void AnnouncePolicing( void ); + void HostSetBatonState( bool state ); + bool HostBatonIsOn( void ); + + void SetTargetHostileDuration( float time ); + bool MaintainGoalPosition( void ); + +protected: + + bool m_bEnabled; + bool m_bStartPolicing; + float m_flNextHarassTime; + float m_flAggressiveTime; + int m_nNumWarnings; + bool m_bTargetIsHostile; + float m_flTargetHostileTime; + + CHandle<CAI_PoliceGoal> m_hPoliceGoal; + + DEFINE_CUSTOM_SCHEDULE_PROVIDER; +}; + +#endif // AI_BEHAVIOR_POLICE_H |