Difference between revisions of "NML:Stations"
(→Base station variables: Make clear that 2nd table is shared also) |
(→Station variables: Add 40+x variables) |
||
Line 89: | Line 89: | ||
| 1 if this cargo type was accepted at the station since the last periodic processing, which happens every 250 ticks. 0 otherwise. |
| 1 if this cargo type was accepted at the station since the last periodic processing, which happens every 250 ticks. 0 otherwise. |
||
|} |
|} |
||
+ | |||
+ | |||
+ | ===Variables without a parameter=== |
||
+ | |||
+ | {| class="t" |
||
+ | ! name |
||
+ | ! value range |
||
+ | ! comment |
||
+ | |- |
||
+ | | tile_type |
||
+ | | 0..7 |
||
+ | | The type of tile, as defined in your station layout |
||
+ | |- |
||
+ | | terrain_type |
||
+ | | TILETYPE_XX |
||
+ | | TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW |
||
+ | |- |
||
+ | | track_type |
||
+ | | Entry from [[NML:Railtypetable|railtype translation table]] |
||
+ | | |
||
+ | |- |
||
+ | | company_num |
||
+ | | 0 ... 14 |
||
+ | | company number of the vehicle owner. TTDPatch only supports up to 8 companies (0 ... 7) |
||
+ | |- |
||
+ | | company_type |
||
+ | | PLAYERTYPE_XX |
||
+ | | |
||
+ | ;PLAYERTYPE_HUMAN |
||
+ | :human player |
||
+ | ;PLAYERTYPE_AI |
||
+ | :AI player |
||
+ | ;PLAYERTYPE_HUMAN_IN_AI |
||
+ | :human managing AI company |
||
+ | ;PLAYERTYPE_AI_IN_HUMAN |
||
+ | :AI managing human company |
||
+ | |||
+ | OpenTTD only uses PLAYERTYPE_HUMAN and PLAYERTYPE_AI. If you cheat yourself to be part of an AI company OpenTTD will still report PLAYERTYPE_AI for the company with yourself and the AI and it'll report PLAYERTYPE_HUMAN for the now uncontrolled company. |
||
+ | |- |
||
+ | | company_colour1 |
||
+ | | COLOUR_XXX |
||
+ | | |
||
+ | Refer to the table [[NML:List of default colour translation palettes#Company colour helper functions|here]] for possible values. |
||
+ | |- |
||
+ | | company_colour2 |
||
+ | | COLOUR_XXX |
||
+ | | |
||
+ | Same as company_colour1, if no 2nd company colour is chosen. Refer to the table [[NML:List of default colour translation palettes#Company colour helper functions|here]] for possible values. |
||
+ | |- |
||
+ | | pbs_reserved |
||
+ | | [0 <nowiki>|</nowiki> 1] |
||
+ | | 1 if the tile has been reserved by a train for PBS (Path-based signalling) purposes, 0 otherwise. |
||
+ | |- |
||
+ | | pbs_reserved_or_disabled |
||
+ | | [0 <nowiki>|</nowiki> 1] |
||
+ | | 1 if the tile has been reserved by a train for PBS (Path-based signalling) purposes, or if PBS is not enabled. Currently PBS is always considered enabled if the game version used supports it, but in the future, this may change to check if the current signal block actually uses PBS-signals. |
||
+ | |- |
||
+ | | pbs_enabled |
||
+ | | [0 <nowiki>|</nowiki> 1] |
||
+ | | 1 if PBS is enabled. Currently PBS is always considered enabled if the game version used supports it, but in the future, this may change to check if the current signal block actually uses PBS-signals. |
||
+ | |- |
||
+ | | rail_continuation |
||
+ | | bitmask(0, ... 7) |
||
+ | | [[#Rail continuation|see below]] |
||
+ | |- |
||
+ | | rail_present |
||
+ | | bitmask(0, ... 7) |
||
+ | | [[#Rail continuation|see below]] |
||
+ | |- |
||
+ | | animation_frame |
||
+ | | 0..255 |
||
+ | | Animation frame of the current tile. |
||
+ | |} |
||
+ | |||
+ | ====Rail continuation==== |
||
+ | Variables <code>rail_continuation</code> and <code>rail_present</code> both contain a bitmask, with 8 possible bits set. Each bit corresponds to one of the adjacent tiles, refer to the table or picture below. The bit in <code>rail_present</code> is set if the tile contains any rail track. Bits 0..3 in <code>rail_continuation</code> are only set if there is rail track on the tile and if that track connects to the current tile (note that this tile has no connection to the tiles corresponding to bits 2 and 3, but that doesn't matter). Bits 4..7 in <code>rail_continuation</code> are set if there is track on the tile and if that track connects to tile 2 or 3, whichever is applicable. |
||
+ | {| |- |
||
+ | !Bit!!Set if rail continues in direction of... |
||
+ | |- |
||
+ | |0||+Length |
||
+ | |- |
||
+ | |1||-Length |
||
+ | |- |
||
+ | |2||+Platforms |
||
+ | |- |
||
+ | |3||-Platforms |
||
+ | |- |
||
+ | |4||+Length, +Platforms |
||
+ | |- |
||
+ | |5||-Length, +Platforms |
||
+ | |- |
||
+ | |6||+Length, -Platforms |
||
+ | |- |
||
+ | |7||-Length, -Platforms |
||
+ | |} |
||
+ | |||
+ | The following picture illustrates which bits represent which tile for the two possible station orientations: |
||
+ | |||
+ | [[File:station_var45.png]] |
||
==Station callbacks== |
==Station callbacks== |
Revision as of 16:40, 17 September 2012
Vehicles, Stations, Canals, Bridges, Towns, Houses, Industries (Tiles), Cargos, Airports+Tiles, Objects, Railtypes, Roadtypes, Tramtypes, Terrain
- common props | vars | CBs
- train | roadveh | ship | aircr props
- common variables
- industry props | vars | CBs
- tile props | vars | CBs
- airport props | vars | CBs
- tile props | vars | CBs
Stations in NML are currently a work-in-progress. Therefore, things may be added, changed or removed without notice. At the moment, it is not yet possible to write your own station NewGRF in NML.
Station properties
There are no properties defined yet
Station variables
Base station variables
The following variables are shared between stations and airports:
name | value range | comment |
---|---|---|
had_vehicle_of_type | bitmask(HAD_VEHICLE_OF_TYPE_XXX, ...) | Bitmask of vehicle types that have visited the station. XXX = [TRAIN | BUS | TRUCK | AIRCRAFT | SHIP]. |
is_waypoint | [0 | 1] | Whether the station is a waypoint |
facilities | bitmask(FACILITY_XXX, ...) | Bitmask of facilities associated with the station. XXX = [TRAIN | TRUCK_STOP | BUS_STOP | AIRPORT | DOCK]. |
airport_type | AIRPORTTYPE_XXX | Type of airport, contains a bogus value if the station has no airport. XXX = [SMALL | LARGE | HELIPORT | OILRIG]. |
build_date | date (yyyy,mm,dd)
|
Date when the station was built. Is clamped to the 1920-2099 range. |
The following variables are also shared with airports. They all require a single argument: a cargo type from your cargo translation table.
name | value range | comment |
---|---|---|
cargo_amount_waiting | 0..32767 | Units of cargo of waiting |
cargo_rating | 0..100 | Rating for this cargo type (in %) |
cargo_time_since_pickup | 0..255 | Time since the cargo was last picked up. 1 unit equals 185 ticks, or about 2.5 game days. |
cargo_time_en_route | 0..255 | Time this cargo has spent en-route. 1 unit equals 185 ticks, or about 2.5 game days. |
cargo_last_vehicle_speed | 0..255 | Speed of the last vehicle picking up this cargo type. The unit depends on the type of vehicle. For trains and road vehicles, one unit is 1 km/h; for ships, it's 0.5 km/h; for aircraft, it's 8 mph. If the max. speed is above 255 speed units, 255 is used instead |
cargo_last_vehicle_age | 0..255 | Age of the last vehicle picking up this cargo type, in years. |
cargo_accepted | [0 | 1] | 1 if this cargo type is currently being accepted at the station, 0 otherwise. |
cargo_accepted_ever | [0 | 1] | 1 if this cargo type has ever been accepted at the station, 0 otherwise. |
cargo_accepted_last_month | [0 | 1] | 1 if this cargo type was accepted last month at the station, 0 otherwise. |
cargo_accepted_this_month | [0 | 1] | 1 if this cargo type was accepted this month at the station, 0 otherwise. |
cargo_accepted_bigtick | [0 | 1] | 1 if this cargo type was accepted at the station since the last periodic processing, which happens every 250 ticks. 0 otherwise. |
Variables without a parameter
name | value range | comment |
---|---|---|
tile_type | 0..7 | The type of tile, as defined in your station layout |
terrain_type | TILETYPE_XX | TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW |
track_type | Entry from railtype translation table | |
company_num | 0 ... 14 | company number of the vehicle owner. TTDPatch only supports up to 8 companies (0 ... 7) |
company_type | PLAYERTYPE_XX |
OpenTTD only uses PLAYERTYPE_HUMAN and PLAYERTYPE_AI. If you cheat yourself to be part of an AI company OpenTTD will still report PLAYERTYPE_AI for the company with yourself and the AI and it'll report PLAYERTYPE_HUMAN for the now uncontrolled company. |
company_colour1 | COLOUR_XXX |
Refer to the table here for possible values. |
company_colour2 | COLOUR_XXX |
Same as company_colour1, if no 2nd company colour is chosen. Refer to the table here for possible values. |
pbs_reserved | [0 | 1] | 1 if the tile has been reserved by a train for PBS (Path-based signalling) purposes, 0 otherwise. |
pbs_reserved_or_disabled | [0 | 1] | 1 if the tile has been reserved by a train for PBS (Path-based signalling) purposes, or if PBS is not enabled. Currently PBS is always considered enabled if the game version used supports it, but in the future, this may change to check if the current signal block actually uses PBS-signals. |
pbs_enabled | [0 | 1] | 1 if PBS is enabled. Currently PBS is always considered enabled if the game version used supports it, but in the future, this may change to check if the current signal block actually uses PBS-signals. |
rail_continuation | bitmask(0, ... 7) | see below |
rail_present | bitmask(0, ... 7) | see below |
animation_frame | 0..255 | Animation frame of the current tile. |
Rail continuation
Variables rail_continuation
and rail_present
both contain a bitmask, with 8 possible bits set. Each bit corresponds to one of the adjacent tiles, refer to the table or picture below. The bit in rail_present
is set if the tile contains any rail track. Bits 0..3 in rail_continuation
are only set if there is rail track on the tile and if that track connects to the current tile (note that this tile has no connection to the tiles corresponding to bits 2 and 3, but that doesn't matter). Bits 4..7 in rail_continuation
are set if there is track on the tile and if that track connects to tile 2 or 3, whichever is applicable.
Bit | Set if rail continues in direction of... |
---|---|
0 | +Length |
1 | -Length |
2 | +Platforms |
3 | -Platforms |
4 | +Length, +Platforms |
5 | -Length, +Platforms |
6 | +Length, -Platforms |
7 | -Length, -Platforms |
The following picture illustrates which bits represent which tile for the two possible station orientations:
Station callbacks
There are no callbacks defined yet