Locus system - FreeSlave/halflife-featureful GitHub Wiki
# Wiki is deprecated. Proceed to GitHub pages!
Featureful SDK borrows the locus concept from Spirit of Half-Life.
Each entity has three values associated with them: Position, Velocity (direction) and Ratio, the first two being vectors, and the third being a scalar.
- The
Positionis the origin for the most entities. - The
Velocityis the velocity for the most entities. - The
Ratiois 0 for the most entities, but there're some exceptions.
Locus parameters
Some entity parameters allow to make their behavior depend on the Position, Velocity or Ratio of another entity. These parameters are usually marked with [LP], [LV] and [LR] suffixes (for Locus Position, Locus Velocity and Locus Ratio respectively) and expect the targetname of another entity as their value.
Such parameters also support literal values, e.g. 0 0 16 for vectors ([LP] and [LV] parameters) or single number for ratio parameters ([LR]).
Examples:
env_explosionhas theInitial position (blank = here) [LP]parameter. Set the targetname of another entity to change where the explosion will take place. E.g. you can set the name of the monster and explosion will appear at their origin whenenv_explosionis triggered.env_shooterhas aAt velocity [LV]parameter to set the velocity for gibs from another source instead of using theenv_shooterangles.trigger_pushhas aPush speed multiplier [LR]parameter which allows to dynamically change the push speed depending on the state of another entity.
Special name !activator allows to refer to the activator of the trigger chain and use its respected associated value as an entity parameter. This allows, for example, to use the activator as a position to play some effect.
Example:
- Set the
Position (blank = here) [LP]ofenv_shockwaveto the!activator, so the effect will be played at the origin of the activator.
Some entity parameters have [LE] suffix in their names, for Locus Entity. It means that this parameter supports the !activator syntax as a way to refer to another entity.
Example:
trigger_hurt_remotehasTarget [LE]parameter. If you put!activatorthere, it will do damage to its activator upon activation.
Notes:
- The special name
!activatorcomes from Sven Co-op and Source games. - The special name
!calleris not supported yet. - The special name
*locusfrom Spirit of Half-Life is supported and synonymous to!activator. - The special name
*playerallows to refer to the player. In singleplayer it always refers to the player. In multiplayer it works the same way as!activator.
Calculations
Sometimes you want to calculate position, velocity or scalar in a more complex way, e.g. add some shift to the origin, multiply the velocity by scalar, or add up two scalars. That's where the calc_ entities come in handy. They calculate their Position, Velocity and Ratio values depending on Position, Velocity and Ratio of other entities.
E.g. calc_position can find another entity, calculate the chosen position from it (Eyes, Origin, etc.) and add another vector as Add offset parameter. Then some other entity can set the targetname of the calc_position entity as a source value for one of its [LP] parameters.
You can find some Spirit of Half-Life tutorials related to the locus system online. For the most part they will be applicable to Featureful SDK as well.