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.

105 lines
4.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "stringregistry.h"
  8. #include "ai_basenpc.h"
  9. #include "ai_condition.h"
  10. // memdbgon must be the last include file in a .cpp file!!!
  11. #include "tier0/memdbgon.h"
  12. //-----------------------------------------------------------------------------
  13. // Purpose: Given and condition name, return the condition ID
  14. //-----------------------------------------------------------------------------
  15. int CAI_BaseNPC::GetConditionID(const char* condName)
  16. {
  17. return GetSchedulingSymbols()->ConditionSymbolToId(condName);
  18. }
  19. //-----------------------------------------------------------------------------
  20. // Purpose: Register the default conditions
  21. // Input :
  22. // Output :
  23. //-----------------------------------------------------------------------------
  24. #define ADD_CONDITION_TO_SR( _n ) idSpace.AddCondition( #_n, _n, "CAI_BaseNPC" )
  25. void CAI_BaseNPC::InitDefaultConditionSR(void)
  26. {
  27. CAI_ClassScheduleIdSpace &idSpace = CAI_BaseNPC::AccessClassScheduleIdSpaceDirect();
  28. ADD_CONDITION_TO_SR( COND_NONE );
  29. ADD_CONDITION_TO_SR( COND_IN_PVS );
  30. ADD_CONDITION_TO_SR( COND_IDLE_INTERRUPT );
  31. ADD_CONDITION_TO_SR( COND_LOW_PRIMARY_AMMO );
  32. ADD_CONDITION_TO_SR( COND_NO_PRIMARY_AMMO );
  33. ADD_CONDITION_TO_SR( COND_NO_SECONDARY_AMMO );
  34. ADD_CONDITION_TO_SR( COND_NO_WEAPON );
  35. ADD_CONDITION_TO_SR( COND_SEE_HATE );
  36. ADD_CONDITION_TO_SR( COND_SEE_FEAR );
  37. ADD_CONDITION_TO_SR( COND_SEE_DISLIKE );
  38. ADD_CONDITION_TO_SR( COND_SEE_ENEMY );
  39. ADD_CONDITION_TO_SR( COND_LOST_ENEMY );
  40. ADD_CONDITION_TO_SR( COND_ENEMY_WENT_NULL );
  41. ADD_CONDITION_TO_SR( COND_HAVE_ENEMY_LOS );
  42. ADD_CONDITION_TO_SR( COND_HAVE_TARGET_LOS );
  43. ADD_CONDITION_TO_SR( COND_ENEMY_OCCLUDED );
  44. ADD_CONDITION_TO_SR( COND_TARGET_OCCLUDED );
  45. ADD_CONDITION_TO_SR( COND_ENEMY_TOO_FAR );
  46. ADD_CONDITION_TO_SR( COND_LIGHT_DAMAGE );
  47. ADD_CONDITION_TO_SR( COND_HEAVY_DAMAGE );
  48. ADD_CONDITION_TO_SR( COND_PHYSICS_DAMAGE );
  49. ADD_CONDITION_TO_SR( COND_REPEATED_DAMAGE );
  50. ADD_CONDITION_TO_SR( COND_CAN_RANGE_ATTACK1 );
  51. ADD_CONDITION_TO_SR( COND_CAN_RANGE_ATTACK2 );
  52. ADD_CONDITION_TO_SR( COND_CAN_MELEE_ATTACK1 );
  53. ADD_CONDITION_TO_SR( COND_CAN_MELEE_ATTACK2 );
  54. ADD_CONDITION_TO_SR( COND_PROVOKED );
  55. ADD_CONDITION_TO_SR( COND_NEW_ENEMY );
  56. ADD_CONDITION_TO_SR( COND_ENEMY_FACING_ME );
  57. ADD_CONDITION_TO_SR( COND_BEHIND_ENEMY );
  58. ADD_CONDITION_TO_SR( COND_ENEMY_DEAD );
  59. ADD_CONDITION_TO_SR( COND_ENEMY_UNREACHABLE );
  60. ADD_CONDITION_TO_SR( COND_SEE_PLAYER );
  61. ADD_CONDITION_TO_SR( COND_LOST_PLAYER );
  62. ADD_CONDITION_TO_SR( COND_SEE_NEMESIS );
  63. ADD_CONDITION_TO_SR( COND_TASK_FAILED );
  64. ADD_CONDITION_TO_SR( COND_SCHEDULE_DONE );
  65. ADD_CONDITION_TO_SR( COND_SMELL );
  66. ADD_CONDITION_TO_SR( COND_TOO_CLOSE_TO_ATTACK );
  67. ADD_CONDITION_TO_SR( COND_TOO_FAR_TO_ATTACK );
  68. ADD_CONDITION_TO_SR( COND_NOT_FACING_ATTACK );
  69. ADD_CONDITION_TO_SR( COND_WEAPON_HAS_LOS );
  70. ADD_CONDITION_TO_SR( COND_WEAPON_BLOCKED_BY_FRIEND ); // Friend between gun and target
  71. ADD_CONDITION_TO_SR( COND_WEAPON_PLAYER_IN_SPREAD ); // Player in shooting direction
  72. ADD_CONDITION_TO_SR( COND_WEAPON_PLAYER_NEAR_TARGET ); // Player near shooting position
  73. ADD_CONDITION_TO_SR( COND_WEAPON_SIGHT_OCCLUDED );
  74. ADD_CONDITION_TO_SR( COND_BETTER_WEAPON_AVAILABLE );
  75. ADD_CONDITION_TO_SR( COND_HEALTH_ITEM_AVAILABLE );
  76. ADD_CONDITION_TO_SR( COND_FLOATING_OFF_GROUND );
  77. ADD_CONDITION_TO_SR( COND_MOBBED_BY_ENEMIES );
  78. ADD_CONDITION_TO_SR( COND_GIVE_WAY );
  79. ADD_CONDITION_TO_SR( COND_WAY_CLEAR );
  80. ADD_CONDITION_TO_SR( COND_HEAR_DANGER );
  81. ADD_CONDITION_TO_SR( COND_HEAR_THUMPER );
  82. ADD_CONDITION_TO_SR( COND_HEAR_COMBAT );
  83. ADD_CONDITION_TO_SR( COND_HEAR_WORLD );
  84. ADD_CONDITION_TO_SR( COND_HEAR_PLAYER );
  85. ADD_CONDITION_TO_SR( COND_HEAR_BULLET_IMPACT );
  86. ADD_CONDITION_TO_SR( COND_HEAR_BUGBAIT );
  87. ADD_CONDITION_TO_SR( COND_HEAR_PHYSICS_DANGER );
  88. ADD_CONDITION_TO_SR( COND_HEAR_MOVE_AWAY );
  89. ADD_CONDITION_TO_SR( COND_NO_HEAR_DANGER );
  90. ADD_CONDITION_TO_SR( COND_PLAYER_PUSHING );
  91. ADD_CONDITION_TO_SR( COND_RECEIVED_ORDERS );
  92. ADD_CONDITION_TO_SR( COND_PLAYER_ADDED_TO_SQUAD );
  93. ADD_CONDITION_TO_SR( COND_PLAYER_REMOVED_FROM_SQUAD );
  94. ADD_CONDITION_TO_SR( COND_NPC_FREEZE );
  95. ADD_CONDITION_TO_SR( COND_NPC_UNFREEZE );
  96. ADD_CONDITION_TO_SR( COND_TALKER_RESPOND_TO_QUESTION );
  97. ADD_CONDITION_TO_SR( COND_NO_CUSTOM_INTERRUPTS );
  98. }