PlacementService

PlacementService

Core placement service implementation containing pure C# placement logic. This service handles all business logic for placement validation and execution without any Godot dependencies. It coordinates between validation, collision detection, and targeting state to provide comprehensive placement functionality.

Architecture:

  • Pure C# business logic (no Godot dependencies)
  • Coordinates with validation and collision services
  • Maintains placement state and context
  • Provides detailed placement reporting

Dependencies:

  • IPlacementValidator: Rule validation logic
  • ICollisionCalculator: Collision detection and geometry
  • ITargetingState: Targeting context and state
  • ILogger: Operation logging and diagnostics

Project: GridPlacement v6.0
Layer: Core
Source: Core/_incomplete/Services/Placement/PlacementService.cs
Namespace: GridBuilding.Core.Services.Placement
Kind: class

Parsing Method: AST-based (Roslyn) - NOT regex

⚠️ IMPORTANT: This documentation was generated using AST parsing, not regex.

Properties

IsReady

Gets whether the placement service is ready for operations.

Methods

ValidatePlacement

Validates placement of a placeable at a specific position.

Returns: PlacementReport

Parameters:

  • Placeable placeable
  • CoreVector2 position
  • GBOwner placer

ExecutePlacement

Executes placement of a placeable at a specific position. Note: This only handles the business logic. Actual scene instantiation should be handled by ISceneService in the Godot layer.

Returns: PlacementResult

Parameters:

  • Placeable placeable
  • CoreVector2 position
  • GBOwner placer

GetValidationIssues

Gets validation issues if any dependencies are missing or misconfigured.

Returns: IEnumerable<string>

Reset

Resets the placement service state.

Returns: void

RemoveObject

Removes a placed object from the specified position.

Returns: bool

Parameters:

  • CoreVector2 position
  • GBOwner remover

MoveObject

Moves an object from one position to another.

Returns: bool

Parameters:

  • CoreVector2 fromPosition
  • CoreVector2 toPosition
  • GBOwner mover

IsPositionOccupied

Checks if a position is currently occupied.

Returns: bool

Parameters:

  • CoreVector2 position

GetObjectsInArea

Gets all placed objects within a specified area.

Returns: IEnumerable<Placeable>

Parameters:

  • CoreRect2I area

GetObjectsByOwner

Gets all objects owned by a specific entity.

Returns: IEnumerable<Placeable>

Parameters:

  • string ownerId

ValidateObjectPlacement

Validates object placement with detailed error reporting.

Returns: List<string>

Parameters:

  • CoreVector2 position
  • string placeableType

ClearAllObjects

Clears all placed objects (for testing/reset scenarios).

Returns: void

Dispose

Disposes of the placement service and its resources.

Returns: void