ObjectCaps

From Valve Developer Community
Jump to navigation Jump to search
Icon-under construction-blue.png
This is a draft page. It is a work in progress open to editing by anyone.
Remember to check for any notes left by the tagger at this article's talk page.
Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality.
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.

Stub

This article or section is a stub. You can help by expanding it.

Object capabilities flags are defined in baseentity_shared.h. They are specified using entity's ObjectCaps method and determines +USE, save/restore and level transition capabilities of entities.


CBaseEntity determines object flags as follows (see CBaseEntity::ObjectCaps):

  • If we have a parent first get the parent's ObjectCaps
  1. From the parent's ObjectCaps we are allowed to keep only ( FCAP_IMPULSE_USE | FCAP_CONTINUOUS_USE | FCAP_ONOFF_USE | FCAP_DIRECTIONAL_USE )
  2. And if we don't use a brush model we can also keep FCAP_ACROSS_TRANSITION
  3. Additionally if our parent is a player entity add FCAP_ACROSS_TRANSITION whether we have brush model or not
  • 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 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

FCAP_SAVE_NON_NETWORKABLE

Flag to determine that clientside entity can be saved in a save file. Used by client_ragdoll

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)

See also