Difference between revisions of "NML:Railtypes"
(content of nml r1625) |
(some fancy OpenTTD version labels like on the NewGRF specs) |
||
Line 1: | Line 1: | ||
− | Railtypes can only be defined in OpenTTD 1.0 |
+ | Railtypes can only be defined in OpenTTD {{ottd|1.0|r18969}} or later. |
+ | |||
==Railtype properties== |
==Railtype properties== |
||
Line 15: | Line 16: | ||
| date(yyyy,mm,dd) |
| date(yyyy,mm,dd) |
||
| |
| |
||
− | 1.1 |
+ | {{ottd|1.1|r21842}} Valid range for yyyy is 0 ... 5000000. |
|- |
|- |
||
| name |
| name |
||
Line 60: | Line 61: | ||
| 0 ... 65525 |
| 0 ... 65525 |
||
| |
| |
||
− | 1.1 |
+ | {{ottd|1.1|r19307}} per piece of track as multiplier to PR_BUILD_RAIL base cost. |
|- |
|- |
||
| speed_limit |
| speed_limit |
||
Line 73: | Line 74: | ||
| 0 ... 255 |
| 0 ... 255 |
||
| |
| |
||
− | 1.1 |
+ | {{ottd|1.1|r19307}} entry in the colour palette. |
|- |
|- |
||
| requires_railtype_list |
| requires_railtype_list |
||
| list of railtype labels |
| list of railtype labels |
||
| |
| |
||
− | 1.1 |
+ | {{ottd|1.1|r21842}} List of rail types on that need to be available to the company of the player for this rail type to be introduced at (or after) the introduction date. This limit does not apply when the rail type is introduced by the introduction of a vehicle. |
|- |
|- |
||
| introduces_railtype_list |
| introduces_railtype_list |
||
| list of railtype labels |
| list of railtype labels |
||
| |
| |
||
− | 1.1 |
+ | {{ottd|1.1|r21841}} List of rail types that get introduced when this rail type is introduced. For example, to make sure that when a fast rail type is introduced the slow variant exists. |
|- |
|- |
||
| sort_order |
| sort_order |
||
| 0 ... 255 |
| 0 ... 255 |
||
| |
| |
||
− | 1.1 |
+ | {{ottd|1.1|r21866}} number which defines the sort order among rail types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th railtype. |
|} |
|} |
||
Line 164: | Line 165: | ||
| 115 |
| 115 |
||
|} |
|} |
||
+ | |||
==Railtype variables== |
==Railtype variables== |
||
Line 188: | Line 190: | ||
| for depots only: build date of the depot in days since 0 |
| for depots only: build date of the depot in days since 0 |
||
|} |
|} |
||
+ | |||
==Railtype callbacks== |
==Railtype callbacks== |
Revision as of 15:01, 21 August 2011
Railtypes can only be defined in OpenTTD 1.0 or later.
Railtype properties
Sort order
The sort_order influences the sort order of the drop down lists with rail types. Default values are as follows:
Value | Meaning |
---|---|
07 | normal rail |
17 | electrified rail |
27 | monorail |
37 | maglev |
n7 | railtype #n |
Thus the rail 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.
Base speeds for curves
The base speeds relevant for the curve_speed_multiplier are:
curve length | base speed [km/h] |
---|---|
0 (90 degree turn) | 30 |
1 | 44 |
2 | 55 |
3 | 66 |
4 | 75 |
5 | 84 |
6 | 91 |
7 | 98 |
8 | 103 |
9 | 108 |
10 | 111 |
11 | 114 |
12+ | 115 |
Railtype variables
name | value range | comment |
---|---|---|
terrain_type | TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW | |
enhanced_tunnels | 0 | should custom tunnel entrances be modified other values than 0 might be returned |
level_crossing_status | LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN | |
build_date | 0 .. 5000000 | for depots only: build date of the depot in days since 0 |
Railtype callbacks
For rail types a number of callbacks are used to define rail type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the example railtype grf for an example on what sprites are needed in what order.
callbacks | number of sprites | meaning |
---|---|---|
gui | 16 | 4 rail directions, autorail, depot, tunnel and convert rail sprites for rail menu |
track_overlay* | 10 | 6 flat and 4 slope sprites. Track without landscape |
underlay* | 16 | 6 flat and 4 slope, one crossing WITH track, 5 junction pieces without track. Tracks with foundations but without landscape |
tunnels* | 4 | 4 track sprites, one for each tunnel entrance. Only track with foundations, no landscape |
catenary_wire | 28 | |
catenary_pylons | 8 | |
bridge_surfaces* | 6 | |
level_crossings* | 10 | For each direction: one track sprite and 4 sprites for road lights etc |
depot | 6 | 2 sprites for each south-ish, 1 sprite for each north-ish depot. Like original depots. |
fences | 8 | x, y, vertical, horizontal, SW, SE, NE and NW slopes like original fences at sprite 1301 |
The entries marked by * are required. If a non-required callback is not implemented or fails, graphics from the fallback railtype (picked via the station_graphics
property) will be used instead.
Note that there is no "default graphics"-callback.
Example
A typical implementation for railtypes can look like:
item(FEAT_RAILTYPES, elrail, 0x01) { property { label: "SHIN"; name: string(STR_EL_RAIL); menu_text: string(STR_EL_RAIL); build_window_caption: string(STR_BUILD_CAPTION); autoreplace_text: string(STR_AUTOREPLACE); new_engine_text: string(STR_NEW_ENGINE); compatile_railtype_list: ["SHIN","RAIL","ELRL"]; // Tracks of rail and electrified rail are compatible powered_railtype_list: ["ELRL","SHIN"]; // But we got only power when we have electricity railtype_flags: bitmask(RAILTYPE_FLAG_NO_LEVEL_CROSSING); // High speed tracks should not have level crossings curve_speed_multiplier: 1; station_graphics: RAILTYPE_STATION_MAGLEV; // We want the most modern stations construction_cost: 32; // should be pretty steep speed_limit: 500 km/h; acceleration_model: ACC_MODEL_RAIL; // This is still rail, though } graphics { track_overlay: ground_switch_overlay; // defines the sprites drawn as overlay for junctions and highlight underlay: ground_switch_underlay; // defines the usual tracks and the underlay for junctions level_crossings: level_crossing_switch; // defines level crossings including traffic lights and blocking bars tunnels: tunnel_switch; // defines the tracks drawn on a funnel tile depots: depot_switch_electric; // defines the depot sprites bridge_surfaces: bridge_terrain_switch; // defines the overlay drawn over bridges fences: fences_set; // defines the look of fences // we don't define catenery wire and pylons, thus we use the default which comes with the base graphics. } }
The switches and graphics blocks are defined in the usual way as described in sections switches, random switches and graphics block sections.