IndicatorSetupUtils
Summary
Section titled “Summary”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
Methods
Section titled “Methods”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 indicatorparent_node
: Node - Parent node to attach the testing indicator toReturns: 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 placementtile_check_rules
: Array[TileCheckRule] - Rules to create indicators forcollision_mapper
: CollisionMapper - Collision mapper for position mappingindicator_template
: PackedScene - Template for indicator creationparent_node
: Node - Parent node for indicatorstargeting_state
: GridTargetingState - Grid targeting configurationReturns: 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 fromReturns: Dictionary[Node2D, Array] - Dictionary mapping collision owners to their shapes
Source
Section titled “Source”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.