
Common to all entities:
- In the class declaration public: DECLARE_CLASS is a class declaration defined
in networkvar.h
- In the class declaration public: DECLARE_DATADESC signify that we'll use a
data
description table in the class implementation.
- Right after the class declaration: LINK_ENTITY_TO_CLASS( hammer_classname,
class); hammer_classname is the entity name that will appear in Hammer, this
instruction link it to the class defined above.
- BEGIN_DATADESC( class ) : Start the data description for the class
- DEFINE_X's : see data
description table
- END_DATADESC() : End the data description for the class
- Client-side entities must follow thie "C_" convention (ex: class
C_MyEntity : public C_BaseEntity)
- Add the class definition in the mod's .FGD file.
Logical Entity (CLogicalEntity) :
- This entity type has no position, no visual, its receives input from the game
map and send output according to game state. (ex: timer, run-tim logic operations,
physic constraints)
- Must derive from CLogicalEntity wich derivates from CServerOnlyEntity (will
not transmit data to client)
- COutputEvent is a parameterless entity event, it implements void "FireOutput(
CBaseEntity *pActivator, CBaseEntity *pCaller, float fDelay = 0 )".
Brush Entity (CBaseToggle) :
- This entity is constructed in hammer using Brushes (static architectural
structures). Brush entities can be statics volumes (triggers, portals, wall
health), or moving entities (platform, door, button, gun target).
- Can derive from CBaseToggle wich derivates from CBaseEntity.
- Declare the function type of the entity DEFINE_ENTITYFUNC() : see data
description table
Point Entity (CPointEntity) :
- Exists only at one point in the map. (ex : physic forces)
Model Entity (CBaseAnimating) :
- This entity has a visual component, can move and can be interracted with.
(ex: NPCs, Gibs, mines, crane, ammo)
- Must derive from CBaseAnimating wich derivates from CBaseEntity.
- The asset associated with this entity must be precached using the Precache()
method. Precaching
asset.
- This entity must be spawned using the Spawn() method.
- The logic sequence of an entity creation is Spawn()->Precache()->Activate()