Nuclide
Software Development Kit for id Technology
|
Entity class declaration system. More...
Entity class declaration system.
An 'entityDef' is a type of Declaration Files containing spawn data. It is used for prefab entity configurations but is also the very definitions base for designing actors, items and weapons.
These definitions are a further abstraction from how we view entity definitions. this system tries to be mostly compatible with the def system in id Tech 4 [1] (Doom 3, Quake 4, Prey, etc.) but does not guarantee to be compatible as-is.
The first references to such a system existing can be found when Team Fortress Software was working on Team Fortress 2, originally on Quake II's engine. [2]
The gist is, that an entity def can set a base spawnclass (e.g. func_door) and populate it with key/value pairs.
Using this example definition, we can re-invent func_illusionary using an already existing entity class (func_wall), making it non-solid:
We also have features exclusive to our entityDef format. In the following example, when thebody
key equals 1
, it will switch skin
to id 4
. You can have as many conditions as you like.
It essentially allows developers to configure other fields when certain conditions are met.
Another feature exclusive to our entityDef spec is how we can tie model event callbacks to the tried and true I/O system:
This way, an animation that is played by a weapon or a monster can call back to in-game events without you having to dig into the source code.
Classes | |
struct | entityDef_t |
Data holding EntityDef entries. More... | |
Functions | |
void | EntityDef_Init (void) |
void | EntityDef_DebugList (void) |
string | EntityDef_GetKeyValue (string, string) |
Retrieves the value of a specific key defined within an EntityDef. More... | |
int | EntityDef_NetIDFromName (string) |
string | EntityDef_NameFromNetID (int) |
int | EntityDef_IDFromName (string) |
string | EntityDef_GetSpawnData (int) |
bool | EntityDef_HasSpawnClass (string className) |
Checks if an entity class was defined in an EntityDef. More... | |
bool | EntityDef_Precache (string) |
NSEntity | EntityDef_SwitchClass (NSEntity target, string className) |
NSEntity | Entity_CreateClass (string className) |
Always returns a valid entity. More... | |
NSEntity | EntityDef_NewClassname (string className) |
Macros | |
#define | ENTITYDEF_MAX 256 |
Can be redefined in the server its progs.src file. More... | |
Enumerations | |
enum | { EDEFTWEAK_EQ = 0 , EDEFTWEAK_LT , EDEFTWEAK_GT , EDEFTWEAK_NOT , EDEFTWEAK_CONTAINS } |
Options for EntityDef checks. More... | |
NSEntity Entity_CreateClass | ( | string | className | ) |
Always returns a valid entity.
Spawns an entity of a class, guaranteed to be valid.
Even if the entity def does not exist.
void EntityDef_DebugList | ( | void | ) |
string EntityDef_GetKeyValue | ( | string | className, |
string | keyName | ||
) |
Retrieves the value of a specific key defined within an EntityDef.
className | specifies which class definition to look in. |
keyName | specifies the 'key' we want to know its value of. |
string EntityDef_GetSpawnData | ( | int | defNum | ) |
bool EntityDef_HasSpawnClass | ( | string | className | ) |
Checks if an entity class was defined in an EntityDef.
You can then use EntityDef_GetKeyValue() to get various key values from said EntityDef.
className | specifies which class definition to look for. |
int EntityDef_IDFromName | ( | string | defName | ) |
void EntityDef_Init | ( | void | ) |
string EntityDef_NameFromNetID | ( | int | defNum | ) |
int EntityDef_NetIDFromName | ( | string | defName | ) |
NSEntity EntityDef_NewClassname | ( | string | className | ) |
bool EntityDef_Precache | ( | string | defName | ) |
#define ENTITYDEF_MAX 256 |
Can be redefined in the server its progs.src file.