Table of Contents

Namespace MoonBark.GridPlacement.Core.Domain.State

Classes

Owner

Component that assigns an entity as the active owner on a user state resource.

This node can automatically or manually designate an OwnerRoot (such as a CharacterBody2D, NPC, or other) as the active entity within the system, enabling participation in grid-based logic.

Ported from: godot/addons/grid_building/core/contexts/gb_owner.gd

OwnerContext

Default implementation of IOwnerContext that manages the active owner for a grid building session.

ARCHITECTURAL RATIONALE: This class replaces the legacy GBOwner Godot node with a pure domain-layer implementation.

WHY THIS ARCHITECTURE:

  1. Separation of Concerns: Ownership is a domain concept, not a presentation concern
  2. Testability: Core domain logic can be tested without Godot dependencies
  3. Multiplayer Ready: Supports multiple owners without coupling to cursor nodes
  4. Single Responsibility: OwnerContext manages ownership state, Cursor2D manages cursor positioning

WHAT THIS REPLACES:

  • GBOwner Godot node (presentation layer wrapper)
  • GbOwnerContext resource (Godot-specific implementation)

DESIGN DECISIONS:

  • Owner is stored as IOwner interface, not concrete Godot Node type
  • Supports owner change notification via events
  • Allows owner override control for testing scenarios
  • Provides validation for editor and runtime scenarios

Interfaces

IOwner

Interface for Owner - allows mocking in tests and decouples from Godot Node types.

The owner represents an entity (player, AI, NPC) that owns a grid building context.

IOwnerContext

Interface for owner context - allows mocking in tests

IOwnerNotifiable

Extended interface for Owner with change notification.