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

Logic relay: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(29 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{otherlang2
{{LanguageBar}}
|ru=logic_relay:ru
{{TabsBar|main=s2|base=logic relay}}
}}
{{This is a|logical entity|name=logic_relay|sprite=1}}  
 
{{CD|CLogicRelay|file1=logicrelay.cpp}}
{{base point|logic_relay|sprite=1}} It is a message forwarder. It can be used to fire many [[output]]s at once from just one input, or, by being disabled, to break an I/O chain. It can also be very helpful for organization and keeping you from having to edit MANY instances of the same outputs, as opposed to just one.
It is a Output forwarder, which can be used to fire many [[Inputs and Outputs#Outputs|output]]s at once from just one input, or, by being disabled, to break an I/O chain. It can also be very helpful for organization and keeping you from having to edit MANY instances of the same outputs, as opposed to just one.


After a <code>logic_relay</code> 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 with the "Allow fast retrigger" spawnflag.
After a <code>logic_relay</code> 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 with the "Allow fast retrigger" spawnflag.
{{clr}}


==Keyvalues==
{{ent|logic_relay}} combines the functionality of {{ent|trigger_relay|game=Half-Life: Source}} and {{ent|multi_manager|game=Half-Life: Source}} from {{goldsrc|2}}. The older entities still exist in {{hls|2}}, but are deprecated.
__NOTOC__
== Keyvalues ==
{{KV Targetname}}
{{KV Targetname}}
{{KV EnableDisable}}
{{KV|Start Disabled|boolean|intn=StartDisabled|When disabled <code>OnTrigger</code> output won't fire}}
 
== Flags ==
{{fl|1|Only trigger once}}
{{fl|2|Allow fast retrigger}}  


==Flags==
== Inputs ==
*1: Only trigger once
{{I|Trigger|param=void|Trigger the relay, causing its OnTrigger output to fire if it is enabled.}}
*2: Allow fast retrigger
{{I|Enable|param=void|Allows the relay to fire the OnTrigger outputs after being disabled.}}
{{I|Disable|param=void|Prevents the relay from firing OnTrigger outputs in response to Trigger inputs.}}
{{I|Toggle|param=void|Toggle the relay between enabled and disabled.}}
{{I|CancelPending|param=void|Cancel any events fired by this relay that are currently pending in the I/O event queue
:{{bug|hidetested=1|If the caller of this input is the logic_relay itself it will break the I/O event queue which leads to a crash.}}}}
{{I|EnableRefire|param=void|Automatically fired on a relay after any delayed outputs finish firing, allowing it to fire again.|nofgd=1}}
{{I|TriggerWithParameter|param=variant|only={{mapbase}}|Triggers the relay with a parameter, causing its OnTriggerParameter output to fire if it is enabled.}}


==Inputs==
== Outputs ==
{{IO|Enable|Allows the relay to fire the OnTrigger outputs after being disabled.}}
{{O|OnSpawn|param=void|ac-is-this=1|Fired when the relay is spawned. If the relay is set to only trigger once, it will delete itself after firing this output.{{note|Every level load (including save loads!) triggers this output, unless "Fire once only" is checked.}}}}
{{IO|Disable|Prevents the relay from firing OnTrigger outputs in response to Trigger inputs.}}
{{O|OnTrigger|param=void|activator = activator of Trigger input|Fired when the relay is triggered. If the relay is set to only trigger once, it will delete itself after firing this output.}}
{{IO|Trigger|Trigger the relay, causing its OnTrigger output to fire if it is enabled.}}
{{O|OnTriggerParameter|param=variant|only={{mapbase}}|activator = activator of TriggerWithParameter input|Fired when the relay is triggered with a parameter. If the relay is set to only trigger once, it will delete itself after firing this output.}}
{{IO|Toggle|Toggle the relay between enabled and disabled.}}
{{IO|CancelPending|Cancel any events fired by this relay that are currently pending in the I/O event queue.}}
{{IO|EnableRefire|Automatically fired on a relay after any delayed outputs finish firing, allowing it to fire again.|nofgd=1}}
{{IO|TriggerWithParameter|param=string|only={{mapbase}}|Triggers the relay with a parameter, causing its OnTriggerParameter output to fire if it is enabled.}}
{{I Targetname}}


==Outputs==
== See Also ==
{{IO|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|Every level load (including save loads!) triggers this output, unless "Fire once only" is checked.}}}}
* {{ent|logic_case}}
{{IO|OnTrigger|Fired when the relay is triggered. If the relay is set to only trigger once, it will delete itself after firing this output.}}
{{IO|OnTriggerParameter|param=string|only={{mapbase}}|Fired when the relay is triggered with a parameter. If the relay is set to only trigger once, it will delete itself after firing this output.}}
{{O Targetname}}


[[Category:IO System]]
[[Category:IO System]]

Latest revision as of 13:24, 7 May 2025

English (en)Русский (ru)中文 (zh)Translate (Translate)
Logic relay.png

logic_relay is a logical entity available in all Source Source games.

C++ Class hierarchy
CLogicRelay
CLogicalEntity
CServerOnlyEntity
CBaseEntity
C++ logicrelay.cpp

It is a Output forwarder, which can be used to fire many outputs at once from just one input, or, by being disabled, to break an I/O chain. It can also be very helpful for organization and keeping you from having to edit MANY instances of the same outputs, as opposed to just one.

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 with the "Allow fast retrigger" spawnflag.

logic_relay combines the functionality of trigger_relay and multi_manager from GoldSrc GoldSrc. The older entities still exist in Half-Life: Source Half-Life: Source, but are deprecated.

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

Start Disabled (StartDisabled) <boolean>
When disabled OnTrigger output won't fire

Flags

Only trigger once : [1]
Allow fast retrigger : [2]

Inputs

Trigger <void>
Trigger the relay, causing its OnTrigger output to fire if it is enabled.
Enable <void>
Allows the relay to fire the OnTrigger outputs after being disabled.
Disable <void>
Prevents the relay from firing OnTrigger outputs in response to Trigger inputs.
Toggle <void>
Toggle the relay between enabled and disabled.
CancelPending <void>
Cancel any events fired by this relay that are currently pending in the I/O event queue
Icon-Bug.pngBug:If the caller of this input is the logic_relay itself it will break the I/O event queue which leads to a crash.
EnableRefire <void> !FGD
Automatically fired on a relay after any delayed outputs finish firing, allowing it to fire again.
TriggerWithParameter <variantRedirectInput/variant> (only in Mapbase)
Triggers the relay with a parameter, causing its OnTriggerParameter output to fire if it is enabled.

Outputs

OnSpawn <void>
!activator = !caller = this entity
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 <void>
!activator = activator of Trigger input
!caller = this entity
Fired when the relay is triggered. If the relay is set to only trigger once, it will delete itself after firing this output.
OnTriggerParameter <variantRedirectOutput/variant> (only in Mapbase)
!activator = activator of TriggerWithParameter input
!caller = this entity
Fired when the relay is triggered with a parameter. If the relay is set to only trigger once, it will delete itself after firing this output.

See Also