Table of Contents

Railroad Crossings

Railroad Crossings are defined in .lua configuration files in the res/config/railroad_crossing/ folder. They use models that can have certain animation events.

Configuration

The configuration file of a railroad crossing has several properties:

function data()
return {
  name = _("Half-barrier crossing"),
  yearFrom = 1925,
  yearTo = 1975,
  cost = 16000,
  speedLimit = 160.0 / 3.6,
  soundFileName = "railroad_crossing.wav",
  crossingMaterial = "street/railroad_crossing.mtl",
  trafficDelay = 3500,
 
  config = {
    { 
      modelLeft = "railroad/crossing/eu_a_simple.mdl", 
      modelRight = "railroad/crossing/eu_b_barrier_small.mdl", 
      streetWidth = 12.0
    },
  },
}
end

The properties in detail:

The config block is a list with one or more configuration blocks. Each of the configuration blocks has three properties:

If there is more than one configuration available, the one that matches the actual street width best is chosen.

Events


railroad crossing animations

Railroad crossings support some animation events that are triggered depending on their state. They can be used in mesh nodes of their models to support the visualisation of the two states 'open' and 'closed':

While the forever animation runs constantly, the other four events form a loop. Usually a railroad crossing is in 'open' state and the idle_open animation is performed. As soon as a train is approaching the close animation is performed once. Then idle_closed is looped as long as the railroad crossing stays closed. When the train is through and the railroad crossing turns back to open, open is performed once before idle_open is looped again.

The idle animations could be used e.g. for blinking lights.

UI icons

The icons for railroad crossings lay in the res/textures/ui/railroad_crossing/ folder and have the same name as the .lua file. It is recommended that the railroad crossing icons have a resolution of 60×38 pixels.