Class FuncTrackTrain
Namespace: ValveResourceFormat.Renderer.Entities
Assembly: Renderer.dll
func_tracktrain, Source's CFuncTrackTrain. A brush that runs along a chain of
public class FuncTrackTrain : BaseModelEntityInheritance
object ← BaseEntity ← BaseModelEntity ← FuncTrackTrain
Inherited Members
BaseModelEntity.Solid, BaseModelEntity.ModelNode, BaseModelEntity.LoadedModel, BaseModelEntity.CreateRootNode(), BaseModelEntity.BuildsCollider, BaseModelEntity.InputColor(EntityInputData), BaseModelEntity.InputAlpha(EntityInputData), BaseEntity.Scene, BaseEntity.RootNode, BaseEntity.Transform, BaseEntity.RigidTransform, BaseEntity.LayerName, BaseEntity.EntitySystem, BaseEntity.Data, BaseEntity.SpawnData, BaseEntity.NameFixup, 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.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)
Remarks
Every tick it is moving, it looks 0.1 seconds of travel ahead along the path, passes the nodes in between, and sets its velocity toward that point and its angular velocity toward the orientation it should have; the pusher physics integrates both. Not simulated: driving it with the use key or train controls, the damage and shove it gives what blocks it (the player never blocks a train), and the pitch and volume its move sound takes from its 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, Source's SOLID_VPHYSICS, 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
IsForward
Gets whether it goes along target links rather than back along them.
public bool IsForward { get; }Property Value
IsPusher
Gets whether this entity pushes the player out of its way as it moves, Source's MOVETYPE_PUSH. Doors, buttons, rotating brushes and trains opt in.
protected override bool IsPusher { get; }Property Value
IsUnblockableByPlayer
Gets whether the player can never block this pusher, Source's FL_UNBLOCKABLE_BY_PLAYER. 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
MaxSpeed
Gets the speed the start inputs go at, the startspeed keyvalue.
public float MaxSpeed { get; }Property Value
ObjectCaps
Gets what this entity can do, which is how the player's use trace decides whether it is worth pressing. Source's ObjectCaps.
public override EntityCapability ObjectCaps { get; }Property Value
PushesPlayerAsTrain
Gets whether a player in the way of anything parented under this entity is pushed the way the game pushes them off trains: 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
Speed
Gets the current speed in units per second, negative when going backward along the track.
public float Speed { get; }Property Value
Methods
Activate()
Called once every entity in the map has spawned, for anything that needs to resolve other entities by name. Source's Activate.
public override void Activate()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)
Turns the way it goes along the track around, keeping its 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 comes due, after the tick's movement was applied.
public override void MoveDone()OnRemove()
Called as the entity leaves the world, before its nodes are taken out of the scene. Source's UpdateOnRemove: the place to let go of anything the entity started, such as a playing sound.
protected override void OnRemove()PhysicsSimulate(float)
Integrates this tick's movement, advancing by and turning by .
protected override void PhysicsSimulate(float tickInterval)Parameters
tickInterval float
Remarks
Source 2 does it both ways, chosen per class by . By default the turn goes about the entity's own axes, so a brush authored on its side spins about its own up axis rather than the world's. The doors and other toggle brushes instead add the rate onto the QAngle components, as Source 1 always did. The two only differ for an entity the map already rotated.
Spawn()
Sets up the entity: loads its model, reads class-specific keyvalues, and schedules its first think. Called by right after construction, before the entity enters the world.
public override void Spawn()Think()
Runs when comes due.
public override void Think()
