CBaseEntity: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 7: Line 7:
{{important|Following Keyvalues / Inputs / Outputs are available for all entities that inherit this class, but may be overridden by game code.}}
{{important|Following Keyvalues / Inputs / Outputs are available for all entities that inherit this class, but may be overridden by game code.}}


=== Keyvalues ===
== Keyvalues ==
{{todo|Document [[Template:KV BaseEntity/doc/Uncovered Keyvalues|the other KVs from this class]] as well.}}
{{todo|Document [[Template:KV BaseEntity/doc/Uncovered Keyvalues|the other KVs from this class]] as well.}}
{{KV BaseEntity}}
{{KV BaseEntity}}
{{KV|Model|intn=model|string|In-game representation of the entity to display. For [[brush entities]], this is a reference to a non-zero [[bmodel]] index in the current BSP. For [[point entities]], this is the path to an [[MDL]] [[model]] or [[VMT]] [[sprite]], relative to the game's root directory. Not all entities will actually render the model, and only specific entities will [[precache]] the model defined here (non-precached models cannot be displayed).}}
{{KV|Model|intn=model|string|In-game representation of the entity to display. For [[brush entities]], this is a reference to a non-zero [[bmodel]] index in the current BSP. For [[point entities]], this is the path to an [[MDL]] [[model]] or [[VMT]] [[sprite]], relative to the game's root directory. Not all entities will actually render the model, and only specific entities will [[precache]] the model defined here (non-precached models cannot be displayed).}}


=== Inputs ===
== Inputs ==
{{I BaseEntity}}
{{I BaseEntity}}


=== Outputs ===
== Outputs ==
{{O BaseEntity|l4d=1}}
{{O BaseEntity|l4d=1}}



Revision as of 22:01, 2 September 2024

English (en)中文 (zh)Translate (Translate)
C++ Class hierarchy
CBaseEntity
IServerEntity
IServerUnknown
IHandleEntity
C++ baseentity.cpp

The base class for all entities.

Icon-Important.pngImportant:Following Keyvalues / Inputs / Outputs are available for all entities that inherit this class, but may be overridden by game code.

Keyvalues

Todo: Document the other KVs from this class as well.


Model (model) <string>
In-game representation of the entity to display. For brush entities, this is a reference to a non-zero bmodel index in the current BSP. For point entities, this is the path to an MDL model or VMT sprite, relative to the game's root directory. Not all entities will actually render the model, and only specific entities will precache the model defined here (non-precached models cannot be displayed).

Inputs

Outputs

Programming related

To get the class name of an entity, use

entity->edict()->GetClassName();

Asserts

Client

Problem:

// Model could not be found
Assert( !"Model could not be found, index is -1" );

Solution:

  • Check your model name three times.
  • Precache your model on both server and client.

See Also