Difference between revisions of "NML:Roadstops"
 (Initial NML road stop properties)  | 
				 (Partial addition of road stop variables)  | 
				||
| Line 112: | Line 112: | ||
| RST_GENERAL_FLAG_DRAW_MODE_REGISTER  | 
  | RST_GENERAL_FLAG_DRAW_MODE_REGISTER  | 
||
| {{ottdp|15.0|no}} Read the road stop draw mode from variable 0x100 (set using STORE_TEMP), this overrides the draw_mode property.  | 
  | {{ottdp|15.0|no}} Read the road stop draw mode from variable 0x100 (set using STORE_TEMP), this overrides the draw_mode property.  | 
||
| + | |}  | 
||
| + | |||
| + | |||
| + | ==Road stop variables==  | 
||
| + | |||
| + | ===Base station variables===  | 
||
| + | The following variables are shared between road stops, [[NML:Stations|stations]] and [[NML:Airports|airports]]:  | 
||
| + | |||
| + | {| class="wikitable sortable"  | 
||
| + | ! name  | 
||
| + | ! value range  | 
||
| + | ! comment  | 
||
| + | |-  | 
||
| + | | random_bits_station  | 
||
| + | | 0..65535  | 
||
| + | | 16 random bits, shared between all station sections (rail station sections, airports, ...)  | 
||
| + | |-  | 
||
| + | | had_vehicle_of_type  | 
||
| + | | bitmask(HAD_VEHICLE_OF_TYPE_XXX, ...)  | 
||
| + | | Bitmask of vehicle types that have visited the station. XXX = <nowiki>[TRAIN | BUS | TRUCK | AIRCRAFT | SHIP]</nowiki>.  | 
||
| + | |-  | 
||
| + | | is_waypoint  | 
||
| + | | [0 <nowiki>|</nowiki> 1]  | 
||
| + | | Whether the station is a waypoint  | 
||
| + | |-  | 
||
| + | | facilities  | 
||
| + | | bitmask(FACILITY_XXX, ...)  | 
||
| + | | Bitmask of facilities associated with the station. XXX = <nowiki>[TRAIN | TRUCK_STOP | BUS_STOP | AIRPORT | DOCK]</nowiki>.  | 
||
| + | |-  | 
||
| + | | airport_type  | 
||
| + | | AIRPORTTYPE_XXX  | 
||
| + | | Type of airport, contains a bogus value if the station has no airport. XXX = <nowiki>[SMALL | LARGE | HELIPORT | OILRIG]</nowiki>.  | 
||
| + | |-  | 
||
| + | | build_date  | 
||
| + | | <code style="color:green">date</code>(yyyy,mm,dd)  | 
||
| + | | Date when the station was built. Is clamped to the 1920-2099 range.  | 
||
| + | |}  | 
||
| + | |||
| + | |||
| + | The following variables are also shared with [[NML:Stations|stations]] and [[NML:Airports|airports]]. They all require a single argument: a cargo type from your [[NML:Cargotable|cargo translation table]].  | 
||
| + | |||
| + | {| class="wikitable sortable"  | 
||
| + | ! 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. 0 if no vehicle as picked up the cargo type yet.  | 
||
| + | |-  | 
||
| + | | cargo_last_vehicle_age  | 
||
| + | | 0..255  | 
||
| + | | Age of the last vehicle picking up this cargo type, in years. 255 if no vehicle has picked up the cargo type yet.  | 
||
| + | |-  | 
||
| + | | cargo_accepted  | 
||
| + | | [0 <nowiki>|</nowiki> 1]  | 
||
| + | | 1 if this cargo type is currently being accepted at the station, 0 otherwise.  | 
||
| + | |-  | 
||
| + | | cargo_accepted_ever  | 
||
| + | | [0 <nowiki>|</nowiki> 1]  | 
||
| + | | 1 if this cargo type has ever been accepted at the station, 0 otherwise.  | 
||
| + | |-  | 
||
| + | | cargo_accepted_last_month  | 
||
| + | | [0 <nowiki>|</nowiki> 1]  | 
||
| + | | 1 if this cargo type was accepted last month at the station, 0 otherwise.  | 
||
| + | |-  | 
||
| + | | cargo_accepted_this_month  | 
||
| + | | [0 <nowiki>|</nowiki> 1]  | 
||
| + | | 1 if this cargo type was accepted this month at the station, 0 otherwise.  | 
||
| + | |-  | 
||
| + | | cargo_accepted_bigtick  | 
||
| + | | [0 <nowiki>|</nowiki> 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===  | 
||
| + | |||
| + | {| class="wikitable sortable"  | 
||
| + | ! name  | 
||
| + | ! value range  | 
||
| + | ! comment  | 
||
| + | |-  | 
||
| + | | view  | 
||
| + | | RST_VIEW_BAY_XXX  | 
||
| + | | The view/rotation of the road stop. See [[#List of road stop views|list of road stop views]]  | 
||
| + | |-  | 
||
| + | | stop_type  | 
||
| + | | RST_TYPE_XXX  | 
||
| + | | XXX = [BUS <nowiki>|</nowiki> TRUCK <nowiki>|</nowiki> {{ottdp|15}}WAYPOINT]  | 
||
| + | |-  | 
||
| + | | terrain_type  | 
||
| + | | TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW  | 
||
| + | |  | 
||
| + | |-  | 
||
| + | | tile_slope  | 
||
| + | | SLOPE_XXX  | 
||
| + | |  | 
||
| + | See [[NML:List of tile slopes|tile slopes]] for an overview of possible values  | 
||
| + | |-  | 
||
| + | | has_road  | 
||
| + | | [0 <nowiki>|</nowiki> 1]  | 
||
| + | | 1 if this road stop has road  | 
||
| + | |-  | 
||
| + | | has_tram  | 
||
| + | | [0 <nowiki>|</nowiki> 1]  | 
||
| + | | 1 if this road stop has tram  | 
||
| + | |-  | 
||
| + | | road_type  | 
||
| + | | [Road type <nowiki>|</nowiki> 0xFF]  | 
||
| + | | Entry from [[NML:Railtypetable|roadtype translation table]], or 0xFF if there is no road  | 
||
| + | |-  | 
||
| + | | tram_type  | 
||
| + | | [Tram type <nowiki>|</nowiki> 0xFF]  | 
||
| + | | Entry from [[NML:Railtypetable|tramtype translation table]], or 0xFF if there is no tram  | 
||
| + | |-  | 
||
| + | | animation_frame  | 
||
| + | | 0 .. (frame_count - 1)  | 
||
| + | | Current animation frame, with the maximum defined in the <code style="color:darkgreen">animation_info</code> property.  | 
||
| + | |-  | 
||
| + | | town_manhattan_dist  | 
||
| + | |  | 
||
| + | | Manhattan distance to the nearest town  | 
||
| + | |-  | 
||
| + | | town_euclidean_dist  | 
||
| + | |  | 
||
| + | | Euclidean distance to the nearest town  | 
||
| + | |-  | 
||
| + | | town_zone  | 
||
| + | |  | 
||
| + | [[NML:List of town zones|town zone]]  | 
||
| + | | The town zone of the current tile. The town zone from the closest town (measured in manhattan distance) is used.  | 
||
| + | |-  | 
||
| + | | 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.  | 
||
| + | |-  | 
||
| + | | random_bits_tile  | 
||
| + | | 0..255  | 
||
| + | | 8 random bits, specific to this road stop tile.  | 
||
| + | |-  | 
||
| + | | waiting_triggers  | 
||
| + | | 0..255  | 
||
| + | | Random triggers waiting to be matched. (see [[NML:Random switch|Random switch]])  | 
||
| + | |}  | 
||
| + | |||
| + | ===List of road stop views===  | 
||
| + | |||
| + | {| class="wikitable sortable"  | 
||
| + | ! Name  | 
||
| + | ! Type  | 
||
| + | ! Meaning  | 
||
| + | |-  | 
||
| + | | RST_VIEW_BAY_NE  | 
||
| + | | Bay  | 
||
| + | | Facing north-east  | 
||
| + | |-  | 
||
| + | | RST_VIEW_BAY_SE  | 
||
| + | | Bay  | 
||
| + | | Facing south-east  | 
||
| + | |-  | 
||
| + | | RST_VIEW_BAY_SW  | 
||
| + | | Bay  | 
||
| + | | Facing south-west  | 
||
| + | |-  | 
||
| + | | RST_VIEW_BAY_NW  | 
||
| + | | Bay  | 
||
| + | | Facing north-west  | 
||
| + | |-  | 
||
| + | | RST_VIEW_DRIVE_THROUGH_X  | 
||
| + | | Drive-through  | 
||
| + | | X-axis: north-east to south-west  | 
||
| + | |-  | 
||
| + | | RST_VIEW_DRIVE_THROUGH_Y  | 
||
| + | | Drive-through  | 
||
| + | | Y-axis: north-west to south-east  | 
||
|}  | 
  |}  | 
||
Revision as of 20:20, 3 May 2024
Vehicles, Stations, Canals, Bridges, Towns, Houses, Industries (Tiles), Cargos, Airports+Tiles, Objects, Railtypes, Roadtypes, Tramtypes, Roadstops, 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
 
Road stops can only be defined in OpenTTD 
14.0 or later. 
Road stop IDs
OpenTTD supports 64000 road stop types per game.
Rpad stop IDs are NewGRF-local and can therefore freely be chosen within the ID ranges.
A road stop is allocated by setting the 'class'-property, which should therefore be set first.
Road stop properties
| property | value range | comment | 
|---|---|---|
| class | String literal of length 4 | 
 This property must be set first, before any other properties or graphics.  | 
| classname | string | You only need to set this for one road stop in every class. | 
| name | string | |
| availability_type | RST_AVAILABILITY_TYPE_XXX | XXX = [PASSENGER | FREIGHT | ALL]
 The default value is RST_AVAILABILITY_TYPE_ALL  | 
| draw_mode | bitmask(RST_DRAW_FLAG_XXX, ...) | See list of draw mode flags
 The default value is bitmask(RST_DRAW_FLAG_BAY_ROAD, RST_DRAW_FLAG_DRIVE_THROUGH_ROAD_OVERLAY)  | 
| cargo_random_triggers | Array of cargo labels from the cargotable | Cargo types, which will trigger re-randomization when delivered, loaded or unloaded at the station. | 
| animation_info | Array [ANIMATION_XXX, frame-count] | XXX = [LOOPING | NON_LOOPING], 1..253 frames | 
| animation_speed | 0..16 | 
 Speed of animation, see animation speed table for the meaning of the values.  | 
| animation_triggers | ||
| general_flags | bitmask(RST_GENERAL_FLAG_XXX, ...) | See list of general flags | 
| cost_multipliers | [build_cost, clear_cost] | Build and clear cost multipliers, 16 is the same as a non-NewGRF road stop | 
List of draw mode flags
List of general flags
Road stop variables
Base station variables
The following variables are shared between road stops, stations and airports:
| name | value range | comment | 
|---|---|---|
| random_bits_station | 0..65535 | 16 random bits, shared between all station sections (rail station sections, airports, ...) | 
| 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 stations and 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. 0 if no vehicle as picked up the cargo type yet. | 
| cargo_last_vehicle_age | 0..255 | Age of the last vehicle picking up this cargo type, in years. 255 if no vehicle has picked up the cargo type yet. | 
| 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 | 
|---|---|---|
| view | RST_VIEW_BAY_XXX | The view/rotation of the road stop. See list of road stop views | 
| stop_type | RST_TYPE_XXX | XXX = [BUS | TRUCK |  | 
| terrain_type | TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW | |
| tile_slope | SLOPE_XXX | 
 See tile slopes for an overview of possible values  | 
| has_road | [0 | 1] | 1 if this road stop has road | 
| has_tram | [0 | 1] | 1 if this road stop has tram | 
| road_type | [Road type | 0xFF] | Entry from roadtype translation table, or 0xFF if there is no road | 
| tram_type | [Tram type | 0xFF] | Entry from tramtype translation table, or 0xFF if there is no tram | 
| animation_frame | 0 .. (frame_count - 1) | Current animation frame, with the maximum defined in the animation_info property.
 | 
| town_manhattan_dist | Manhattan distance to the nearest town | |
| town_euclidean_dist | Euclidean distance to the nearest town | |
| town_zone | The town zone of the current tile. The town zone from the closest town (measured in manhattan distance) is used. | |
| 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.  | 
| random_bits_tile | 0..255 | 8 random bits, specific to this road stop tile. | 
| waiting_triggers | 0..255 | Random triggers waiting to be matched. (see Random switch) | 
List of road stop views
| Name | Type | Meaning | 
|---|---|---|
| RST_VIEW_BAY_NE | Bay | Facing north-east | 
| RST_VIEW_BAY_SE | Bay | Facing south-east | 
| RST_VIEW_BAY_SW | Bay | Facing south-west | 
| RST_VIEW_BAY_NW | Bay | Facing north-west | 
| RST_VIEW_DRIVE_THROUGH_X | Drive-through | X-axis: north-east to south-west | 
| RST_VIEW_DRIVE_THROUGH_Y | Drive-through | Y-axis: north-west to south-east |