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.

46 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef IHASATTRIBUTES_H
  7. #define IHASATTRIBUTES_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. //#include "attribute_manager.h"
  12. class CAttributeManager;
  13. class CAttributeContainer;
  14. class CBaseEntity;
  15. class CAttributeList;
  16. // To allow an entity to have attributes, derive it from IHasAttributes and
  17. // contain an CAttributeManager in it. Then:
  18. // - Call InitializeAttributes() before your entity's Spawn()
  19. // - Call AddAttribute() to add attributes to the entity
  20. // - Call all the CAttributeManager hooks at the appropriate times in your entity.
  21. // To get networking of the attributes to work on your entity:
  22. // - Add this to your entity's send table:
  23. // SendPropDataTable( SENDINFO_DT( m_AttributeManager ), &REFERENCE_SEND_TABLE(DT_AttributeManager) ),
  24. // - Call this inside your entity's OnDataChanged():
  25. // GetAttributeManager()->OnDataChanged( updateType );
  26. //-----------------------------------------------------------------------------
  27. // Purpose: Derive from this if your entity wants to contain attributes.
  28. //-----------------------------------------------------------------------------
  29. class IHasAttributes
  30. {
  31. public:
  32. virtual CAttributeManager *GetAttributeManager( void ) = 0;
  33. virtual CAttributeContainer *GetAttributeContainer( void ) = 0;
  34. virtual CBaseEntity *GetAttributeOwner( void ) = 0;
  35. virtual CAttributeList *GetAttributeList( void ) = 0;
  36. // Reapply yourself to whoever you should be providing attributes to.
  37. virtual void ReapplyProvision( void ) = 0;
  38. };
  39. #endif // IHASATTRIBUTES_H