Use

From Valve Developer Community
Revision as of 17:48, 26 June 2018 by TeamSpen210 (talk | contribs) (Parenting allows passing use inputs to the parent.)
Jump to navigation Jump to search

All entities have a Use input, though many do nothing in response to it. There are four methods to invoke it:

  1. A player looking at the entity and using the +use console command (this is normally done by pressing the e key)
  2. An entity output that specifies the Use input, or not specifying any input.
  3. Directly calling the C++ function

Use typically performs the action players most expect when interacting with the entity (e.g. opening/closing a door, picking up a physics object).

If an entity without a use function is parented to one which does, it will passthrough the input to the parent.

Programming

Although there is always a Use input, the actual Use function of an entity starts null. It can be assigned at any time with SetUse( void *SomeFunc(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) ).

It doesn't appear possible to specify USE_TYPE or value through the I/O system.