func_traindoor

XashXT

func_traindoor

A door that works in conjunction with func_tracktrain. It originated in Spirit of Half-Life 1.9, where it was introduced as an attempt to make up for the limitations of the Spirit parent system. In the Xash mod, it is far less significant but has been kept for compatibility.

Spawnflags

SF_TRAINDOOR_INVERSE 1 (change which way the door slides in a left- or right-door train car, as in Half-Life)
SF_TRAINDOOR_OPEN_IN_MOVING 2 (lets you open the door while the train, func_trackchange or func_trackautochange is in motion)
SF_TRAINDOOR_ONOFF_MODE 3 (enables the correct response to the + и - prefixes; if this is omitted, then the regular func_door behaviour is reproduced: switching)

Options

movesnd Sound that the door makes when it moves (as in func_door).
stopsnd Sound that the door makes when it stops (as in func_door).
speed Movement speed.
train Name of the train that the door is linked to.

Usage Details

  • A door cannot slide up or down, but only left and then backwards or right and then backwards.
  • You can adjust the direction using angles, but that is pretty much a trick.
  • A door that is open will automatically close when its parent train is activated. If the player or anything else is blocking the door at that moment, the train will not start. However, this does not happen if the SF_TRAINDOOR_OPEN_IN_MOVING spawnflag is set—it makes the train stop minding the door state and lose control over it.