ValidPlacementTileRule
AUTO-GENERATED FILE – DO NOT EDIT MANUALLY
A rule that validates a tile position based on a tilemap’s custom data fields.
Source File: addons/grid_building/placement/placement_rules/template_rules/valid_placement_tile_rule.gd
Extends: TileCheckRule
Exported Properties
- Property:
expected_tile_custom_data = {}- Expected custom data fields and values for valid tiles. - Property:
settings : [ValidPlacementRuleSettings](./valid-placement-rule-settings/)- Settings for the valid placement tile rule. Defines custom messages for this rule’s validation.
Public Methods
setup
Creates tile indicators on matching layers to test that colliding tiles exist in shape spaces around the object to be placed
validate_placement
Check each tile indicator of this test to ensure that they collide with the tilemap
tear_down
Frees tile indicators created for this test when the building system no longer is using this rule
does_tile_have_valid_data
Validates if tile data contains all expected custom data across provided maps. Returns true only if all expected custom data keys match at least one layer in the tile data.
p_indicator: RuleCheckIndicator - The indicator object marking the tile position to check
p_maps: Array[TileMapLayer] - Array of TileMapLayer or TileMap nodes to check against
Private Methods
_init
Flags: private
_ensure_settings
Flags: private
Lazy initialization of settings - creates default settings if none are provided
_get_failing_indicators
Flags: private
Runs the rule against an array of indicators and Returns the failing indicators
_get_tile_position
Flags: private
Helper function to convert indicator position to tile coordinates
_tile_has_matching_data
Flags: private
Helper function to check if a tile contains any matching custom data
_test_tile_data_for_all_matches
Flags: private
Checks if the tile data meets all required custom data matches
_post_setup_validation
Flags: private