This article's documentation is for anything that uses the Source engine. Click here for more information.

Trigger push: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(CSGO has new things nw)
m (→‎Inputs: Substituted IO templates)
 
(14 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{base brush|trigger_push}} It is a trigger volume that pushes entities that touch it, ''except'' those with a [[parent]].
{{CD|CTriggerPush|file1=triggers.cpp}}
 
{{this is a|brush entity|name=trigger_push}} It is a trigger volume that pushes entities that touch it, ''except'' those with a [[parent]].
{{code class|CTriggerPush|triggers.cpp}}
{{bug|{{l4d2}} Does not affect Common infected and witches}}
{{bug|{{csgo}} Does not affect [[drone]]s {{confirm}}}}


==Keyvalues==
==Keyvalues==
{{KV|Push Direction (Pitch Yaw Roll)|angle|Angles indicating the direction to push touched entities.}}
{{KV Targetname}}
{{KV|Speed of Push|integer|The speed at which to push entities away, in inches / second.}}
{{KV|Push Direction|intn=pushdir|angle|Angles indicating the direction to push touched entities.
{{KV|Scale force for alternate ticks|float|If nonzero, scale the force by this amount when running with alternate ticks. This fixes problems with an overly large force due to the longer frametime on when running with sv_alternateticks 1.}}
{{note|In {{csgo}} changing this keyvalue via "Point At..." creates a new "angles" property. Copy its value to "Push Direction".}}}}
{{KV|Only Falling Players|boolean|since=CSGO|Only affect players if they are falling (and not pressing jump)}}
{{KV|Speed of Push|intn=speed|integer|The speed at which to push entities away, in inches / second.}}
{{KV|Player fall speed|float|since=CSGO|Player must be falling this fast for push to happen}}
{{KV|Scale force for alternate ticks|intn=alternateticksfix|float|If nonzero, scale the force by this amount when running with alternate ticks. This fixes problems with an overly large force due to the longer frametime on when running with <code>sv_alternateticks 1</code>.}}
{{KV|Trigger on Start Touch|intn=triggeronstarttouch|boolean|Trigger on start touch instead of on touch.|only=l4d2}}
{{KV|Only Falling Players|intn=OnlyFallingPlayers|boolean|since=CSGO|also=GMOD|Only affect players if they are falling (and not pressing jump).}}
{{KV|Player fall speed|intn=FallingSpeedThreshold|float|since=CSGO|also=GMOD|A player must be falling this fast for them to be pushed.}}
{{KV BaseTrigger}}


==Flags==
==Flags==
* 128 : Once Only (possibly means set velocity rather than apply acceleration)
{{minititle|TriggerPush}}
* 256 : Affects Ladders (Half-Life 2)
{{Fl|128|Once Only (possibly means set velocity rather than apply acceleration)}}
{{Fl Trigger}}
{{Fl|256|Affects Ladders (Half-Life 2)}}
* 4096 : Disallow bots {{tf2}}
{{Fl BaseTrigger}}
{{Fl|4096|Correctly account for object mass (<code>trigger_push</code> used to assume 100Kg) and multiple component physics objects (car, blob...)|since={{as}}}}


==Inputs==
==Inputs==
{{I Trigger}}
{{I|SetPushSpeed|param=int|Set the push speed in inches / second.|only=l4d2}}
{{I|SetPushDirection|param=vector|Sets the push angle of the trigger.|since=AS|also=GMOD}}
{{I|SetSpeed|param=int|Sets the push speed. Still takes alternate tick keyvalue into account.|only={{P2CE}}}}
{{I BaseTrigger}}


==Outputs==
==Outputs==
{{O Trigger}}
{{O BaseTrigger}}
 
== See Also ==
* {{ent|script_trigger_push}}

Latest revision as of 21:47, 19 April 2025

C++ Class hierarchy
CTriggerPush
CBaseTrigger
CBaseToggle
CBaseEntity
C++ triggers.cpp

trigger_push is a brush entity available in all Source Source games. It is a trigger volume that pushes entities that touch it, except those with a parent.

Icon-Bug.pngBug:Left 4 Dead 2 Does not affect Common infected and witches  [todo tested in ?]
Icon-Bug.pngBug:Counter-Strike: Global Offensive Does not affect drones [confirm]  [todo tested in ?]

Keyvalues

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

Push Direction (pushdir) <angle>
Angles indicating the direction to push touched entities.
Note.pngNote:In Counter-Strike: Global Offensive changing this keyvalue via "Point At..." creates a new "angles" property. Copy its value to "Push Direction".
Speed of Push (speed) <integer>
The speed at which to push entities away, in inches / second.
Scale force for alternate ticks (alternateticksfix) <float>
If nonzero, scale the force by this amount when running with alternate ticks. This fixes problems with an overly large force due to the longer frametime on when running with sv_alternateticks 1.
Trigger on Start Touch (triggeronstarttouch) <boolean> (only in Left 4 Dead 2)
Trigger on start touch instead of on touch.
Only Falling Players (OnlyFallingPlayers) <boolean> (in all games since Counter-Strike: Global Offensive) (also in Garry's Mod)
Only affect players if they are falling (and not pressing jump).
Player fall speed (FallingSpeedThreshold) <float> (in all games since Counter-Strike: Global Offensive) (also in Garry's Mod)
A player must be falling this fast for them to be pushed.
BaseTrigger
Filter Name (filtername) <filter>
A filter entity to test potential activators against.
Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).

Flags

TriggerPush:

Once Only (possibly means set velocity rather than apply acceleration) : [128]
Affects Ladders (Half-Life 2) : [256]
BaseTrigger
Everything (not including physics debris) : [64]
Clients (Survivors, Special Infected, Tanks Left 4 Dead seriesLeft 4 Dead series) : [1]
Only clients in vehicles : [32]
Only clients *not* in vehicles : [512]
Disallow Bots (removed since Left 4 Dead) : [4096]
NPCs (Common Infected, Witches Left 4 Dead seriesLeft 4 Dead series) : [2]
Only player ally NPCs : [16]
Only NPCs in vehicles (respects player ally flag) : [2048]
Physics Objects (not including physics debris) : [8]
Physics debris (include also physics debris) : [1024]
Pushables (Passes entities with classname func_pushable) : [4] Obsolete
Deprecated.
Equivalent to using Everything + filter_activator_class that filters func_pushable.
Correctly account for object mass (trigger_push used to assume 100Kg) and multiple component physics objects (car, blob...) : [4096] (in all games since Alien Swarm)

Inputs

SetPushSpeed <integerRedirectInput/integer> (only in Left 4 Dead 2)
Set the push speed in inches / second.
SetPushDirection <vectorRedirectInput/Vector> (in all games since Alien Swarm) (also in Garry's Mod)
Sets the push angle of the trigger.
SetSpeed <integerRedirectInput/integer> (only in Portal 2: Community Edition)
Sets the push speed. Still takes alternate tick keyvalue into account.
BaseTrigger
Toggle
Toggles this trigger between enabled and disabled states.
Enable
Enable trigger
Disable
Disable trigger
TouchTest  (in all games since Source 2007)
Triggers either the OnTouching or OnNotTouching outputs for whether anything is touching this entity.
Icon-Bug.pngBug:Sleeping prop_physics will never fire "OnTouching". Also applies to entities using prop_physics as base.  (tested in: Half-Life 2)
StartTouch  (in all games since Source 2007) !FGD
Behave as if the !caller entity had just entered the trigger volume. Accepts non-physical entities.
EndTouch  (in all games since Source 2007) !FGD
Behave as if !caller had just exited the trigger volume.
DisableAndEndTouch  (only in Source 2013 MultiplayerTeam Fortress 2 branch)
Disables this trigger and calls EndTouch on all currently-touching entities.

Outputs

BaseTrigger
OnStartTouch
!activator = entity that caused this output
!caller = this entity
Fired when a valid entity starts touching this trigger.
OnStartTouchAll
!activator = entity that caused this output
!caller = this entity
Fired when a valid entity starts touching this trigger, and no other entities are touching it. If there are any other entities touching the trigger when a new one begins to touch, only OnStartTouch will fire.
OnEndTouch
!activator = entity that caused this output
!caller = this entity
Fired when a valid entity stops touching this trigger.
Note.pngNote:Will also fire for entities touching it when trigger is disabled via Disable input
Warning.pngWarning:This includes entities which are deleted while inside the trigger. In this case !activator will be invalid.
Warning.pngWarning:OnEndTouch can fire before OnStartTouch under certain circumstances[How?] where both are fired on the same tick and each have the same delay.
Note.pngFix:Add a slight delay to OnEndTouch.
OnEndTouchAll
!activator = entity that caused this output
!caller = this entity
Fired when all valid entities stop touching this trigger.
OnTouching  (in all games since Source 2007)
!activator = !caller = this entity
Fired if something is currently touching this trigger when TouchTest is fired.
OnNotTouching  (in all games since Source 2007)
!activator = !caller = this entity
Fired if nothing is currently touching this trigger when TouchTest is fired.

See Also