name | value range | comment |
---|---|---|
relative_x | 0..255 | X-coordinate (top right -> bottom left) of the tile relative to the northernmost tile. |
relative_y | 0..255 | Y-coordinate (top left -> bottom right) of the tile relative to the northernmost tile. |
relative_pos | 0xYYXX | A combination of relative_x and relative_y in the format 0xYYXX. Useful if you want to check for a single position. |
terrain_type | TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW | |
tile_slope | Which corners are raised on the given tile. |
Bit 0: west corner is above the lowest corner. Bit 1: south corner is above the lowest corner. Bit 2: east corner is above the lowest corner. Bit 3: north corner is above the lowest corner. Bit 4: this tile is a steep slope (the corner opposite to the lowest corner is 2 units higher). See tile slopes for an illustration |
build_date | The date this object was build. | |
animation_frame | 0..255 | Current animation frame |
company_colour | 0..15 | Colour used for the company colour mask |
owner | 0..0x10 | CompanyID of the owner of the object or 0x10 if it was build in the scenario editor |
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. |
name | arguments | value range | comment |
---|---|---|---|
nearby_tile_object_type | x, y offset (-8..7) | ID of the object on a nearby tile, if defined by the same grf. OBJECT_TYPE_OTHER_GRF if the object is defined by a different grf (or none at all). OBJECT_TYPE_NO_OBJECT if the tile does not contain an object. | |
nearby_tile_random_bits | x, y offset (-8..7) | Random bits of the given tile | |
nearby_tile_slope | x, y offset (-8..7) | See tile_slope | |
nearby_tile_is_same_object | x, y offset (-8..7) | 0 .. 1 | Is the given tile part of the same object? |
nearby_tile_is_water | x, y offset (-8..7) | 0 .. 1 | Is the given tile a water tile? |
nearby_tile_terrain_type | x, y offset (-8..7) | See terrain_type | |
nearby_tile_height | x, y offset (-8..7) | 0 .. 120 | The minimum height of the given tile. 8 units correspond to one height level |
nearby_tile_class | x, y offset (-8..7) | Tile class | |
nearby_tile_animation_frame | x, y offset (-8..7) | See animation_frame | |
object_type_count | object id [, grfid] | 0..0xFFFF | Number of objects with the given object id currently on the map. Grfid is the grfid of the newgrf you want to check the object count of (default is current grf). |
object_type_nearest | object id [, grfid] | 0..0xFFFF | Manhattan distance to the closest object of the given type. Grfid is the grfid of the newgrf you want to check the minimum object distance of (default is current grf). If the given object type is not yet built, this will return 0xFFFF |
property | value range | comment |
---|---|---|
class | String literal of length 4 | Unlike station classes, there is currently no default yet. You have to set the class ID before any other property or graphics. Characters allowed in the IDs are A-Z, 0-9. While you are technically free to chose your own class, it's highly recommended you stick to one of the default classes. |
classname | string | You only need to set this for one object in every class. |
name | string | |
climates_available | bitmask(CLIMATE_XXX, CLIMATE_YYY, ...) | XXX = [TEMPERATE | ARCTIC | TROPICAL | TOYLAND], alternatively NO_CLIMATE or ALL_CLIMATES |
size | [x, y] | Size in x and y direction. Both x and y must be compiletime constants |
build_cost_multiplier | multiplicator to the base purchase cost | |
remove_cost_multiplier | multiplicator to the base removal cost | |
introduction_date | date | The date this object becomes available to build. |
end_of_life_date | date | The last date this object is buildable. Must be at least 365 days after introduction_date |
object_flags | bitmask(OBJ_FLAG_XXX, OBJ_FLAG_YYY) | See list of object flags |
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 | ||
callback_flags | bitmask(OBJ_CBF_XXX, OBJ_CBF_YYY) | XXX = [SLOPE_CHECK | DECIDE_ANIM | DECIDE_ANIM_SPEED | DECIDE_COLOUR | ADDITIONAL_TEXT | AUTOSLOPE] |
height | 0..255 | Height of the object / 8. For example if your object is 16 pixels height you should set height to 2. In OpenTTD this property is used to determine the height of the build object window; the height for the object preview is set to 32 + "value of property" * 8. The property is also used to determine how high a bridge must be if it is allowed by the bit in object_flags. |
Note: the class names listed below are recommended, you still need to set the class name for at least one object in every class or you risk to end up with objects in a class without a name. If multiple NewGRFs define objects for the same class the name defined in the last NewGRF will be used.
Class | Name of the class | Description |
---|---|---|
STRU | Structures | Multitile engineered objects that don't quite fit in as industries, houses or stations - dams etc. |
INFR | Infrastructure | lightpoles, communication towers, transmission towers, road signs, etc. |
BLDG | Buildings | Normally accomodated by industries, houses or stations but the author feels there are limiting circumstances. |
NATR | Natural objects | caves, coral reefs, swamps, etc. |
PARK | Public areas | Normally accomodated by towns or industries (tourist stuff ...) but the author feels there are limiting circumstances - Parks, statues, etc. |
ARTF | Artifacts | They really don't fit under any of the above - shipwrecks, etc. |
MISC | Miscellaneous | For the author who is unable to accommodate his/her object under any of the previous labels. |
Name | Meaning |
---|---|
OBJ_FLAG_ONLY_SE | Only available in the scenario editor (incompatible with OBJ_FLAG_ONLY_INGAME) |
OBJ_FLAG_IRREMOVABLE | Object cannot be removed with the normal dynamite tool. In OpenTTD you can only remove the object with the magic bulldozer cheat, in TTDPatch you can remove it by holding ctrl while using the bulldozer tool. The cost of removing this object is multiplied by 25. |
OBJ_FLAG_ANYTHING_REMOVE | Anything can remove this object (owned land behavior) |
OBJ_FLAG_ON_WATER | Allow construction of the object on water |
OBJ_FLAG_REMOVE_IS_INCOME | Removal cost is actually income (owned land behaviour) |
OBJ_FLAG_NO_FOUNDATIONS | Do not display foundations if on a slope |
OBJ_FLAG_ANIMATED | Setting this flag will allow the object's animation counter to be increased, must be set if you plan to make use of animations. |
OBJ_FLAG_ONLY_INGAME | Only available during game play (incompatible with OBJ_FLAG_ONLY_SE) |
OBJ_FLAG_2CC | Allows 2cc mapping for objects instead of the default 1cc |
OBJ_FLAG_NOT_ON_LAND | Disallows construction on land (implies OBJ_FLAG_ON_WATER) |
OBJ_FLAG_DRAW_WATER | Draws the water under the object. Only applies when built on top of a water tile, also replaces the ground tile of the object completely. Does not work when object built on sloped water tiles. |
OBJ_FLAG_ALLOW_BRIDGE | Allow bridge over the object taking the building height into account. |
OBJ_FLAG_RANDOM_ANIMATION | Random bits in the "next animation frame" callback |
Name | Meaning |
---|---|
OBJ_CB_SLOPE_CHECK | Check for the slope of a tile |
OBJ_CB_DECIDE_ANIM | Decide whether animation continues: 0xFF stops animation, 0xFE continues with next frame |
OBJ_CB_DECIDE_ANIM_SPEED | Decide the animation frame to jump to. Or alternatively: 0xFF to stop animation, 0xFE to start animation with current frame, 0xFD to keep the current animation frame and do nothing |
OBJ_CB_DECIDE_COLOUR | Return the colour, or for 2 company colours the two colours, to be used. In the case of 2CC the 2nd company colour goes into the high 4 bits of the return value |
OBJ_CB_ADDITIONAL_TEXT | Return an additional string which is shown in the purchase menu. It should not exceed in length three lines. |
OBJ_CB_AUTOSLOPE | Return a value different from 0 in order to disable autoslope behaviour. |