Logic gate (Entity): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Added flags)
(Use correct BaseEntity templates)
Line 19: Line 19:
{{KV|Start Disabled|intn=StartDisabled|boolean|If it should start disabled}}
{{KV|Start Disabled|intn=StartDisabled|boolean|If it should start disabled}}
{{KV|Comparison Mode|intn=mode|choices|The comparison mode to use}}
{{KV|Comparison Mode|intn=mode|choices|The comparison mode to use}}
{{KV Angles}}
{{KV BaseEntity|l4d2=1}}
{{KV Targetname}}
{{KV Parentname}}


==Inputs==
==Inputs==
Line 30: Line 28:
{{I EnableDisable}}
{{I EnableDisable}}
{{I Toggle}}
{{I Toggle}}
{{I BaseEntity|l4d2=1|portal2=1}}


==Outputs==
==Outputs==
Line 35: Line 34:
{{IO|OnResultFalse|Called when the result is false}}
{{IO|OnResultFalse|Called when the result is false}}
{{IO|OutValue|Called when GetValue is fired. Automatically fills the parameter with the current result state (0, 1). Similar to [[math_counter]]}}
{{IO|OutValue|Called when GetValue is fired. Automatically fills the parameter with the current result state (0, 1). Similar to [[math_counter]]}}
{{O Targetname}}
{{O BaseEntity}}


== See also ==
== See also ==
*[[math_counter]]
*[[math_counter]]
*[[logic gate]]
*[[logic gate]]

Revision as of 10:04, 2 August 2020

Template:P2CE point This logic entity acts as a simple boolean value comparator with two inputs. When disabled, this entity will still accept inputs, but not fire outputs!

Supported comparison modes are:

  1. AND
  2. OR
  3. NOT
  4. NAND
  5. NOR
  6. XOR
  7. XNOR

(This is the internal order, which is used for the SetMode input. Note that they internally start from 0)

Flags

  • 1: Spawn A enabled
  • 2: Spawn B enabled
  • 4: Output on every input (even if result doesn't change)

Keyvalues

Start Disabled (StartDisabled) <boolean>
If it should start disabled
Comparison Mode (mode) <choices>
The comparison mode to use


Inputs

SetStateA
Sets the boolean state of the A value
SetStateB
Sets the boolean state of the B value
SetMode
Sets the comparison mode. Input the index of the comparison mode as seen above - 1 (Starting from 0)
GetValue
When fired, the logic_gate will call its OutValue outputs, using the current result state as the parameter (0, 1). Similar to math_counter)

EnableDisable:

Enable / Disable
Enable/disable this entity from performing its task. It might also disappear from view.
Toggle:
Toggle
Toggle the enabled/disabled status of this entity.


Outputs

OnResultTrue
Called when the state is true
OnResultFalse
Called when the result is false
OutValue
Called when GetValue is fired. Automatically fills the parameter with the current result state (0, 1). Similar to math_counter


See also