ObjectCaps

Remember to check for any notes left by the tagger at this article's talk page.

For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.
Object capabilities flags are defined in baseentity_shared.h. They are specified using entity's ObjectCaps method and determine certain capabilities of entities like +USE behaviour, save/restore, level transition.
CBaseEntity determines object flags as follows (see CBaseEntity::ObjectCaps):
- If we have a parent first get the parent's ObjectCaps
- From the parent's ObjectCaps we are allowed to keep only use flags ( FCAP_IMPULSE_USE | FCAP_CONTINUOUS_USE | FCAP_ONOFF_USE | FCAP_DIRECTIONAL_USE )
- And if we don't use a brush model we can also keep FCAP_ACROSS_TRANSITION
- Additionally if our parent is a player entity add FCAP_ACROSS_TRANSITION whether we have brush model or not (which means parenting brushes entities to a player and transitioning with it may cause a crash as bmodels differ by map)
- If we don't have a parent nor a brush model our ObjectCaps are FCAP_ACROSS_TRANSITION otherwise we have none
Subclasses can add ObjectCaps as needed. For example CPointEntity does the following
virtual int ObjectCaps( void ) { return BaseClass::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
which means any subclasses of CPointEntity won't go through level transition when using trigger_changelevel[1] unless a subclass overrides this behaviour (presence of globalname can also override this behaviour)
Flags
// entity capabilities
// These are caps bits to indicate what an object's capabilities (currently used for +USE, save/restore and level transitions)
#define FCAP_MUST_SPAWN 0x00000001 // Spawn after restore
#define FCAP_ACROSS_TRANSITION 0x00000002 // should transfer between transitions
// UNDONE: This will ignore transition volumes (trigger_transition), but not the PVS!!!
#define FCAP_FORCE_TRANSITION 0x00000004 // ALWAYS goes across transitions
#define FCAP_NOTIFY_ON_TRANSITION 0x00000008 // Entity will receive Inside/Outside transition inputs when a transition occurs
#define FCAP_IMPULSE_USE 0x00000010 // can be used by the player
#define FCAP_CONTINUOUS_USE 0x00000020 // can be used by the player
#define FCAP_ONOFF_USE 0x00000040 // can be used by the player
#define FCAP_DIRECTIONAL_USE 0x00000080 // Player sends +/- 1 when using (currently only tracktrains)
// NOTE: Normally +USE only works in direct line of sight. Add these caps for additional searches
#define FCAP_USE_ONGROUND 0x00000100
#define FCAP_USE_IN_RADIUS 0x00000200
#define FCAP_SAVE_NON_NETWORKABLE 0x00000400
#define FCAP_MASTER 0x10000000 // Can be used to "master" other entities (like multisource)
#define FCAP_WCEDIT_POSITION 0x40000000 // Can change position and update Hammer in edit mode
#define FCAP_DONT_SAVE 0x80000000 // Don't save this
Use flags
For entity to be usable by player via +use one of the following flags must be present in entity's ObjectCaps.
FCAP_IMPULSE_USE
Players can use this entity by pressing use key For example prop_physics (pickup in many games), prop_dynamic (forwarding use to parent), func_button.
FCAP_CONTINUOUS_USE
Players can use this entity by holding use key For example momentary_rot_button
FCAP_ONOFF_USE
Seems to be intended to make player do use type USE_ON when pressing use key, and USE_OFF when unpressing it Only used by obsolete func_pushable
FCAP_DIRECTIONAL_USE
[Todo] Used by func_tracktrain controls.
Use flag modifiers
These flag decide additional technicalities of the use flags above.
FCAP_USE_ONGROUND
Consider eligible for use when player stands on it ([Todo] better description)
FCAP_USE_IN_RADIUS
Consider eligible for use when in the player's radius determined by PLAYER_USE_RADIUS macro (default 80). ([Todo] better description)
FCAP_ACROSS_TRANSITION
[Todo]
FCAP_FORCE_TRANSITION
Ignores trigger_transition volumes when used[2], but still must be in PVS of info_landmark[3].
FCAP_NOTIFY_ON_TRANSITION
When entity has this flag then trigger_changelevel will send OutsideTransition or InsideTransition inputs to it. Entities that have this flag:
- Subclasses of CAI_GoalEntity
- Subclasses of CAI_BaseNPC
- prop_vehicle_jeep
- info_target_command_point
- npc_helicopter - when AlwaysTransition keyvalue is true
List of entities that have OutsideTransition or InsideTransition inputs: [Todo]
FCAP_MUST_SPAWN
Entity's Spawn function is called instead of its Precache function during save load.[4] Doesn't seem that any official entity uses this flag.
FCAP_SAVE_NON_NETWORKABLE
Flag to determine that clientside entity can be saved in a save file. Used by client_ragdoll
FCAP_DONT_SAVE
[Todo]
Other
FCAP_WCEDIT_POSITION
The following are able to utilize hammer_update_entity command.
FCAP_MASTER
Obsolete remnant from GoldSrc. Certain entities[Todo] can still specify master and only multisource has this flag and thus is capable of being one. (see UTIL_IsMasterTriggered)