Chris' Tutorials
Docs/Grid Placement

Class

PlacementInjectorSystem

Generated GDScript class reference for GridPlacement.PlacementInjectorSystem.

StatusDraft
Versionv6.0
UpdatedDevelopment docs generated from GDScript source

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

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.

Dependency injection system for the Grid Building Plugin. This system automatically handles: 1. Dependency Injection: Wires the PlacementContainer into all nodes that implement resolve_placement_dependencies(p_config: PlacementContainer) 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 container, the session, or runtime logic [b]Setup Requirements:[/b]
  • Assign a PlacementContainer 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_config: PlacementContainer) -> void: _composition_container = p_config _logger = p_config.get_logger() # No validation call needed
  • injector handles it automatically ``` [i]Nodes that implement resolve_placement_dependencies(p_config: PlacementContainer) 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_completedEventEmits when the initial scene injection is completed
node_injectedEventEmit whenever a node is injected
host_configuredEventEmitted 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.
sessionPropertyOptional [PlacementSession] — when set, the injector creates a minimal [PlacementContainer] that delegates through the session. This is the preferred path for code-built/explicit setups. 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).
composition_containerProperty@deprecated Backward-compat wrapper built automatically from [member session] in [method _ready]. During the 6.0 deprecation window, consumer nodes that implement [code]resolve_placement_dependencies(p_config: PlacementContainer)[/code] still receive this wrapper. New code should use [member session] directly.
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
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
rootsProperty
validate_runtimeMethod
issuesProperty
session_issuesProperty
run_validationMethod
okProperty
get_editor_issuesMethod
issuesProperty
get_runtime_issuesMethod
issuesProperty
was_injectedProperty
messageProperty
is_scopedMethod
create_with_injectionMethod
systemProperty
from_sessionMethod
injectorProperty
from_session_scopedMethod
injectorProperty
set_session_scopeMethod
catalog_pathProperty
n_issuesProperty
resolve_placement_dependenciesMethod
rule_countProperty
inject_nodeMethod
existingProperty
inject_recursiveMethod
set_injection_metaMethod
metaProperty
remove_injection_metaMethod
node_pathProperty
msgProperty
bound_cbProperty
existing_cbProperty
bound_cbProperty
bound_exit_cbProperty
metaProperty
metaProperty
bound_exit_cbProperty
treeProperty
issuesProperty
host_sessionProperty
hostProperty
rootsProperty
placement_systemProperty
find_placement_systemMethod
psProperty

Source

addons/grid_placement/systems/injection/placement_injector_system.gd

Plugin docs root:gdscript/plugins/grid_placement_dev/docs