Skip to content

IndicatorSetupUtils

IndicatorSetupUtils - Static utility functions for indicator setup operations.

This class provides static utility functions for complex indicator setup logic that has been extracted from IndicatorService for better testability. All functions are static and do not depend on instance state, making them suitable for unit testing.

Key Features: - Static functions for collision test setup building - Testing indicator creation and management - Indicator count calculation without side effects - Tile-based positioning using tile map layers

static func create_testing_indicator( indicator_template: PackedScene, parent_node: Node ) -> RuleCheckIndicator

Returns a shared testing indicator, creating it if it doesn’t exist. The testing indicator is used for collision setup and validation before creating real indicators. This method implements lazy initialization and is safe to call multiple times. The testing indicator is configured to suppress rule-ready logs and is named “_TestingIndicator” for easy identification.

Parameters: indicator_template: PackedScene - Template for creating the indicator parent_node: Node - Parent node to attach the testing indicator to

Returns: RuleCheckIndicator - The shared testing indicator instance, or null if creation fails

static func gather_collision_shapes( test_object: Node2D ) -> Dictionary

Performs the complete indicator setup workflow for a test object. This is the core logic extracted from IndicatorService.setup_indicators for better testability. Handles collision shape gathering, test setup creation, collision mapping, and indicator generation.

Parameters: test_object: Node2D - The object being tested for placement tile_check_rules: Array[TileCheckRule] - Rules to create indicators for collision_mapper: CollisionMapper - Collision mapper for position mapping indicator_template: PackedScene - Template for indicator creation parent_node: Node - Parent node for indicators targeting_state: GridTargetingState - Grid targeting configuration

Returns: SetupResult - Result containing generated indicators and diagnostic info Gathers collision shapes from a test object, organized by owner nodes. This is a wrapper around GBGeometryUtils for consistent API in tests.

Parameters: test_object: Node2D - Object to gather collision shapes from

Returns: Dictionary[Node2D, Array] - Dictionary mapping collision owners to their shapes

addons/grid_building/placement/manager/components/indicator_setup_utils.gd


This API reference is automatically generated from the plugin source code. For implementation examples and usage guides, see the guides section.