"season-selector" container

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m (Corrected 0-1 sumer-winter period)
(Simplified season-selector)
Line 18: Line 18:
 
====season-range====
 
====season-range====
 
:Type: vector2
 
: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 = mid-summer, 0.5 = mid-winter.
+
: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====
 
====above-snow-line====
Line 39: Line 39:
 
  season-selector
 
  season-selector
 
  {
 
  {
   season-range                          0.25,0.75
+
   season-range                          0.586,0.741
 
    
 
    
 
   branch-true
 
   branch-true
 
   {
 
   {
     season-range                        0.25,0.5
+
     output-season                    1
   
+
    branch-true
+
    {
+
      output-season                    0
+
    }
+
   
+
    branch-false
+
    {
+
      output-season                    1
+
    }
+
 
   }
 
   }
 
    
 
    
 
   branch-false
 
   branch-false
 
   {
 
   {
     output-season                       0
+
     output-season                     0
 
   }
 
   }
 
  }
 
  }

Revision as of 03:13, 1 February 2016

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

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.586,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"
 }
}

See Also

Personal tools