TileCheckRule

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Base class for rules that check tile properties for placement validation.

Source File: /addons/grid_building/placement/placement_rules/tile_check_rule.gd

Extends: PlacementRule

Exported Properties

  • Property: fail_visual_settings : [IndicatorVisualSettings](./indicator-visual-settings/) - Display settings for an indicator to use with an override priority.

Properties

  • Property: apply_to_objects_mask : int = 1 - Physics layers for collision object detection.

  • Property: visual_priority : int = 0

    Priority for handling multiple rule failures. Rule with the highest priority and a fail display settings set will be used in the indicator’s sprite to display.

  • Property: indicators : Array[RuleCheckIndicator] = [] - List of all indicators that are currently using the rule for evaluation.

Public Methods

get_failing_indicators

1
2
3
get_failing_indicators(
    p_indicators : Array[RuleCheckIndicator]
) -> Array[RuleCheckIndicator]

Runs the rule against an array of indicators. Returns the indicators that fail the test.

TILECHECKRULE API CONTRACT:

  • validate_placement() → called by this method to determine pass/fail
  • get_runtime_issues() → NOT called automatically; must override this method to use it

Override this method when:

  • You need per-indicator precision (some red, others green)
  • You want get_runtime_issues() to affect indicator state

DEFAULT BEHAVIOR: Returns all provided indicators as failing when validate_placement() fails. This is sufficient for most custom rules that only override validate_placement().

EMPTY INDICATORS GUARD (nothing to test = pass by design): When the preview object has no collision shapes, IndicatorSetupUtils generates zero indicators. This method receives an empty p_indicators array and returns [] (pass). This is intentional — TileCheckRules evaluate per-indicator, and without indicators there is nothing to test. If you need visual feedback for a custom rule on a preview with no collision shapes, add an Area2D + CollisionShape2D to the preview so the indicator system creates at least one indicator to evaluate.

To make get_runtime_issues() control indicator state, override this method: func get_failing_indicators(p_indicators: Array[RuleCheckIndicator]) -> Array[RuleCheckIndicator]: if p_indicators.is_empty(): return [] var issues: Array[String] = get_runtime_issues() # NOW called if issues.is_empty(): return [] return p_indicators.duplicate()


get_tile_positions

1
get_tile_positions() -> Array[Vector2i]

Returns the tile locations that the indicators are currently positioned over on the tilemap You can call this after the rules have been setup for the object being manipulated


tear_down

1
tear_down() -> void

get_editor_issues

1
get_editor_issues() -> Array[String]

Returns an array of issues found during editor validation.


get_runtime_issues

1
get_runtime_issues() -> Array[String]

Returns an array of issues found during runtime validation.

NOTE: This method is NOT called by get_failing_indicators(). It is called by:

  • GBConfigurationValidator during configuration checks
  • System diagnostics (BuildingSystem, GridTargetingSystem, etc.)
  • External code that wants to inspect rule state

To make runtime issues affect indicator display, you MUST override get_failing_indicators() and call this method explicitly. See get_failing_indicators() documentation for details.



Grid Building v5.0.8 | Generated 24/05/2026