CollisionsCheckRule

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Rule that validates placement based on collision detection.

Source File: addons/grid_building/placement/placement_rules/template_rules/collisions_check_rule.gd

Extends: TileCheckRule

Exported Properties

  • Property: pass_on_collision = false

    Controls collision validation behavior:

    • false: Rule PASSES when no collision (placement requires clear space)
    • true: Rule PASSES when collision detected (placement requires overlap)

    Common use cases:

    • false: Building placement (needs empty space)
    • true: Attachment mechanics (must connect to existing structures)
  • Property: messages : [CollisionRuleSettings](./collision-rule-settings/) - Modular message configuration resource

Properties

  • Property: collision_mask = 1 - Physics layers to scan for collisions.

Private Properties

  • Property: _rule_check_layer_names : Array[String] (private)

Public Methods

setup

1
setup(p_gts : GridTargetingState) -> Array[String]

Setup the rule with the provided GridTargetingState. Returns an array of issues found during setup. p_gts: GridTargetingState - The targeting state to use for placement [returns] Array[String] - Array of issues found during setup


validate_placement

1
validate_placement() -> RuleResult

Validates placement by checking collisions on all provided indicators. Returns a RuleResult with success/failure and messages.


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 number of failing indicators.

p_indicators: Array[RuleCheckIndicator] - Array of indicators to test collision against NOTE: This method is public and should be used directly by callers. The previous private wrapper _get_failing_indicators was removed to simplify the API.


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


Private Methods

_init

1
_init()

Flags: private


_indicator_apply_target_exceptions

1
_indicator_apply_target_exceptions(indicator: ShapeCast2D) -> void

Flags: private

Add all CollisionObject2D under the preview target as exceptions on the shape cast. Also adds any nodes from GridTargetingState.collision_exclusions (e.g., original object during manipulation move).


_collect_bodies_recursive

1
2
3
4
_collect_bodies_recursive(
    node: Node,
    out: Array[CollisionObject2D]
) -> void

Flags: private