A rule that validates a tile position based on a tilemap's custom data fields. This rule checks if a tile at a potential placement position has all the required custom data fields and matching values defined in its expected_tile_custom_data dictionary. It's used to ensure that a tile can only be placed on a specific type of ground, such as "walkable" or "buildable" tiles. Usage:
- Assign this rule to a PlacementSession for context wide injection or to a ScenePlacementEntry for placeable specific rule evaluation
- Set the
expected_tile_custom_datadictionary to define the required key-value pairs (e.g.,{ "type": "ground", "variant": "grass" }). - The rule will fail if the tile at the indicator's position does not contain all the required custom data or if any values do not match.
Source: addons/grid_placement/placement/placement_rules/template_rules/valid_placement_tile_rule.gd
Syntax
class ValidPlacementTileRule extends TileCheckRuleMembers
| Name | Kind | Summary |
|---|---|---|
expected_tile_custom_data | Property | Expected custom data fields and values for valid tiles. |
settings | Property | Settings for the valid placement tile rule. Defines custom messages for this rule's validation. |
setup | Method | |
validate_placement | Method | |
tear_down | Method | |
does_tile_have_valid_data | Method |