This article's documentation is for Source 2. Click here for more information.

logic_relay

From Valve Developer Community
Jump to: navigation, search
class hierarchy
CLogicRelay defined in logicrelay.cpp
CLogicalEntity
CServerOnlyEntity
CBaseEntity
Logic relay.png

logic_relay is a point entity available in all Source 2 Source 2 games. It acts as a message forwarder and can be disabled to prevent forwarding outputs. Useful as an intermediary between one entity and another for turning on or off an I/O connection, or as a container for holding a set of outputs that can be triggered from multiple places.

After a logic_relay is triggered, it cannot be triggered again until all of its outputs are fired. This is useful for when a relay has a sequence of delayed outputs that shouldn't be repeated until the sequence is finished. This behavior can be disabled by setting FastRetrigger to true.

Keyvalues

Name (targetname) <string>
The targetname that other entities refer to this entity by.

EnableDisable:

Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).
Trigger Once (TriggerOnce) <boolean>
Deletes the logic relay after firing an OnTrigger Output or a connected OnSpawn output
Fast Retrigger (FastRetrigger) <boolean>
Without this, the logic_relay will wait until all inputs connected to OnTrigger have fired before retriggering
Pass through caller (PassthroughCaller) <boolean>
If set, this logic_relay will be ignored by !caller in downstream IO connections. Instead, the previous caller in the IO chain will be found by !caller.

Inputs

Enable
Allows the relay to fire the OnTrigger outputs after being disabled.
Disable
Prevents the relay from firing OnTrigger outputs in response to Trigger inputs.
Trigger
Trigger the relay, causing its OnTrigger output to fire if it is enabled.
Toggle
Toggle the relay between enabled and disabled.
CancelPending
Cancel any events fired by this relay that are currently pending in the I/O event queue
Icon-Bug.pngBug:Using CancelPending on itself breaks the Service Queue which leads to a crash.

Base:

RunScriptFile
Load and execute a script file.
RunScriptCode
Execute a fragment of script code.
CallScriptFunction
Call a script function.
CallPrivateScriptFunction
Calls a script function from this entity's private script scope.
CallGlobalScriptFunction
Calls a script function in the global script scope.
Kill
Removes this entity from the world.
KillHierarchy
Removes this entity and all its children from the world.
AddOutput
Adds an entity I/O connection to this entity. Parameter format: OutputName→TargetName→InputName→Parameter→Delay→MaxRefires
FireUser1 to FireUser4
Fires the respectiveOnUseroutputs; see User Inputs and Outputs.

Outputs

OnSpawn
Fired when the relay is spawned. If the relay is set to only trigger once, it will delete itself after firing this output.
Note.pngNote:Every level load (including save loads!) triggers this output, unless "Fire once only" is checked.
OnTrigger
Fired when the relay is triggered. If the relay is set to only trigger once, it will delete itself after firing this output.

Base:

OnUser1 to OnUser4
These outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.
OnKilled
This output fires when the entity is killed and removed from the game. Parameter is the inflictor.