IndicatorManager
Summary
Section titled “Summary”Manages placement validation and indicator visualization for grid-based object placement.
Coordinates the creation, validation, and display of placement indicators, integrating with rule-based validation systems to provide visual feedback on valid or invalid placement locations. Emits signals to notify changes in indicator states.
Constants
Section titled “Constants”const DEFAULT_NAME = “IndicatorManager”
Signals
Section titled “Signals”signal indicators_changed( indicators: Array[RuleCheckIndicator] )
Emitted when the active placement indicators are updated.
Properties
Section titled “Properties”initialized: bool = false
Whether the manager has been initalized yet or not
Methods
Section titled “Methods”static func create_with_injection( container: GBCompositionContainer, parent: Node ) -> IndicatorManager
Creates an IndicatorManager with dependencies injected from the provided container.
container
: The dependency injection container.parent
: Optional parent node to attach the IndicatorManager to. [returns] A configured IndicatorManager instance.func get_runtime_issues( ) -> Array[String]
Validates required dependencies and returns any issues found. [returns] An array of issue strings (empty if valid).
func _init( ) -> void
func resolve_gb_dependencies( p_container: GBCompositionContainer ) -> void
Resolves and injects dependencies from the composition container.
p_container
: The dependency injection container.func setup_indicators( p_test_object: Node2D, p_tile_check_rules: Array[TileCheckRule] ) -> IndicatorSetupReport
Sets up placement indicators for a test object using specified tile check rules.
p_test_object
: The object to test for placement.p_tile_check_rules
: The tile check rules to apply. [returns] An IndicatorSetupReport with indicators and diagnostic information.func get_indicator_count( p_test_object: Node2D, p_tile_check_rules: Array[TileCheckRule] ) -> int
Calculates the number of indicators that would be created for a test object without actually creating them. This is useful for performance-critical scenarios or UI calculations where you only need the count.
p_test_object
: The object to test for placement.p_tile_check_rules
: The tile check rules to apply. [returns] The number of indicators that would be created, or -1 if calculation fails.func get_indicators( ) -> Array[RuleCheckIndicator]
Returns the current active placement indicators. [returns] An array of RuleCheckIndicator instances.
func get_colliding_indicators( ) -> Array[RuleCheckIndicator]
Returns indicators currently in collision. [returns] An array of colliding RuleCheckIndicator instances.
func get_colliding_nodes( ) -> Array[Node2D]
Returns nodes colliding with any indicators. [returns] An array of Node2D instances in collision.
func try_setup( p_placeable_rules: Array[PlacementRule], p_gts: GridTargetingState, p_ignore_base ) -> PlacementReport
Attempts to set up a placement action and returns a setup report.
p_placeable_rules
: The placement rules to apply.p_gts
: The grid targeting state.p_ignore_base
: Whether to ignore base rules. [returns] A PlacementReport with setup results.func _log_target_diagnostics( target: Node ) -> void
func _log_indicator_report( indicators_report: IndicatorSetupReport ) -> void
func _build_failed_report( validator_issues: Dictionary, target: Node ) -> PlacementReport
func clear( )
func tear_down( ) -> void
Resets the manager, clearing indicators and validation state.
func apply_rules( ) -> void
Applies placement rules through the validator.
func validate_placement( ) -> ValidationResults
Validates placement using indicators and rules. [returns] A ValidationResults object with validation outcome.
func inject_collision_mapper_dependencies( container: GBCompositionContainer ) -> bool
Updates the collision mapper with dependency injection if a composition container is available.
container
: The dependency injection container. [returns bool] Whether the injection was successful or notfunc get_or_create_testing_indicator( parent_node: Node ) -> RuleCheckIndicator
Returns the shared testing indicator, creating it if it doesn’t exist.
parent_node
: The parent node for the testing indicator. [returns] The testing indicator instance.func setup_collision_mapper( testing_indicator: RuleCheckIndicator, setups: Dictionary ) -> void
Sets up the collision mapper with the testing indicator and test setups.
testing_indicator
: The testing indicator to use.setups
: The collision test setups.func get_collision_mapper( ) -> CollisionMapper
Gets the collision mapper from the indicator service. [returns] The collision mapper instance.
func get_placement_validator( ) -> PlacementValidator
Exposes the underlying PlacementValidator for advanced/test usages. Tests use this to drive validation directly when needed.
func force_shapecast_update( ) -> void
Forces all managed indicators to update their shapecast collision detection immediately. This is useful for tests to avoid waiting for physics frames when you only need collision detection updated but don’t care about validity state yet. For tests that need both collision detection AND validity evaluation, use [method force_indicators_validity_evaluation] instead.
func force_indicators_validity_evaluation( ) -> int
Forces all managed indicators to immediately update collision detection and re-evaluate their validity state based on assigned rules. This is the preferred method for tests as it provides deterministic validation results without needing to wait for physics frames or process cycles. Calls [method RuleCheckIndicator.force_validity_evaluation] on each managed indicator. [returns] The number of indicators that were updated.
func _on_manipulation_canceled( _data: ManipulationData ) -> void
Handles manipulation cancellation by cleaning up all active indicators. This ensures indicators are properly freed when manipulation ends unexpectedly (e.g., source object deleted, user cancels, etc.).
_data
: The manipulation data (unused, but required by signal signature).
Source
Section titled “Source”addons/grid_building/placement/manager/indicator_manager.gd
This API reference is automatically generated from the plugin source code. For implementation examples and usage guides, see the guides section.