Difference between revisions of "Action0/Tramtypes"

From GRFSpecs
Jump to navigationJump to search
(initial tramtype spec)
 
(maximum is 63 types)
Line 5: Line 5:
 
Defining properties of tram types.
 
Defining properties of tram types.
   
Up to 64 tramtypes can be defined.
+
Up to 63 tramtypes can be defined.
   
 
== Properties ==
 
== Properties ==

Revision as of 18:33, 27 April 2020

Action 0 properties for tram types

Action 0 - Properties for tram types

Defining properties of tram types.

Up to 63 tramtypes can be defined.

Properties

Number Version Size Description
08 Supported by OpenTTD 1.101.10 Not supported by TTDPatch 4*B Tram type label
09 Supported by OpenTTD 1.101.10 Not supported by TTDPatch W StringID: Build tram toolbar caption
0A Supported by OpenTTD 1.101.10 Not supported by TTDPatch W StringID: Tram construction dropdown text
0B Supported by OpenTTD 1.101.10 Not supported by TTDPatch W StringID: Build vehicle window caption
0C Supported by OpenTTD 1.101.10 Not supported by TTDPatch W StringID: Autoreplace text
0D Supported by OpenTTD 1.101.10 Not supported by TTDPatch W StringID: New engine text
0F Supported by OpenTTD 1.101.10 Not supported by TTDPatch B n*D Powered tram type list[1]
10 Supported by OpenTTD 1.101.10 Not supported by TTDPatch B Tram type flags
13 Supported by OpenTTD 1.101.10 Not supported by TTDPatch W Construction costs
14 Supported by OpenTTD 1.101.10 Not supported by TTDPatch W Speed limit
16 Supported by OpenTTD 1.101.10 Not supported by TTDPatch B Minimap colour
17 Supported by OpenTTD 1.101.10 Not supported by TTDPatch D Introduction date
18 Supported by OpenTTD 1.101.10 Not supported by TTDPatch B n*D Introduction required tram type list[1]
19 Supported by OpenTTD 1.101.10 Not supported by TTDPatch B n*D Introduced tram type list[1]
1A Supported by OpenTTD 1.101.10 Not supported by TTDPatch B Sort order
1B Supported by OpenTTD 1.101.10 Not supported by TTDPatch W StringID: Tram type name
1C Supported by OpenTTD 1.101.10 Not supported by TTDPatch W Infrastructure maintenance cost factor
1D Supported by OpenTTD 1.101.10 Not supported by TTDPatch B n*D Alternate tram type labels that shall be "redirected" to this tram type
  1. 1.0 1.1 1.2 Tram type labels in this list are not resolved using the alternate label list.

In NFO, tram type IDs will be GRF local, with an ID to label mapping. Therefore to modify an existing tram type, specify its label in property 08. To create a new tram type, again just specify its label in property 08. This way there is no need for complex GRM mechanisms to allocate IDs. If a label 'clashes' with another GRF, then one GRF will end up modifying the properties instead of creating a new tram type.

When a new tram type is created, it is populated with the information from the first tram type, except that the powered list contains only the tram type being created. However, no default values should be assumed, as the first tram type may have been modified.

Vehicle and Tramtype availability

Vehicle and tramtype availability and compatibility is influenced by multiple properties. Generally, the vehicle defines which tramtype it is, and the tramtypes define the compatibility between each other.

  • A vehicle exists, if its tramtype (road vehicle prop 05) is defined. Otherwise the vehicle is disabled.
  • When a vehicle is introduced, it always introduces its tramtype (road vehicle prop 05).
  • A tramtype is introduced, if at least one of the following conditions is met:
    • A vehicle is introduced, that references the tramtype (road vehicle prop 05).
    • Another tramtype is introduced, that references the tramtype via the introduced tramtype list (tramtype prop 19).
    • The introduction date (tramtype prop 17) is passed and all required tramtypes (tramtype prop 18) are available.

Via tramtype property 1D multiple tramtypes can be defined, which shall be considered equivalent to a tramtype. This affects the interpretation of road vehicle property 05. If road vehicle property 05 references an undefined tramtype, then tramtype property 1D is checked for all defined tramtypes, whether the vehicle can be reassigned to some other tramtype. Otherwise the vehicle is disabled.

Tram type label (08)

These are globally unique four-letter identifiers for specific tram types (analoguous to cargo labels), used to make various tram types accessible from road vehicle grfs. Reserved labels for default tram types are:

Label Tram Type
RAIL Normal Tram
ELRL Electrified Tram

Tram type sets may use up to 64 tramtypes and have to specify their own labels.

See also Tram Type Translation Table for further info.

Build tram toolbar caption (09)

String ID of the name of the tram type as shown in the toolbar caption.

Tram construction dropdown text (0A)

String ID for text in the dropdown of all tram types.

This string must never start with a colour control code.

Build vehicle window caption (0B)

String ID for build vehicle window caption.

Autoreplace text (0C)

String ID for tram type shown in autoreplace window.

New engines (0D)

StringID to use for showing texts of the type "We have invented a new <tram type> engine".

Powered tram type list (0F)

List of tram types on which road vehicles of this tram type are powered. E.g. vehicles of "normal tram"-type are powered on "electrified tram"- and "haul-tram"-type as well. Note that there is no "compatible tram type list" since there is no difference between "powered" and "compatible" for tramtypes

The format is:

0E <nvar> (<tram type label>){n}

That is you give the number of compatible tram types in a single byte followed by a list of that length of tram type labels. A tram type is automatically powered with itself, so you don't need to list the current tram type.

Note that these properties apply to road vehicles of this tram type, not the tram itself. If you want road vehicles of other tram types to be able to run on your tram types, you must set the powered tram types property for each tram type. Setting these properties behaves always incremental, so you only need to the set additional bits for each other tram type, you cannot remove poweredness once it is set (by some other grf).

Tram type flags (10)

Flags to define properties related to the tram type:

Bit Value Meaning
0 1 Draw catenary for this tram type
1 2 Disallow level crossings for this tram type
2 4 Disallow construction of houses along tramtype
3 8 Hide this tram type from construction menu
4 16 Enables towns to build tramtype, but towns don't build trams...

Speed limit (14)

Speed limit in mph*1.6 (approx. km/h). Set to "0" for no limit at all.

Map colour (16)

This property defines the colour this tram type is drawn in the minimap view. The byte value specifies the colour entry in the DOS palette.

Introduction date (17)

This property defines the long date formatted introduction date of this tram type. With this property set the tram type will be introduced at (or after) this date when all of the introduction required tram types are available to the company of the player, or whenever a vehicle using this tram type gets introduced whichever is first.

Introduction required tram type list (18)

List of tram types on that need to be available to the company of the player for this tram type to be introduced at (or after) the introduction date. This limit does not apply when the tram type is introduced by the introduction of a vehicle.

Same format as for property 0F above.

This can, for example, be used to introduce a tram type with catenary when both normal tram and electrified tram types are available.

Introduced tram type list (19)

List of tram types that get introduced when this tram type is introduced. For example, to make sure that when a fast tram type is introduced the slow variant exists.

Same format as for property 0F above.

Sort order (1A)

Property for influencing the sort order of the drop down lists with tram types. Default values are as follows:

Value Meaning
07 Normal Tram
17 Electrified Tram
n7 Tramtype #n

Thus the tram type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.

Tram type name (1B)

String ID of the name of the tram type.

Alternate tram type labels (1D)

A list of alternate labels that get "redirected" to this tram type when used e.g. as tram type of road vehicle or when testing if a label is defined. The redirection only happens if the alternate label isn't defined as a real tram type. Same format as for property 0F above.

Alternate labels are not considered when evaluating properties 0F, 18, and 19.

Example

To be written