Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. #ifndef NPC_TURRET_GROUND_H
  3. #define NPC_TURRET_GROUND_H
  4. #ifdef _WIN32
  5. #pragma once
  6. #endif
  7. #include "ai_basenpc.h"
  8. #include "smoke_trail.h"
  9. //=========================================================
  10. //=========================================================
  11. class CNPC_GroundTurret : public CAI_BaseNPC
  12. {
  13. public:
  14. DECLARE_CLASS( CNPC_GroundTurret, CAI_BaseNPC );
  15. DECLARE_DATADESC();
  16. void Precache( void );
  17. virtual void Spawn( void );
  18. bool CreateVPhysics( void );
  19. void PrescheduleThink();
  20. Class_T Classify( void );
  21. void PostNPCInit();
  22. // Damage & Death
  23. virtual int OnTakeDamage_Alive( const CTakeDamageInfo &info );
  24. void Event_Killed( const CTakeDamageInfo &info );
  25. void DeathEffects();
  26. bool CanBecomeRagdoll( void ) { return false; }
  27. void DeathSound( const CTakeDamageInfo &info );
  28. // Combat
  29. void MakeTracer( const Vector &vecTracerSrc, const trace_t &tr, int iTracerType );
  30. Vector GetAttackSpread( CBaseCombatWeapon *pWeapon, CBaseEntity *pTarget )
  31. {
  32. return VECTOR_CONE_5DEGREES;
  33. }
  34. // Sensing
  35. void GatherConditions();
  36. Vector EyePosition();
  37. bool FVisible( CBaseEntity *pEntity, int traceMask, CBaseEntity **ppBlocker );
  38. bool QuerySeeEntity( CBaseEntity *pEntity, bool bOnlyHateOrFearIfNPC = false );
  39. bool IsOpeningOrClosing() { return (GetAbsVelocity().z != 0.0f); }
  40. bool IsEnabled();
  41. bool IsOpen();
  42. // Tasks & Schedules
  43. void StartTask( const Task_t *pTask );
  44. void RunTask( const Task_t *pTask );
  45. virtual int SelectSchedule( void );
  46. virtual int TranslateSchedule( int scheduleType );
  47. // Activities & Animation
  48. Activity NPC_TranslateActivity( Activity eNewActivity );
  49. virtual void Shoot();
  50. virtual void Scan();
  51. void ProjectBeam( const Vector &vecStart, const Vector &vecDir, int width, int brightness, float duration );
  52. // Local
  53. void SetActive( bool bActive ) {}
  54. // Inputs
  55. void InputEnable( inputdata_t &inputdata );
  56. void InputDisable( inputdata_t &inputdata );
  57. // Outputs
  58. COutputEvent m_OnAreaClear;
  59. DEFINE_CUSTOM_AI;
  60. protected:
  61. //-----------------------------------------------------
  62. // Conditions, Schedules, Tasks
  63. //-----------------------------------------------------
  64. enum
  65. {
  66. SCHED_GROUND_TURRET_IDLE = BaseClass::NEXT_SCHEDULE,
  67. SCHED_GROUND_TURRET_ATTACK,
  68. TASK_GROUNDTURRET_SCAN = BaseClass::NEXT_TASK,
  69. };
  70. int m_iAmmoType;
  71. SmokeTrail *m_pSmoke;
  72. bool m_bEnabled;
  73. float m_flTimeNextShoot;
  74. float m_flTimeLastSawEnemy;
  75. Vector m_vecSpread;
  76. bool m_bHasExploded;
  77. int m_iDeathSparks;
  78. float m_flSensingDist;
  79. bool m_bSeeEnemy;
  80. float m_flTimeNextPing;
  81. Vector m_vecClosedPos;
  82. Vector m_vecLightOffset;
  83. HSOUNDSCRIPTHANDLE m_ShotSounds;
  84. };
  85. #endif //#ifndef NPC_TURRET_GROUND_H