Func train: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Remove (basically empty) entity description header)
m (Moved FGD code down and made <pre> dark. Added back button.)
Line 1: Line 1:
{{ent not in fgd}}
{{ent not in fgd}}
{{base point|func_train}} It is a leftover from [[Quake]] that ping-pongs between the start and end of a series of path_corners. It was mostly replaced by {{ent|func_tracktrain}} in GoldSrc, but was still used for looping auto-scrolling backgrounds. In Source, the introduction of parenting has rendered this method obsolete. However, the entity is still functional.
{{back|Trains}}
{{base point|func_train}}
 
== Entity Description ==
It is a leftover from [[Quake]] that ping-pongs between the start and end of a series of path_corners. It was mostly replaced by {{ent|func_tracktrain}} in {{gldsrc|4}}, but was still used for looping auto-scrolling backgrounds. In Source, the introduction of parenting has rendered this method obsolete. However, the entity is still functional.


{{tip|This entity is not affected by the turning inaccuracy issues that <code>func_tracktrain</code> is, making it a good alternative for fast-moving objects.}}
{{tip|This entity is not affected by the turning inaccuracy issues that <code>func_tracktrain</code> is, making it a good alternative for fast-moving objects.}}
{{bug|It will always try to play sounds, regardless of whether they are actually specified. This can be set to <code>Default.Null</code> with a volume of 0 to play no sound.}}
{{bug|It will always try to play sounds, regardless of whether they are actually specified. This can be set to <code>Default.Null</code> with a volume of 0 to play no sound.}}


==FGD Code==
==KeyValues==
<!--Editor's note: TexFrameIndex exists on every brush entity, so I'm not sure why it was specifically included here. It should be in KVBaseEntity if anything.-->
<pre>
@SolidClass base(Targetname, Origin, RenderFields) line(255 255 0, targetname, target) = func_train: "An old entity leftover from Quake. It follows a series of path_corner entities."
[
spawnflags(flags) =
[
8 : "Non-solid" : 0
]
target(target_destination) : "Spawn path_corner" : : "The name of the first path_corner in the train's path. The train will spawn at this path_corner."
    speed(float) : "Speed" : "50" : "Speed at which the train moves."
noise1(sound) : "Movement Sound" : "Default.Null" : "The sound to play when the train moves. This must be specified, but can be set to 'Default.Null' to play no sound."
noise2(sound) : "Stop Sound" : "Default.Null" : "The sound to play when the train stops moving. This must be specified, but can be set to 'Default.Null' to play no sound."
volume(float) : "Sound volume (0-10)" : "10" : "Volume of the sounds emitted when moving and stopping."
dmg(float) : "Crush Damage" : "0" : "Amount of damage to deal to entities blocking the train."
 
// Inputs
input Toggle(void) : "Toggle movement"
input Start(void) : "Start movement"
input Stop(void) : "Stop movement"
]
</pre>
==Keyvalues==
{{KV BaseEntity|brush=1}}
{{KV RenderFields}}
{{KV|Spawn path_corner|intn=target|target_destination}}
{{KV|Spawn path_corner|intn=target|target_destination}}
: The name of the first path_corner in the train's path. The train will spawn at this path_corner.
: The name of the first path_corner in the train's path. The train will spawn at this path_corner.
Line 42: Line 22:
{{KV|Crush Damage|intn=dmg|float}}
{{KV|Crush Damage|intn=dmg|float}}
: Amount of damage to deal to entities blocking the train.
: Amount of damage to deal to entities blocking the train.
{{KV BaseEntity|brush=1}}
{{KV RenderFields}}


==Flags==
==Flags==
*8 : Non-solid
{{fl|8|Non-solid}}


==Inputs==
==Inputs==
Line 57: Line 39:


==Outputs==
==Outputs==
{{O BaseEntity}}
{{O BaseEntity|l4d=1}}
 
==FGD Code==
<!--Editor's note: TexFrameIndex exists on every brush entity, so I'm not sure why it was specifically included here. It should be in KVBaseEntity if anything.-->
{{pre|
@SolidClass base(Targetname, Origin, RenderFields) line(255 255 0, targetname, target) {{=}} func_train: "An old entity leftover from Quake. It follows a series of path_corner entities."
[
spawnflags(flags) {{=}}
[
8 : "Non-solid" : 0
]
target(target_destination) : "Spawn path_corner" : : "The name of the first path_corner in the train's path. The train will spawn at this path_corner."
speed(float) : "Speed" : "50" : "Speed at which the train moves."
noise1(sound) : "Movement Sound" : "Default.Null" : "The sound to play when the train moves. This must be specified, but can be set to 'Default.Null' to play no sound."
noise2(sound) : "Stop Sound" : "Default.Null" : "The sound to play when the train stops moving. This must be specified, but can be set to 'Default.Null' to play no sound."
volume(float) : "Sound volume (0-10)" : "10" : "Volume of the sounds emitted when moving and stopping."
dmg(float) : "Crush Damage" : "0" : "Amount of damage to deal to entities blocking the train."
 
// Inputs
input Toggle(void) : "Toggle movement"
input Start(void) : "Start movement"
input Stop(void) : "Stop movement"
]
}}


[[Category:Entities]]
[[Category:Entities]]

Revision as of 12:28, 15 May 2022

Icon-NotInFGD.png
This entity is not in the FGD by default.
See below for instructions on making it available.
Trains

Template:Base point

Entity Description

It is a leftover from Quake that ping-pongs between the start and end of a series of path_corners. It was mostly replaced by func_tracktrain in GoldSrc GoldSrc, but was still used for looping auto-scrolling backgrounds. In Source, the introduction of parenting has rendered this method obsolete. However, the entity is still functional.

Tip.pngTip:This entity is not affected by the turning inaccuracy issues that func_tracktrain is, making it a good alternative for fast-moving objects.
Icon-Bug.pngBug:It will always try to play sounds, regardless of whether they are actually specified. This can be set to Default.Null with a volume of 0 to play no sound.  [todo tested in ?]

KeyValues

Spawn path_corner (target) <targetname>
The name of the first path_corner in the train's path. The train will spawn at this path_corner.
Speed (speed) <float>
Speed at which the train moves.
Movement Sound (noise1) <string>
The sound to play when the train moves.
Stop Sound (noise2) <string>
The sound to play when the train stops moving.
Sound Volume (0-10) (volume) <float>
Volume of the sounds emitted when moving and stopping.
Crush Damage (dmg) <float>
Amount of damage to deal to entities blocking the train.

RenderFields:


Render Mode (rendermode) <byte choices>
Set a non-standard rendering mode on this entity.
Render Modes
  • 0: Normal
  • 1: Color
  • 2: Texture
  • 3: Glow
  • 4: Solid/Alphatest Obsolete
  • 5: Additive
  • 6: Removed, does nothing Obsolete
  • 7: Additive Fractional Frame
  • 8: Alpha Add
  • 9: World Space Glow
  • 10: Don't Render
Render FX (renderfx) <byte choices>
Various somewhat legacy alpha effects. See render effects.
Render Amount / Transparency (renderamt) <byte>
Transparency amount, requires a Render Mode other than Normal. 0 is invisible, 255 is fully visible.
Render Color (R G B) (rendercolor) <color255>
Color tint.

Flags

Non-solid : [8]

Inputs

RenderFields:

Alpha <integer 0–255>
Sets the entity's transparency to a number from 0 (invisible) to 255 (fully visible). Requires the entity to have its rendermode set to a number other than 0.
Color <color255RedirectInput/color32>
Sets an RGB color for the entity.
Toggle
Toggle movement
Start
Start movement
Stop
Stop movement

Outputs

FGD Code

@SolidClass base(Targetname, Origin, RenderFields) line(255 255 0, targetname, target) = func_train: "An old entity leftover from Quake. It follows a series of path_corner entities."
[
	spawnflags(flags) =
	[
		8 : "Non-solid" : 0
	]
	target(target_destination) : "Spawn path_corner" : : "The name of the first path_corner in the train's path. The train will spawn at this path_corner."
	speed(float) : "Speed" : "50" : "Speed at which the train moves."
	noise1(sound) : "Movement Sound" : "Default.Null" : "The sound to play when the train moves. This must be specified, but can be set to 'Default.Null' to play no sound."
	noise2(sound) : "Stop Sound" : "Default.Null" : "The sound to play when the train stops moving. This must be specified, but can be set to 'Default.Null' to play no sound."
	volume(float) : "Sound volume (0-10)" : "10" : "Volume of the sounds emitted when moving and stopping."
	dmg(float) : "Crush Damage" : "0" : "Amount of damage to deal to entities blocking the train."

	// Inputs
	input Toggle(void) : "Toggle movement"
	input Start(void) : "Start movement"
	input Stop(void) : "Stop movement"
]