Draft — Unreleased:This page is in active development. APIs, class names, and behavior may change before the release is finalized. Use it as a preview of what's coming — not as a stable integration target.
IndicatorFactory2D
- Creates, positions and manages lifecycle of rule-check indicators. This class provides both static factory methods for creating indicators and instance methods for managing indicator lifecycle. It serves as the unified interface for all indicator operations in the grid building system. ARCHITECTURE NOTE: IndicatorFactory2D instances are typically used within IndicatorManager, which serves as the scene tree parent for rule check indicators. Objects being manipulated should be parented to ManipulationParent instead. For detailed usage guide and examples, see: docs_website/docs/systems/indicator_manager_guide.md ## Static Factory Methods
generate_indicators()- Creates multiple indicators from position-rules mapping
create_indicator()- Creates a single indicator at specified position ## Instance Methods
setup_indicators()- Full indicator setup with collision mapping and reporting
reset()- Comprehensive cleanup with diagnostic capabilities
get_runtime_issues()- Validation of dependencies and state Responsibilities:
- Create and position RuleCheckIndicator2D instances for placement validation
- Transform absolute collision positions into relative positioning around test objects
- Integrate with CollisionMapper2D to map collision positions to rules
- Produce IndicatorSetupReport with diagnostic metadata for tests and logging
- Provide dependency-injection friendly constructors and validation helpers
- Manage indicator lifecycle with enhanced cleanup and reset functionality
- Offer diagnostic capabilities for debugging indicator state and orphaned indicators Positioning Architecture: The factory implements a normalized relative positioning system where collision detection provides absolute tile coordinates, but indicators are positioned relative to test objects. This ensures indicators maintain consistent spatial relationships when test objects move, while collision results provide meaningful spatial validation patterns. Key Features:
- Comprehensive reset() function with critical cleanup logging and orphaned indicator detection
- Diagnostic information reporting for debugging indicator cleanup issues
- Guarded indicator setup with detailed error reporting
- Collision mapper integration with test setup management
- Grid alignment utilities for stable geometry calculations
Source: addons/grid_placement/placement/manager/components/indicator_factory_2d.gd
Syntax
class IndicatorFactory2D extends PlacementInjectableMembers
| Name | Kind | Summary |
|---|---|---|
path | Property | |
DEFAULT_Z_INDEX | Field | Default z index for created indicators. Must render above the placement preview (PlacementSettings.preview_instance_z_index, default 100) so validity feedback is visible. Overridable per setup via PlacementSettings.indicator_z_index. |
generate_indicators | Method | |
indicators | Property | |
rules | Property | |
indicator | Property | |
target_map | Property | |
positioner_tile | Property | |
target_tile | Property | |
create_indicator | Method | |
logger | Property | |
indicator | Property | |
shape_val | Property | |
template_key | Property |
Source
addons/grid_placement/placement/manager/components/indicator_factory_2d.gd
Plugin docs root:gdscript/plugins/grid_placement_dev/docs