PlacementSystem
PlacementSystem
Core placement system that coordinates all placement-related functionality. Pure C# implementation without Godot dependencies for unit testing. This system orchestrates placement operations including validation, indicator management, collision detection, and rule processing. Responsibilities:
- Coordinate placement validation and execution
- Manage indicator setup and positioning
- Handle collision detection integration
- Process placement rules and validation
- Generate placement reports Ported from: godot/addons/grid_building/systems/placement/placement_system.gd
Project: GridPlacement v6.0
Layer: Godot
Source: Godot/Core/_incomplete/Systems/Placement/Placement.cs/PlacementSystem.cs
Namespace: GridBuilding.Core.Systems.Placement
Kind: class
Parsing Method: AST-based (Roslyn) - NOT regex
⚠️ IMPORTANT: This documentation was generated using AST parsing, not regex.
Properties
PlacementCommands
Optional placement commands surface for user-aware operations.
Session
Optional GridBuilding session providing per-user scopes.
HasUserSessionSupport
True if user/session-aware APIs are fully configured.
TargetingState
The grid targeting state for position information. Uses the pure C# TargetingState POCS class instead of the obsolete interface.
BuildingState
The building state for building operations.
PlacementContext
The placement context for validation.
IsReady
Whether the system is ready for placement operations.
Methods
SetTargetingState
Sets the grid targeting state.
Returns: void
Parameters:
TargetingState targetingState
SetBuildingState
Sets the building state.
Returns: void
Parameters:
IBuildingState buildingState
SetPlacementContext
Sets the placement context.
Returns: void
Parameters:
IPlacementContext context
ValidatePlacement
Validates placement for a strongly-typed core Placeable.
Returns: PlacementReport
Parameters:
Placeable placeableCoreVector2I position
ValidatePlacement
Validates a placement operation.
Returns: PlacementReport
Parameters:
object? placeableCoreVector2I position
ExecutePlacement
Executes a placement operation without explicit user/session context. Prefer the user-aware command surface (TryPlaceForUser/TryDemolishForUser) for new code paths.
Returns: PlacementReport
Parameters:
object? placeableCoreVector2I position
TryPlaceForUser
Attempts to execute placement for a specific user in the current session. This is a user/session-aware facade over IPlacementCommands.
Returns: PlacementResult
Parameters:
UserId userIdPlaceable placeableCoreVector2 worldPosition
TryDemolishForUser
Attempts to demolish at a world position for a specific user.
Returns: PlacementResult
Parameters:
UserId userIdCoreVector2 worldPosition
SetupIndicators
Sets up indicators for a placement.
Returns: IndicatorSetupReport
Parameters:
object? placeableCoreVector2I position
GetRuntimeIssues
Gets runtime validation issues.
Returns: List<string>
GetRuntimeValidation
Gets a structured GBValidationResult for runtime diagnostics.
Returns: GBValidationResult