Filter activator context

From Valve Developer Community
Revision as of 04:39, 28 June 2023 by GAMMACASE (talk | contribs) (Added a note on when filter passes based on the value stored in context.)
Jump to navigation Jump to search
English (en)Translate (Translate)
Filter name.png
C++ Class hierarchy
CFilterContext
CBaseFilter
CLogicalEntity
CServerOnlyEntity
CBaseEntity
C++ filters.cpp

Template:Base point It is a filter that filters by a single context on the activator. It takes the name only, with no specific value.[confirm]

Note.pngNote:The Filter Context keyvalue uses ResponseContext internally, which is the name of the original keyvalue used to specify response contexts in other entities. Since this filter can only filter by a single context without a value attached, actual unfilterable contexts can only be added to this entity via inputs.
C++ In code, it is represented by theCFilterContextclass, defined in thefilters.cppfile.

Keyvalues

Filter Context (ResponseContext) <string>
The context to filter by.
Note.pngNote:Filter would pass only if the context value is greater than 0.

BaseFilter:

Filter mode (Negated) <boolean>
Inverts the filter, making the specified criteria fail and all others pass.
Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Inputs

BaseFilter:

TestActivator <variantRedirectInput/variant>
Tests the entity that called the input (the !activator) against the filter, and fires either the OnPass or OnFail output. (the parameter it takes is unused)
Icon-Bug.pngBug:Calling this input will cause the server to crash if the !activator entity no longer exists. Do not use this input to test any entities which may be asynchronously deleted, such as players or projectiles, or in an i/o chain which might be initiated by entity deletion, such as the OnEndTouch output of a trigger.

Outputs

BaseFilter:

OnPass
OnFail
!activator = activator of TestActivator input
!caller = this entity
One of these will fire when TestActivator input is sent, depending on if the activator is allowed by the filter or not.