aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/server/hl2/ai_behavior_police.h
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
committerJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
commit39ed87570bdb2f86969d4be821c94b722dc71179 (patch)
treeabc53757f75f40c80278e87650ea92808274aa59 /sp/src/game/server/hl2/ai_behavior_police.h
downloadsource-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz
source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip
First version of the SOurce SDK 2013
Diffstat (limited to 'sp/src/game/server/hl2/ai_behavior_police.h')
-rw-r--r--sp/src/game/server/hl2/ai_behavior_police.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/sp/src/game/server/hl2/ai_behavior_police.h b/sp/src/game/server/hl2/ai_behavior_police.h
new file mode 100644
index 00000000..c0975f2d
--- /dev/null
+++ b/sp/src/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