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.

104 lines
3.7 KiB

  1. // NextBotCombatCharacter.h
  2. // Next generation bot system
  3. // Author: Michael Booth, April 2005
  4. //========= Copyright Valve Corporation, All rights reserved. ============//
  5. #ifndef _NEXT_BOT_H_
  6. #define _NEXT_BOT_H_
  7. #include "NextBotInterface.h"
  8. #include "NextBotManager.h"
  9. #ifdef TERROR
  10. #include "player_lagcompensation.h"
  11. #endif
  12. class NextBotCombatCharacter;
  13. struct animevent_t;
  14. extern ConVar NextBotStop;
  15. //----------------------------------------------------------------------------------------------------------------
  16. //----------------------------------------------------------------------------------------------------------------
  17. /**
  18. * A Next Bot derived from CBaseCombatCharacter
  19. */
  20. class NextBotCombatCharacter : public CBaseCombatCharacter, public INextBot
  21. {
  22. public:
  23. DECLARE_CLASS( NextBotCombatCharacter, CBaseCombatCharacter );
  24. DECLARE_SERVERCLASS();
  25. DECLARE_DATADESC();
  26. NextBotCombatCharacter( void );
  27. virtual ~NextBotCombatCharacter() { }
  28. virtual void Spawn( void );
  29. virtual Vector EyePosition( void );
  30. virtual INextBot *MyNextBotPointer( void ) { return this; }
  31. // Event hooks into NextBot system ---------------------------------------
  32. virtual int OnTakeDamage_Alive( const CTakeDamageInfo &info );
  33. virtual int OnTakeDamage_Dying( const CTakeDamageInfo &info );
  34. virtual void Event_Killed( const CTakeDamageInfo &info );
  35. virtual void HandleAnimEvent( animevent_t *event );
  36. virtual void OnNavAreaChanged( CNavArea *enteredArea, CNavArea *leftArea ); // invoked (by UpdateLastKnownArea) when we enter a new nav area (or it is reset to NULL)
  37. virtual void Touch( CBaseEntity *other );
  38. virtual void SetModel( const char *szModelName );
  39. virtual void Ignite( float flFlameLifetime, bool bNPCOnly = true, float flSize = 0.0f, bool bCalledByLevelDesigner = false );
  40. virtual void Ignite( float flFlameLifetime, CBaseEntity *pAttacker );
  41. //------------------------------------------------------------------------
  42. virtual bool IsUseableEntity( CBaseEntity *entity, unsigned int requiredCaps = 0 );
  43. void UseEntity( CBaseEntity *entity, USE_TYPE useType = USE_TOGGLE );
  44. // Implement this if you use MOVETYPE_CUSTOM
  45. virtual void PerformCustomPhysics( Vector *pNewPosition, Vector *pNewVelocity, QAngle *pNewAngles, QAngle *pNewAngVelocity );
  46. virtual bool BecomeRagdoll( const CTakeDamageInfo &info, const Vector &forceVector );
  47. // hook to INextBot update
  48. void DoThink( void );
  49. // expose to public
  50. int GetLastHitGroup( void ) const; // where on our body were we injured last
  51. virtual bool IsAreaTraversable( const CNavArea *area ) const; // return true if we can use the given area
  52. virtual CBaseCombatCharacter *GetLastAttacker( void ) const; // return the character who last attacked me
  53. // begin INextBot public interface ----------------------------------------------------------------
  54. virtual NextBotCombatCharacter *GetEntity( void ) const { return const_cast< NextBotCombatCharacter * >( this ); }
  55. virtual NextBotCombatCharacter *GetNextBotCombatCharacter( void ) const { return const_cast< NextBotCombatCharacter * >( this ); }
  56. private:
  57. EHANDLE m_lastAttacker;
  58. bool m_didModelChange;
  59. };
  60. inline CBaseCombatCharacter *NextBotCombatCharacter::GetLastAttacker( void ) const
  61. {
  62. return ( m_lastAttacker.Get() == NULL ) ? NULL : m_lastAttacker->MyCombatCharacterPointer();
  63. }
  64. inline int NextBotCombatCharacter::GetLastHitGroup( void ) const
  65. {
  66. return LastHitGroup();
  67. }
  68. //-----------------------------------------------------------------------------------------------------
  69. class NextBotDestroyer
  70. {
  71. public:
  72. NextBotDestroyer( int team );
  73. bool operator() ( INextBot *bot );
  74. int m_team; // the team to delete bots from, or TEAM_ANY for any team
  75. };
  76. #endif // _NEXT_BOT_H_