"season-selector" container

From TrainzOnline
(Redirected from "Season-selector" container)
Jump to: navigation, search

The "Season-selector" container is a top-level container is some assets' config.txt file which allows the simulator to display an appropriate visual for each asset instance based on certain environmental parameters. The container does not specify anything about the visuals directly, but rather provides logic which maps the varied environmental parameters down to a single "season index" which is then used in other parts of the asset's config.txt file.

The "Season-selector" container is a recursive structure- meaning that the container may contain one or more of itself as sub-containers.

Contents

Supported Tags

The "Season-selector" container supports the following tags. Each tag is show here with its default value.

output-season
season-range 0.0, 1.0
above-snow-line 0
branch-true
branch-false

output-season

Type: Integer
Desc: The season index used for this asset if the decision logic reaches this [sub-]container. If specified, this should be the only tag in this "Season-selector" [sub-]container.

season-range

Type: vector2
Desc: A conditional tag which tests whether the global time-of-year value falls within the specified range. If the first number is less than the second, the condition is evaluated by (first-value <= time-of-year <= second-value.) If the second number is less than the first, the condition is evaluated by (time-of-year <= second-value || time-of-year >= first-value.) The global time-of-year value varies from 0.0 to 1.0 throughout the year, where 0 is start of summer and 0.5 is start of winter.

above-snow-line

Type: boolean
Desc: A conditional tag which tests whether the asset instance is above the snow-line. If set to a true value (eg. 1) then asset instances will evaluate this condition as (asset-height >= snow-line-height.) If set to a false value (eg. 0) then no test is performed.

branch-true

Type: "Season-selector" container
Desc: If all of the conditional tags in this [sub-]container evaluate to true, this child branch is evaluated to determine the output-season for a specified asset instance.

branch-false

Type: "Season-selector" container
Desc: If one or more of the conditional tags in this [sub-]container evaluate to false, this child branch is evaluated to determine the output-season for a specified asset instance.


"Season-selector" Example

Download a Full Seasonal Asset HERE for trainz-build 4.6 or above.

The season-selector for selecting winter would look like this in the top-level of your config file (1 means winter, 0 the other three):

season-selector
{
  season-range                          0.503,0.741
  
  branch-true
  {
    output-season                     1
  }
  
  branch-false
  {
    output-season                     0
  }
}

If you apply it to a mesh (scenery), the mesh table would be:

mesh-table
{
 default
 {
   mesh                                "default/mesh.im"
   auto-create                         1
   mesh-season                         0
 }
 
 winter
 {
   mesh                                "winter/mesh.im"
   auto-create                         1
   mesh-season                         1
 }
}

If you apply it to a groundtexture, add a texture-variants container:

texture-variants
{
 0
 {
   diffuse-texture                     "default.texture"
 }
 
 1
 {
   diffuse-texture                     "winter.texture"
 }
}

This next example covers all seasonal options including Summer, Autumn, Winter, Spring, Snowline Summer, Snowline Autumn, Snowline Winter, Snowline Spring. Not all assets require these. Foliage is a good example of assets that might require a number of these seasonal options. If you wish to use "snow" on your asset use the Snowline options, not the Winter options.

summer = 0

winter = 1

autumn = 4

spring = 5

snow line summer = 2

snow line winter = 3

snow line autumn = 6

snow line spring = 7

season-selector
{
 above-snow-line                       1
 
 branch-true
 {
   season-range                        0.501,0.75
   
   branch-true
   {
     output-season                     3
   }
   
   branch-false
   {
     season-range                      0.251,0.5
     
     branch-true
     {
       output-season                   6
     }
     
     branch-false
     {
       season-range                    0.751,1
       
       branch-true
       {
         output-season                 7
       }
       
       branch-false
       {
         output-season                 2
       }
     }
   }
 }
 
 branch-false
 {
   season-range                        0.501,0.75
   
   branch-true
   {
     output-season                     1
   }
   
   branch-false
   {
     season-range                      0.251,0.5
     
     branch-true
     {
       output-season                   4
     }
     
     branch-false
     {
       season-range                    0.751,1
       
       branch-true
       {
         output-season                 5
       }
       
       branch-false
       {
         output-season                 0
       }
     }
   }
 }
}

See Also

Personal tools