NML:Roadstops

From GRFSpecs
Revision as of 20:20, 3 May 2024 by Jgr (talk | contribs) (Partial addition of road stop variables)
Jump to navigationJump to search
Props, Vars and CBs

Road stops can only be defined in OpenTTD Supported by OpenTTD 14.014.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.
Road stops belonging to the same class are grouped in the GUI.
There is one special class:

  • "WAYP": Supported by OpenTTD 15.015.0 Not supported by TTDPatch The road stop type will be shown in the waypoint construction window, instead of the station construction window.
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

See list of 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

Name Meaning
RST_DRAW_FLAG_BAY_ROAD Draw road type ground sprite for bay stops.
RST_DRAW_FLAG_DRIVE_THROUGH_ROAD_OVERLAY Draw road overlays for drive-through stops.
RST_DRAW_FLAG_WAYPOINT_GROUND Supported by OpenTTD 15.015.0 Not supported by TTDPatch Draw spritelayout ground sprite on top of underlying road (if unset, the spritelayout ground sprite is not drawn).

List of general flags

Name Meaning
RST_GENERAL_FLAG_RANDOM_ANIMATION Animation callback requires random bits in variable extra_callback_info1.
RST_GENERAL_FLAG_NO_CATENARY Do not show catenary graphics.
RST_GENERAL_FLAG_DRIVE_THROUGH_ONLY Only allow drive-through stops (not bay stops).
RST_GENERAL_FLAG_NO_AUTO_ROAD_CONNECTION Do not automatically build connecting road pieces.
RST_GENERAL_FLAG_BUILD_MENU_ROAD_ONLY Only show in the road build menu (not tram).
RST_GENERAL_FLAG_BUILD_MENU_TRAM_ONLY Only show in the tram build menu (not road).
RST_GENERAL_FLAG_DRAW_MODE_REGISTER Supported by OpenTTD 15.015.0 Not supported by TTDPatch 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, 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 | Supported by OpenTTD 1515 Not supported by TTDPatchWAYPOINT]
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

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 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