Class FuncTrackTrain
Namespace: ValveResourceFormat.Renderer.Entities
Assembly: Renderer.dll
func_tracktrain. A brush that runs along a chain of PathTrack nodes, carrying and pushing whatever stands on it.
public class FuncTrackTrain : BaseModelEntityInheritance
object ← BaseEntity ← BaseModelEntity ← FuncTrackTrain
Inherited Members
BaseModelEntity.Solid, BaseModelEntity.ModelNode, BaseModelEntity.Physics, BaseModelEntity.LoadedModel, BaseModelEntity.CreateRootNode(), BaseModelEntity.BuildsCollider, BaseModelEntity.InputColor(EntityInputData), BaseModelEntity.InputAlpha(EntityInputData), BaseModelEntity.InputLightingOrigin(EntityInputData), BaseModelEntity.DispatchInput(string, EntityInputData), BaseEntity.Scene, BaseEntity.RootNode, BaseEntity.Transform, BaseEntity.RigidTransform, BaseEntity.EntitySystem, BaseEntity.Data, BaseEntity.SpawnData, BaseEntity.NameFixup, BaseEntity.SpawnGroup, BaseEntity.KeyValues, BaseEntity.Classname, BaseEntity.TargetName, BaseEntity.SpawnFlags, BaseEntity.SpawnTransform, BaseEntity.Owner, BaseEntity.MoveParent, BaseEntity.EntityScale, BaseEntity.ModelName, BaseEntity.Origin, BaseEntity.Angles, BaseEntity.WorldOrigin, BaseEntity.WorldAngles, BaseEntity.Velocity, BaseEntity.AngularVelocity, BaseEntity.NextThink, BaseEntity.MoveDoneTime, BaseEntity.IsRemoved, BaseEntity.Collider, BaseEntity.IsSolid, BaseEntity.IsTrigger, BaseEntity.IsDrawn, BaseEntity.IsShown, BaseEntity.IsCollidable, BaseEntity.TouchingEntities, BaseEntity.CreateRootNode(), BaseEntity.CreateEditorNode(ObjectTypeFlags), BaseEntity.CreateEffect(string?, ParticleSnapshot?, bool), BaseEntity.HasSpawnFlags<TSpawnFlags>(TSpawnFlags), BaseEntity.Spawn(), BaseEntity.Activate(), BaseEntity.Think(), BaseEntity.RoundStart(), BaseEntity.MoveDone(), BaseEntity.TryGetTouchBounds(out Vector3, out Vector3), BaseEntity.AcceptsTouchFrom(BaseEntity), BaseEntity.OnStartTouch(BaseEntity), BaseEntity.OnTouch(BaseEntity), BaseEntity.OnEndTouch(BaseEntity), BaseEntity.ObjectCaps, BaseEntity.Use(BaseEntity?), BaseEntity.Teleport(Vector3, Vector3?), BaseEntity.JumpTo(Vector3, Vector3), BaseEntity.AcceptInput(string, EntityInputData), BaseEntity.InputKill(EntityInputData), BaseEntity.InputFireUser1(EntityInputData), BaseEntity.InputFireUser2(EntityInputData), BaseEntity.InputFireUser3(EntityInputData), BaseEntity.InputFireUser4(EntityInputData), BaseEntity.SetNextThink(float), BaseEntity.SetMoveDoneTime(float), BaseEntity.PhysicsSimulate(float), BaseEntity.TurnsByAngleComponents, BaseEntity.IsPusher, BaseEntity.IsUnblockableByPlayer, BaseEntity.MovesWithoutPushing, BaseEntity.PushesPlayerAsTrain, BaseEntity.HasVPhysicsSolid, BaseEntity.OnStartBlocked(BaseEntity), BaseEntity.OnBlocked(BaseEntity), BaseEntity.OnEndBlocked(), BaseEntity.GetSurfaceVelocity(Vector3), BaseEntity.TurnBody(Vector3, Vector3), BaseEntity.SetOriginAndAngles(Vector3, Vector3), BaseEntity.SetWorldOriginAndAngles(Vector3, Vector3), BaseEntity.AddNode(SceneNode, bool), BaseEntity.OnRemove(), BaseEntity.UpdateTransform(), BaseEntity.UpdateColliderTransform(), BaseEntity.UpdateRenderTransform(float), BaseEntity.SnapInterpolation(), BaseEntity.AngleMod(float), BaseEntity.DispatchInput(string, EntityInputData)
Remarks
Every tick it moves, it looks 0.1 seconds of travel ahead along the path, passes the nodes in between, and aims its velocity at that point and its angular velocity at the orientation it should have. Not simulated: driving with the use key or train controls, the damage and shove applied to what blocks the train (the player never blocks a train), and the pitch and volume of the move sound from the speed.
Constructors
FuncTrackTrain(EntitySystem, EntitySpawnInfo)
Initializes a func_tracktrain from its keyvalues.
public FuncTrackTrain(EntitySystem system, EntitySpawnInfo spawnInfo)Parameters
system EntitySystem
spawnInfo EntitySpawnInfo
Properties
CurrentPath
Gets the node it last passed in the direction it is going.
public PathTrack? CurrentPath { get; }Property Value
HasVPhysicsSolid
Gets whether this entity collides as a physics mesh, as nearly every model does. A turning one pushes the player by the motion of the corner of their box that leads into the turn, rather than by the motion of their origin.
protected override bool HasVPhysicsSolid { get; }Property Value
bool
IsForward
Gets whether it goes along target links rather than back along them.
public bool IsForward { get; }Property Value
bool
IsPusher
Gets whether this entity pushes the player out of its way as it moves. Doors, buttons, rotating brushes and trains opt in.
protected override bool IsPusher { get; }Property Value
bool
IsUnblockableByPlayer
Gets whether the player can never block this pusher: the player is moved the whole way, through the world if need be, and the pusher keeps going.
protected override bool IsUnblockableByPlayer { get; }Property Value
bool
MaxSpeed
Gets the speed the start inputs go at, the startspeed keyvalue.
public float MaxSpeed { get; }Property Value
float
ObjectCaps
Gets the capability flags of this entity, checked by the player's use trace.
public override EntityCapability ObjectCaps { get; }Property Value
PushesPlayerAsTrain
Gets whether a player in the way of anything parented under this entity is pushed as a train pushes them: slid along the push and lifted out of whatever it left them in, and never able to block it.
protected override bool PushesPlayerAsTrain { get; }Property Value
bool
Speed
Gets the current speed in units per second, negative when going backward along the track.
public float Speed { get; }Property Value
float
Methods
Activate()
Called once every entity of its spawn group has spawned, to resolve other entities by name.
public override void Activate()DispatchInput(string, EntityInputData)
Runs the handler declared with EntityInputAttribute for an input.
protected override bool DispatchInput(string inputName, EntityInputData data)Parameters
inputName string
data EntityInputData
Returns
bool
true when a handler ran.
InputLockOrientation(EntityInputData)
Stops it turning to follow the path.
[EntityInput("LockOrientation")]
protected void InputLockOrientation(EntityInputData data)Parameters
data EntityInputData
InputMoveToPathNode(EntityInputData)
Travels to the named node, whichever way along the track it lies, and stops on reaching it.
[EntityInput("MoveToPathNode")]
protected void InputMoveToPathNode(EntityInputData data)Parameters
data EntityInputData
InputResume(EntityInputData)
Starts again at the speed it had before it last stopped.
[EntityInput("Resume")]
protected void InputResume(EntityInputData data)Parameters
data EntityInputData
InputReverse(EntityInputData)
Reverses the direction along the track, keeping the speed.
[EntityInput("Reverse")]
protected void InputReverse(EntityInputData data)Parameters
data EntityInputData
InputSetMaxSpeed(EntityInputData)
Sets the top speed, without changing the current one.
[EntityInput("SetMaxSpeed")]
protected void InputSetMaxSpeed(EntityInputData data)Parameters
data EntityInputData
InputSetSpeed(EntityInputData)
Sets the speed as a fraction of the top speed, keeping the direction.
[EntityInput("SetSpeed")]
protected void InputSetSpeed(EntityInputData data)Parameters
data EntityInputData
InputSetSpeedDir(EntityInputData)
Sets the speed as a fraction of the top speed, its sign choosing the direction.
[EntityInput("SetSpeedDir")]
protected void InputSetSpeedDir(EntityInputData data)Parameters
data EntityInputData
InputSetSpeedDirAccel(EntityInputData)
Like SetSpeedDir, but trains with a blending velocitytype ramp to the speed at ManualAccelSpeed or ManualDecelSpeed.
[EntityInput("SetSpeedDirAccel")]
protected void InputSetSpeedDirAccel(EntityInputData data)Parameters
data EntityInputData
InputSetSpeedReal(EntityInputData)
Sets the speed in units per second, up to the top speed.
[EntityInput("SetSpeedReal")]
protected void InputSetSpeedReal(EntityInputData data)Parameters
data EntityInputData
InputStartBackward(EntityInputData)
Starts back along the track at full speed.
[EntityInput("StartBackward")]
protected void InputStartBackward(EntityInputData data)Parameters
data EntityInputData
InputStartForward(EntityInputData)
Starts forward along the track at full speed.
[EntityInput("StartForward")]
protected void InputStartForward(EntityInputData data)Parameters
data EntityInputData
InputStop(EntityInputData)
Stops where it is.
[EntityInput("Stop")]
protected void InputStop(EntityInputData data)Parameters
data EntityInputData
InputTeleportToPathNode(EntityInputData)
Jumps onto the named node, arriving at it as if it had travelled there.
[EntityInput("TeleportToPathNode")]
protected void InputTeleportToPathNode(EntityInputData data)Parameters
data EntityInputData
InputToggle(EntityInputData)
Stops when moving, otherwise starts at full speed the way it faces along the track.
[EntityInput("Toggle")]
protected void InputToggle(EntityInputData data)Parameters
data EntityInputData
InputUnlockOrientation(EntityInputData)
Lets it turn to follow the path again.
[EntityInput("UnlockOrientation")]
protected void InputUnlockOrientation(EntityInputData data)Parameters
data EntityInputData
MoveDone()
Runs when BaseEntity.MoveDoneTime comes due, after the tick's movement was applied.
public override void MoveDone()OnRemove()
Called as the entity leaves the world, before its nodes leave the scene. Release anything the entity started here, such as a playing sound.
protected override void OnRemove()PhysicsSimulate(float)
Integrates this tick's movement: advances BaseEntity.Origin by BaseEntity.Velocity and turns by BaseEntity.AngularVelocity.
protected override void PhysicsSimulate(float tickInterval)Parameters
tickInterval float
Remarks
Turning is chosen per class by BaseEntity.TurnsByAngleComponents. By default it is about the entity's own axes, so a brush authored on its side spins about its own up axis. Doors and other toggle brushes add the rate onto the QAngle components instead. The two only differ for an entity the map already rotated.
Spawn()
Sets up the entity (model, class keyvalues, first think). Called once the entity's spawn group has created all entities of the group, after the move parent has spawned.
public override void Spawn()Remarks
An override calls this first: it builds the node from BaseEntity.CreateRootNode() and snaps the entity onto its parent's attachment, which the rest of the override reads.
Think()
Runs when BaseEntity.NextThink comes due.
public override void Think()
