-
Notifications
You must be signed in to change notification settings - Fork 10
Master entities
In original Half-Life there's a concept of Master entity that allows to "lock" other entities (e.g. prevent doors from opening) until the Master entity state is On.
The only entity capable of being Master in Half-Life is multisource
. This entity, however, might be quite confusing and hard to use as master. That's why Half-Life Featureful SDK introduces more ways to implement Masters.
Featureful SDK adds a new entity env_state
which is much easier to understand and use as a master entity. The entity itself is implemented after the one of the same name from Spirit Of Half-Life.
In Half-Life Featureful SDK global variables can be used as Master entities as well. Use env_global
with Act as Master
spawnflag set. Then set the env_global
targetname (the entity's name, not the underlying global variable name!) as Master for other entity. If the underlying global variable state is On, then the Master will be considered enabled. Otherwise (Off and Dead states, or if the global variable was not initialized) it's considered disabled. This allows to implement cross-level masters easily without resorting to using multisource
or trigger_auto
.
Another new entity that can act as a master. calc_state
takes states of two other entities (e.g. env_state
or env_global
) and evaluate the resulting state using the specified logical operator (AND, OR, etc.). The On
state is interpreted as True and the Off
state is interpreted as False from boolean algebra.
Aside from having a Master capability, calc_state
also can trigger other entities depending on the result of the operation when it's triggered by something else. It has three target parameters:
-
Target (on & off)
(target) - trigger entities sending On if the state it calculated to On, and Off if the state is calculated to Off. -
Fire when eval to False
(fire_when_false) - trigger entities when the state is calculated to Off. -
Fire when eval to True
(fire_when_true) - trigger entities when the state is calculated to On.
If calc_state
is set to target the env_state
then the latter is basically used as a variable to store the result of the operation allowing for the arbitrary boolean expressions. The env_global
can be used in a similar fashion if it has Set State: Obey Use-type
as a trigger mode.
See Player entities
The state depends on the result of chosen comparison.
Most entities can't be used as masters. It's different in Spirit of Half-Life where every entity has the associated state and can be used as a master. In Featureful SDK we still stick to more classic approach where only few entities have Master capability. This might change in future (preferably it should be a configurable feature though).