Parent System

XashXT

Parent System

The parent system in XashXT, similarly to its counterpart in Half-Life 2, lets you attach an arbitrary number of objects to any object. The focus is on kinematic objects such as doors, buttons, trains, lifts and so on. Unique to XashXT is the ability of a hierarchy to get from one game level to another without losing functionality or coming apart (which happens in Half-Life 2). You can also force object attachment on the client side (disregarding physics). The latter feature lets mappers use NPCs' attachments to directly link point-based objects: sprites, lights, laser beams and in certain cases models.

The system also supports detaching a group of objects (while preserving the hierarchy of course) and reattaching it to another arbitrary object. The parenting is done by using the special parent field where the level designer specifies the targetname of the parent. If the name is followed by a dot followed by a number, this switches to the client parent system, and the number is treated as the attachment number on the parent model.

The client parent system works only for studio models. This means that only models of this type can act as parents, but brush and sprite models cannot. To make porting of Spirit of Half-Life maps easier, the parent field has the alias movewith, which works identically.

System Limitations

  • Not all objects can be linked correctly using this system. For example, linking NPCs with it is discouraged, because this may cause interpolation issues and will eventually fail to work as expected by the level designer.
  • Attaching the player is also disallowed, but you can attach objects to the player through the trigger_changeparent entity by specifying one of the following in the m_iszNewParent field:
  • The *player keyword should not be entered directly in the parent field, because the player joins the server last, after all the other objects have been interlinked.
  • Static lights (precalculated at compile time) has no effect when attached somewhere. However, you can use dynamic lights, which will move along with your objects.
  • Some objects that have an effect only on the client will not work correctly either. Such are env_bubbles, env_rain, env_static, env_funnel and possibly func_mortar_field.