calc_state

A calc_state combines the states of two masters with a logic operation
such as AND or OR. It is a master itself, and it is on while the result is true.
Every time an entity checks whether its Master lets it work, a calc_state it names checks both of its
operands again at that moment. When you trigger the calc_state, it also works out the result and fires its
targets.
Attributes
targetnameSets the name you put in another entity's Master key, and triggering the entity by this name works out the result and fires its targets. See Common keys.
left_operandNames the first master, such as an env_state, a multisource or another calc_state. With !activator, *locus or *player, it uses the entity that started the chain of triggers. A ~ in front of the name doesn't turn the state around, so use NAND or NOR for that.
If you leave this key empty, the entity has no result.
right_operandNames the second master, in the same way as Operand 1.
If you leave this key empty, the entity has no result.
operationPicks how the two states give the result.
- AND (0) - True when both operands are on
- OR (1) - True when at least one operand is on
- NAND (2) - True unless both operands are on
- NOR (3) - True when both operands are off
- XOR (4) - True when one operand is on and the other is off
- NXOR (5) - True when both operands are on or both are off
AND (0)left_fallbackSets what counts as the state of Operand 1 when no entity has that name.
- Treat as error (0) - There is no result, so the master is off and the entity fires nothing
- Treat as Off (1) - The operand counts as off
- Treat as On (2) - The operand counts as on
Treat as error (0)right_fallbackSets what counts as the state of Operand 2 when no entity has that name.
- Treat as error (0) - There is no result, so the master is off and the entity fires nothing
- Treat as Off (1) - The operand counts as off
- Treat as On (2) - The operand counts as on
Treat as error (0)targetNames the entities to trigger when you trigger the entity, with the use type On if the result is true and with Off if it is false.
fire_when_falseNames the entities to trigger when you trigger the entity and the result is false.
fire_when_trueNames the entities to trigger when you trigger the entity and the result is true.
Flags
2Debug ModeWhen you trigger the entity, the console shows the state of each operand and the result, if developer 1 is set in the console
Notes
- An operand that names an entity which isn't a master counts as on
- If the entity has no result, the master is off and the entity fires none of its targets, and with
developer 1set in the console, the console reports why - If
calc_stateentities use each other as operands in a loop, the check stops after 32 steps and the result is false, and withdeveloper 1set in the console, the console reports it
See also
- Masters and states - how a Master locks an entity
- Masters guide - setups with masters and states
env_state- an on or off state that you switch with triggersmultisource- a master that is on while all of its inputs are ontrigger_compare- a master that compares two numbers
Changes since 1.38
calc_stateis new in SBO 2.0.0
