User Tools

Site Tools

Urban Games

modding:waypointssignals

Waypoints and Signals

Waypoints and Signals are models that can be attached to tracks. They have a special set of events for animations too.

The basics about models can be found in the model definition section.

Metadata

In addition to the general .mdl properties, there is a further metadata block called signal:

function data()
return {
  -- bounding box
  -- collider
  -- lods
 
  metadata = {
    availability = {
      yearFrom = 0,
      yearTo = 0,
    },
    cost = {
      price = 2000,
    },
    description = {
      description = _("Used for rerouting a line. Can be added to a line like a station."),
      name = _("Waypoint"),
    },
    signal = {
      type = "WAYPOINT",
      soundevent = "horn", -- optional
 
    },
    category = { categories = { "category1","category2" } },
  },
  version = 1,
}
end

The availability is set by yearFrom for the year from when the waypoint or signal should be available. Unset or values below 1851 mean from start. The end limit is set by yearTo. It is the year until when the waypoint or signal should be available. Unset or value 0 means unlimited availability, values below 1850 result in a never available waypoint or signal.

The cost property is the building cost per signal or waypoint.

For the menu, a description is set in the desc property. The name is set in the name property. Both can be translated in a strings.lua file.

The signal block contains a type property. There it is possible to select whether the model should be a “WAYPOINT”, “PATH_SIGNAL” (two-way) or “ONE_WAY_PATH_SIGNAL”. To trigger sound events of passing vehicles, the name of an event can be added as value of the optional soundevent property.

Both signals and waypoints can be filtered by categories. These are set in the categories listed in the category block. Please keep in mind that the category keys need do start with a lower case letter.

Events


signal animations

Especially for signals the animation events are an important aspect. But they are applicable for waypoints too. They can be used in mesh nodes to support the visualisation of the two signalisation states 'red' and 'green':

  • forever animation is used for any permanently looped animation.
  • idle_red animation is used as a loop while the signal is in 'red' state.
  • green animation is used when the signal switches from 'red' to 'green'.
  • idle_green animation is used as a loop while the signal is in 'green' state.
  • red animation is used when the signal switches from 'green' to 'red'.

While the forever animation runs constantly, the other four events form a loop. Usually a signal is in red state and the idle_red animation is performed. As soon as it switches to green, green is performed once. Then idle_green is looped as long as the signal stays green. When the signal turns back to red, red is performed once before idle_red is looped again.

The idle animations could be used e.g. for blinking signals. Although waypoints do not have a signaling effect, they have the same triggers as signals and turn 'green' when a train is nearby.

UI icons

The ui icons for signals and waypoints are located in the res/textures/ui/models/railroad/ folder and have one of the following names:

  • <mdl-name>.tga if they have the standard height of 75 pixels
  • <mdl-name>@2.tga if they have the doubled resolution with a height of 150 pixels


modding/waypointssignals.txt · Last modified: 2022/05/13 13:21 by yoshi