WithinTilemapBoundsRule

WithinTilemapBoundsRule

A rule that validates placement is within the boundaries of a tilemap. This rule works by checking if a tile exists at a proposed placement position on the target TileMapLayer. It ensures that a player or system cannot place objects in empty, unmapped areas of the scene. Behavior:

  • The rule passes if every indicator is positioned over a cell that has an assigned TileData object on the target map.
  • The rule fails if any indicator is over a cell that returns null for TileData, indicating that the cell is outside of the mapped region. Usage:
  • Attach this rule to a CompositionContainer for context wide injection OR a Placeable for placeable specific rule evaluation
  • The GridTargetingState must provide a valid TileMapLayer for the rule to check against. Ported from: godot/addons/grid_building/systems/placement/validators/placement_rules/template_rules/within_tilemap_bounds_rule.gd

Project: GridPlacement v6.0
Layer: Godot
Source: Godot/_Legacy/Systems/Placement/Validators/WithinTilemapBoundsRule.cs
Namespace: GridBuilding.Godot.Systems.Placement.Validators
Kind: class

Parsing Method: AST-based (Roslyn) - NOT regex

⚠️ IMPORTANT: This documentation was generated using AST parsing, not regex.

Properties

SuccessMessage

Success message for valid placement.

FailedMessage

Failure message for out-of-bounds placement.

NoIndicatorsMessage

Message when no indicators are available.

EnableDebugDiagnostics

Optional: enable extra per-indicator diagnostics during tile lookups (very verbose).

Methods

Setup

Setup the rule with the provided GridTargetingState.

Returns: Array<string>

Parameters:

  • GridTargetingState gts

TearDown

Tears down the rule, cleaning up indicators and state.

Returns: void

ValidatePlacement

For each tilemap indicator, check the tilemap to see if the tile at its position is used on any layer or not.

Returns: RuleResult

GetFailingIndicators

Evaluates indicators against the rule and returns failing ones. Returns the failing indicators that are outside valid tilemap bounds. /// CRITICAL: Overrides TileCheckRule.get_failing_indicators to avoid circular dependency where the base implementation checks indicator.valid, but indicator.valid depends on rule results

Returns: Array<RuleCheckIndicatorNode>

Parameters:

  • Array<RuleCheckIndicatorNode> indicators