Func train: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
Tip:This entity is not affected by the turning inaccuracy issues that 
Bug:It will always try to play sounds, regardless of whether they are actually specified. This can be set to 
Note:For Keyvalues and Inputs affecting brush rendering, see Brush entity/Rendering related keyvalues and inputs
		
	
Michael Z. (talk | contribs)  (Brush based instead of point based. As mentioned by the FGD snippet as well as the common naming practice.)  | 
				SirYodaJedi (talk | contribs)   (→Flags)  | 
				||
| (12 intermediate revisions by 7 users not shown) | |||
| Line 1: | Line 1: | ||
{{  | {{LanguageBar}}  | ||
{{back|Trains}}  | {{back|Trains}}  | ||
{{base brush|func_train}}  | {{TabsBar|main=gs|base=func_train}}  | ||
{{Ent not in fgd}}  | |||
{{CD|CFuncTrain|file1=1}}  | |||
{{This is a|brush entity|name=func_train}}  | |||
It is a leftover from {{Quake|2}} that ping-pongs between the start and end of a series of [[path_corner]]s. Unlike {{ent|func_tracktrain}}, it does not rotate when turning.  | |||
It is a leftover from   | |||
{{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.}}  | ||
==  | == Keyvalues ==  | ||
{{  | {{Brush rendering note}}  | ||
==Flags==  | {{KV Targetname}}  | ||
{{KV Angles|Initial orientation of the train.}}  | |||
{{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.}}  | |||
{{KV|Speed|intn=speed|float|Speed at which the train moves.}}  | |||
{{KV|Movement Sound|intn=noise1|string|The sound to play when the train moves.}}  | |||
{{KV|Stop Sound|intn=noise2|string|The sound to play when the train stops moving.}}  | |||
{{KV|Sound Volume (0-10)|intn=volume|float|Volume of the sounds emitted when moving and stopping.}}  | |||
{{KV|Crush Damage|intn=dmg|float|Amount of damage to deal to entities blocking the train.}}  | |||
== Flags ==  | |||
{{fl|1|Wait to retrigger|Set and unset by game code; should not be set manually.}}  | |||
{{fl|8|Non-solid}}  | {{fl|8|Non-solid}}  | ||
==Inputs==  | == Inputs ==  | ||
{{I   | {{I|Toggle|Toggle movement}}  | ||
{{I   | {{I|Start|Start movement}}  | ||
{{I|Stop|Stop movement}}  | |||
{{  | |||
==FGD Code==  | == 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.-->  | <!--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)   | @SolidClass base(Targetname, Origin, Angles, 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) {{=}}  | 	spawnflags(flags) {{=}}  | ||
| Line 62: | Line 54: | ||
	input Stop(void) : "Stop movement"  | 	input Stop(void) : "Stop movement"  | ||
]  | ]  | ||
</pre>  | |||
Latest revision as of 10:40, 26 October 2025
| CFuncTrain | 
func_train  is a   brush entity  available in all 
 Source games.
It is a leftover from 
 Quake that ping-pongs between the start and end of a series of path_corners. Unlike func_tracktrain, it does not rotate when turning.
func_tracktrain is, making it a good alternative for fast-moving objects.Default.Null with a volume of 0 to play no sound.  [todo tested in ?]Keyvalues
- Name (targetname) <string>[ Edit ]
 - The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. 
parentnameortarget).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities 
- Pitch Yaw Roll (Y Z X) (angles) <QAngle>
 - Initial orientation of the train.
 
- 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.
 
Flags
- Wait to retrigger : [1]
 - Set and unset by game code; should not be set manually.
 
- Non-solid : [8]
 
Inputs
- Toggle
 - Toggle movement
 
- Start
 - Start movement
 
- Stop
 - Stop movement
 
FGD Code
@SolidClass base(Targetname, Origin, Angles, 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"
]