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