Trainz/containers/smoke container

=About smokes= Smokes and vapors abound around a trainyard and amongst train traveled scenery from the gush of water out of a spigot to the acrid pine smoke plume capping that trackside ranchhouse's chimney; semi-transparent filmy thingys make for many effects that are almost magical. Anyone for smoke and mirrors to aid believability? This sort of container finds it's way into all sorts of assets. More than one earns an NN number as a suffix forming smoke0, smoke1, smoke2, ..., smokeNN as an asset needs. Smokes are also interactive and have various interfaces with software, the smoke container forms part of such linkages.

smoke containers
A smoke container is effectively a PFX (particle effects) emitter that defines smoke and similar effects produced by assets. Smoke tags take the form smokeX where X is a number. There is no maximum number of smoke tags but they must be numbered sequentially (i.e. smoke0,smoke1,smoke2,etc). Smoke blocks have two sections: main and sequence properties. Main properties describe the attributes that stay the same for the life of the emitter. Sequence properties describe a set of one or more phases/periods in the smoke emission sequence.

Supported Tags
Each smoke container supports the following tags. Each tag is shown here with its default value.

texture              KUID<-1:6329> file                 "" attachment           "" mode                 "time" accel                0,0,0 conesize             0.2,0.2,1 direction            0,0,1 enable-steam-physics 0 enabled              1 faces                "camera" inherit-Velocity      0 loop                 -1 loopdelay            0 loop-amount          0 minrate              0 maxrate              20 maxspeedkph          0 start                0 period               -1 color                255,255,255,255 endcolor             255,255,255,255 rate                 4 velocity             1 lifetime             3 minsize              0 maxsize              3 mass                 1 mass-scale           .5 drag                 .36 spring               .17 dampening            .02 physics-delay        0

accel

 * Type: Decimal List
 * Default: 0,0,0
 * Compulsory: No
 * Desc: Sets the acceleration conditions for the smoke particles. First value is gravity, second is (optional) wind effect. Default is 0,0. A third (deprecated) form exists with three parameters - this uses the first two values to calculate the wind effect and the third as gravity.

attachment

 * Type: String
 * Default: ""
 * Compulsory: Yes (3.4)
 * Desc: The name of the attachment point at which to generate the PFX. Attachment points are specified in the mesh file during creation.

conesize

 * Type: Decimal List
 * Default: 0.2,0.2,1
 * Compulsory: No
 * Desc: Specifies the cone in which the particles are emitted. When a particle is created it will be given an initial velocity vector with its direction being a random vector in this cone and its speed being taken from the 'velocity' tag. The cone tag is a decimal list of 1, 2 or 3 values (in meters). The first two values specify the width and depth (x and y) of the cone, and the third value specifies it's height. If the height isn't provided a value of 1 will be used, if only one value is provided it will be used for both the width and height. The default value if the tag isn't provided at all is (0.2,0.2,1.0).

direction

 * Type: 3D Vector (x,y,z)
 * Default: 0,0,1
 * Compulsory: No
 * Desc: Sets the direction the particle emitter is facing. The direction will default to (0,0,1) if not supplied (straight up).

enable-steam-physics

 * Type: Boolean
 * Default: 0 (false)
 * Compulsory: No
 * Desc: Enables some of the more advanced smoke/steam related particle physics (drag, spring & dampening).

enabled

 * Type: Boolean
 * Default: 1 (true)
 * Compulsory: No
 * Desc: Sets whether the particle emitter is enabled.

faces

 * Type: String
 * Default: "camera"
 * Compulsory: No
 * Desc: Sets the direction the particle faces. Can be one of the following values:
 * camera - The particles are drawn so that they always face the camera (Default)
 * motion - The particles are drawn so that they face the direction they are travelling.
 * down - The particles are drawn facing down.

file

 * Type: String (filename of effect)
 * Default: ""
 * Compulsory: No
 * Desc: Specifies that the particle emitter settings should be read in from a file generated by the Twinkles PFX tool.

inherit-velocity

 * Type: Boolean
 * Default: 0
 * Compulsory: No
 * Desc: Causes particles to inherit the velocity of the emitter, default is off.

loop

 * Type: Decimal
 * Default: -1
 * Compulsory: No
 * Desc: Sets the time, in seconds, after which to loop the smoke sequence. Valid only for modes 'time' and 'anim2'. Can be set to -1 to imply that it loops after the length of the sequence, this is the default behaviour.

loopdelay

 * Type: Decimal
 * Default: 0
 * Compulsory: No
 * Desc: Specifies the delay, in seconds, until the sequence loops again.

loop-amount

 * Type: Integer
 * Default: 0
 * Compulsory: No
 * Desc: Sets the number of times the sequence should loop.

maxrate

 * Type: Integer
 * Default: 20
 * Compulsory: No
 * Desc: Sets the maximum particle emission rate for the entire sequence.

maxspeedkph

 * Type: Decimal
 * Default: 0
 * Compulsory: No
 * Desc: For cone emitters, this will set the maximum speed of the particles, in km/h.

minrate

 * Type: Integer
 * Default: 0
 * Compulsory: No
 * Desc: Sets the minimum particle emission rate for the entire sequence. Defaults to 0.

mode

 * Type: String
 * Default: "time"
 * Compulsory: Yes (3.4)
 * Desc: The PFX emitter mode. Smoke effects can contain a number of cycled 'phases', the mode defines how the 'start' and 'period' tags are interpreted to control the progression between each smoke phase. Mode must be one of the following values (defaults to "time" if not specified).


 * Only the 'time' and 'timeofday' modes are valid for scenery objects, other modes are intended for use with assets such as locomotives.

texture

 * Type: KUID
 * Default: 
 * Compulsory: No
 * Desc: Sets the kuid of the texture to use for the particles, defaults to KUID<-1:6329> (Steam).

Sequence Properties
Per-phase tags are specified as value lists. If a list is added it should specify a value for each phase.

color

 * Type: Color List (RGBA, 0 to 255)
 * Default: 1,1,1,1
 * Compulsory: Yes (3.4)
 * Desc: Specifies the initial color of the PFX texture for each phase. Color will default to white (255,255,255,255). From build 2.9, failing to include a color tag will create a validation warning.

dampening

 * Type: Decimal List
 * Default: 0.02
 * Compulsory: No
 * Desc: The spring damping constant for particles created in this phase. The spring damping constant affects the 'stability' of the link between individual particles (see 'spring'). Requires the 'enable-steam-physics' tag. Defaults to 0.02.

drag

 * Type: Decimal List
 * Default: 0.36
 * Compulsory: No
 * Desc: The drag constant for the particle created in this phase. This specifes the resistance against the particles ability to move freely through the air. If not specified the drag constant will default to 0.36, increasing the value will cause particles to be more strongly affected by wind. Requires the 'enable-steam-physics' tag.

endcolor

 * Type: Color List (RGBA, 0 to 255)
 * Default: 255,255,255,255
 * Compulsory: No
 * Desc: Specifies the ending color of the PFX texture for each phase. Color will default to white (255,255,255,255).

lifetime

 * Type: Float list
 * Default: 3
 * Compulsory: Yes (3.4)
 * Desc: Specifies the time, in seconds, that the particles exist for in this phase (defaults to 2).

mass

 * Type: Decimal List
 * Default: 1
 * Compulsory: No
 * Desc: The initial mass, in kilograms, of the particles created in this phase..

mass-scale

 * Type: Decimal List
 * Default: 0.5
 * Compulsory: No
 * Desc: The percentage of mass lost over the particles life time for this phase. This allows particles to become lighter as they dissipate into the air. The value is specified as a percentage where 1 is 100% and will default to 0.5 (50%).

maxsize

 * Type: Decimal List
 * Default: 3
 * Compulsory: Yes (3.4)
 * Desc: Specifies the ending size of the particles created in this phase (scaling value where 1 is 100%).

minsize

 * Type: Decimal List
 * Default: 0
 * Compulsory: Yes (3.4)
 * Desc: Specifies the starting size of the particles created in this phase (scaling value where 1 is 100%, default is 0).

period

 * Type: Decimal List
 * Default: -1
 * Compulsory: No
 * Desc: Specifies the duration of this phase, 'period' behaves differently depending on 'mode' and is not always used (see mode for details). Period can be set to -1 to imply that the phase is active until the next phase begins, this is the default behaviour. (Note: only mode "time" valid?)

physics-delay

 * Type: Decimal List
 * Default: 0
 * Compulsory: No
 * Desc: Delay, in seconds, before particles are affected by world physics.

rate

 * Type: Integer List
 * Default: 4
 * Compulsory: Yes (3.4)
 * Desc: Specifies the rate of particle emission in each phase. For most modes this is set to the number of particles to emit per second, for 'anim' and 'anim2' however this is the number of particles to emit over the animation period. The default rate is 4. See also 'minrate' and 'maxrate'.

spring

 * Type: Decimal List
 * Default: 0.17
 * Compulsory: No
 * Desc: The spring constant for particles created in this phase. The spring constant specifies how the strong the link is between individual particles. By default the spring constant is 0.17 if not specified, increasing the value will cause the particles to be more rigidly linked to each others movement. Requires the 'enable-steam-physics' tag.

start

 * Type: Decimal List
 * Default: 0
 * Compulsory: No
 * Desc: Specifies when to start this phase, 'start' behaves differently depending on 'mode' (see mode for details). Start will default to 0.

velocity

 * Type: Decimal List
 * Default: 1
 * Compulsory: Yes (3.4)
 * Desc: Specifies the initial speed of the emitted particles for this phase. Speed is specified in meters per second, the default value is 1m/s.

Example Config.txt
Sample for a scenery asset that produces smoke:

region Britain kind scenery type Industrial light 1 smoke0 {   attachment a.smoke mode timeofday color 150,150,150,250 accel 1,0.3,0 start 0.25, 0.5 period 0.25, 0.125 rate 8 velocity 3 lifetime 5 minsize 0.5 maxsize 2 }

Example Steam Loco
A for a simple steam engine with four smoke emitters:
 * Dark smoke from the main chimney stack that is dependent on the trains velocity (a.smoke, Y axis pointing up),
 * A constant steam trail from a small safety pipe on top (a.steam.safety, Y axis pointing up),
 * 2 steam trails on each side of the train that alternately expel steam keyed to the animation of the trains wheels (a.steam.l, a.steam.r, Y axis pointing outwards).

kind traincar bogey 0 engine 1 name Steam Train mass 100000 enginespec  enginesound  hornsound  interior  smoke0 {   attachment a.steam.l    mode anim color 255,255,255,150 start 0 period 0.4 rate 2 velocity 1 lifetime 2 minsize 0.05 maxsize 1 } smoke1 {   attachment a.steam.r    mode anim color 255,255,255,150 start 0.5 period 0.4 rate 2 velocity 1 lifetime 2 minsize 0.05 maxsize 1 } smoke2 {   attachment a.steam.safety mode time color 255,255,255,150 rate 2 velocity 1 lifetime 2 minsize 0.05 maxsize 1 } smoke3 {   attachment a.smoke0 mode speed color 100,100,100,200 start 0,10,20,30 rate 3,5,7,9 velocity 3,4,5,5 lifetime 4,3,2.5,2 minsize 0.3 maxsize 2 }