Skip to content
ct

Class

PlacementInjectorSystem

Generated GDScript class reference for GridPlacement.PlacementInjectorSystem.

Status
Draft
Version
v6.0
Updated
Development docs generated from GDScript source

This is unreleased documentation in active development. APIs, class names, and behavior may change before the final release.

Dependency injection system for the Grid Building Plugin. This system automatically handles: 1. Dependency Injection: Wires the PlacementSession into all nodes that implement resolve_placement_dependencies(p_config: PlacementSession) 2. Automatic Validation: Validates the complete setup after injection and reports any configuration issues via the container's logger No manual validation calls are required

  • the injector handles everything automatically after dependency injection is complete. [b]Modes[/b] [b]Global mode[/b] (default, no [code]scope_root[/code]): injects the entire scene tree. Connects to [code]tree.node_added[/code] to catch dynamically added nodes. Falls back to [code][tree.root][/code] when [code]injection_roots[/code] is empty. Session auto-registration with the host is enabled by default. [b]Scoped mode[/b] ([code]scope_root[/code] set via [code]set_session_scope()[/code]): injects only the subtree under [code]scope_root[/code]. Does NOT connect to the global [code]node_added[/code] signal. The controller/bootstrap is responsible for explicitly registering the session with the host (see [code]host_created[/code] signal). This is the preferred path for split-screen, per-controller, and explicit code-built setups. [b]Responsibility Boundaries[/b] - [code]PlacementSession[/code]: owns mutable state, config, contexts, logger (SSOT) - [code]GridPlacementHost[/code]: owns stateless runtime services and dispatch - [code]PlacementInjectorSystem[/code]: wires scene-authored nodes around a session subtree; does NOT own the session or runtime logic [b]Setup Requirements:[/b]
  • Assign a PlacementSession resource to this injector
  • Ensure PlacementLevelContext and PlacementOwner are properly configured before the injector runs (usually in _ready() methods)
  • The injector will automatically validate after injection and log any issues Usage Example: ```gdscript # In your scene node: func resolve_placement_dependencies(p_session: PlacementSession) -> void: _session = p_session # No validation call needed
  • injector handles it automatically ``` [i]Nodes that implement resolve_placement_dependencies(p_session: PlacementSession) will be injected automatically by this system.[/i]

Source: addons/grid_placement/systems/injection/placement_injector_system.gd

Syntax

class PlacementInjectorSystem extends PlacementSystemBase

Members

NameKindSummary
initial_injection_completedSignalEmits when the initial scene injection is completed
node_injectedSignalEmit whenever a node is injected
host_configuredSignalEmitted when the injector creates a [GridPlacementHost] host from its session. Controllers in scoped mode should connect to this signal to explicitly register their session with the host.
sessionPropertyThe [PlacementSession] wired to this injector. Consumer nodes receive this session through [code]resolve_placement_dependencies(p_session: PlacementSession)[/code]. 6.0.0-S: when the injector creates a [GridPlacementHost] host, this session is auto-registered with the host's per-controller session registry (single-player convenience; controllers can register additional sessions for split-screen).
injection_rootsPropertyDebug settings for logging and warnings. Note: runtime validation is intentionally NOT auto-run on `_ready()` because other game-level dependencies (Placement level context, PlacementOwner, etc.) may not be fully settled. Call `run_validation()` from your world/initializer script after those dependencies are created and injected. Root nodes for injection. These nodes and any children node added will be injected by the PlacementInjectorSystem. Use this for scoping injection. If left empty, all nodes in the scene tree will be injected.
scope_rootPropertyOptional explicit scope root for session-scoped injection.
auto_register_host_sessionPropertyWhen [code]true[/code] (default), the injector automatically registers its session with the host's per-controller registry as a single-player convenience. Set to [code]false[/code] in scoped mode and connect to the [code]host_configured[/code] signal for explicit controller-owned registration.
INJECTION_META_KEYField
CHILD_ENTERED_LISTENER_META_KEYField
RESOLVE_METHODField
RUNTIME_BIND_METHODField
ORPHAN_MESSAGEFieldLegacy 5.0 name (`resolve_gb_dependencies`) was removed in . Nodes that only implement the 5.0 entry point must rename to `resolve_placement_dependencies`. See the migration guide.
get_injection_rootsMethod
validate_runtimeMethod
run_validationMethod
get_editor_issuesMethod
get_runtime_issuesMethod
is_scopedMethod
from_sessionMethod
from_session_scopedMethod
set_session_scopeMethod
collect_startup_diagnosticsMethod
report_startup_diagnosticsMethod
resolve_placement_dependenciesMethod
inject_nodeMethod
inject_recursiveMethod
set_injection_metaMethod
remove_injection_metaMethod