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.

47 lines
1.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: AI system that makes NPCs verbally respond to game events
  4. //
  5. //=============================================================================//
  6. #ifndef AI_EVENTRESPONSE_H
  7. #define AI_EVENTRESPONSE_H
  8. #include "utldict.h"
  9. #define NPCEVENTRESPONSE_DISTANCE_SQR (768 * 768) // Maximum distance for responding to NPCs
  10. #define NPCEVENTRESPONSE_REFIRE_TIME 15.0 // Time after giving a response before giving any more
  11. #define NPCEVENTRESPONSE_GIVEUP_TIME 4.0 // Time after a response trigger was fired before discarding it without responding
  12. //-----------------------------------------------------------------------------
  13. // Purpose: AI system that makes NPCs verbally respond to game events
  14. //-----------------------------------------------------------------------------
  15. class CNPCEventResponseSystem : public CAutoGameSystemPerFrame
  16. {
  17. public:
  18. CNPCEventResponseSystem( char const *name ) : CAutoGameSystemPerFrame( name )
  19. {
  20. }
  21. void LevelInitPreEntity();
  22. void FrameUpdatePreEntityThink();
  23. void TriggerEvent( const char *pResponse, bool bForce, bool bCancelScript );
  24. private:
  25. float m_flNextEventPoll;
  26. struct storedevent_t
  27. {
  28. float flEventTime;
  29. float flNextResponseTime;
  30. bool bForce;
  31. bool bCancelScript;
  32. bool bPreventExpiration;
  33. };
  34. typedef CUtlDict< storedevent_t, int > EventMap;
  35. EventMap m_ActiveEvents;
  36. };
  37. CNPCEventResponseSystem *NPCEventResponse();
  38. #endif // AI_EVENTRESPONSE_H