GBInjectorSystem

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Dependency injection system for the Grid Building Plugin.

Source File: addons/grid_building/systems/injection/gb_injector_system.gd

Extends: GBSystem

Signals

  • Signal: initial_injection_completed() - Emits when the initial scene injection is completed
  • Signal: node_injected(node : Node) - Emit whenever a node is injected

Exported Properties

  • Property: composition_container : [GBCompositionContainer](./gb-composition-container/)

    Container services as the single source of truth for settings within it’s scope for systems and other nodes concerned with grid building operations.

    Dependencies are injected out of this container by the GBInjectorSystem

  • Property: injection_roots : Array[Node] = []

    Debug settings for logging and warnings. Note: runtime validation is intentionally NOT auto-run on _ready() because other game-level dependencies (GB level context, GBOwner, 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 GBInjectorSystem. Use this for scoping injection. If left empty, all nodes in the scene tree will be injected.

Private Properties

  • Property: _debug : [GBDebugSettings](./gb-debug-settings/) (private) - Debug settings for logging and warnings.
  • Property: _logger : [GBLogger](./gb-logger/) (private)
  • Property: _initialized : bool = false (private)
  • Property: _scene_node_added_connected : bool = false (private)
  • Property: _initial_injection_count : int = 0 (private)

Constants

  • Constant: INJECTION_META_KEY : String = "gb_injection_meta"
  • Constant: RESOLVE_METHOD : StringName = "resolve_gb_dependencies"
  • Constant: ORPHAN_MESSAGE : String = "[ORPHANED NODE]"

Public Methods

get_injection_roots

1
get_injection_roots() -> Array[Node]

Gets the scoped root nodes for injection


validate_runtime

1
validate_runtime() -> bool

Validates the runtime level setup for the grid building system.

Notes:

  • The authoritative validation is performed by composition_container.get_runtime_issues(); this method aggregates container-level issues and any injector-specific checks.
  • This function does NOT auto-run during _ready(); call run_validation() or call into the container from host code after the composition container has been injected and GBLevelContext / GBOwner are available.

run_validation

1
run_validation() -> bool

Public helper: run validation and return boolean result. Logs issues using the container logger. Public helper: run validation and return boolean result. Logs issues using the container logger. Prefer calling composition_container.get_runtime_issues() directly from host scripts when you want to inspect the issue list without logging side-effects.


get_editor_issues

1
get_editor_issues() -> Array[String]

get_runtime_issues

1
get_runtime_issues() -> Array[String]

create_with_injection

1
2
3
4
create_with_injection(
    p_parent : Node,
    container: GBCompositionContainer
) -> GBInjectorSystem

Flags: static

Creates a GBInjectorSystem with dependency injection from container.


resolve_gb_dependencies

1
resolve_gb_dependencies(p_config : GBCompositionContainer) -> void

Default resolve hook used by the injector when injecting this system into the scene. Host projects may implement their own resolve_gb_dependencies on world or player scripts to capture the container pointer and to run validation. The default implementation here only captures a logger and prints a small diagnostic.


inject_node

1
inject_node(p_node: Node) -> bool

Injects dependencies into a single node (not recursive). Also connects signals to monitor future children and node exiting.


inject_recursive

1
inject_recursive(p_node: Node) -> void

Injects dependencies into the node and all its children recursively. Used only on startup to cover existing tree nodes.


set_injection_meta

1
set_injection_meta(p_node : Node) -> void

Sets the meta data on the object following a successful injection.


remove_injection_meta

1
remove_injection_meta(p_node: Node) -> void

Removes the injection meta data from the object.


Private Methods

_init

1
_init(p_composition_container : GBCompositionContainer = null)

Flags: private


_ready

1
_ready()

Flags: private


_initialize

1
_initialize()

Flags: private


_inject_existing

1
_inject_existing(p_node: Node) -> void

Flags: private


_on_node_added_to_scope

1
2
3
4
_on_node_added_to_scope(
    p_scope: Node,
    p_node : Node
) -> void

Flags: private

Handler for new nodes added to the injection scope. p_scope: The scope node to which the new child belongs. p_node: The newly added child node.


_on_child_entered_tree

1
_on_child_entered_tree(p_node: Node) -> void

Flags: private

Handler for new nodes entering the tree at runtime. Injects only the single node; child nodes will trigger their own injections.


_on_node_exiting_tree

1
_on_node_exiting_tree(p_node: Node) -> void

Flags: private

Handler for node exiting tree to clean up signal connections


_connect_child_entered_tree

1
_connect_child_entered_tree(p_node: Node) -> void

Flags: private

Private helper: Connect child_entered_tree signal if not already connected.


_disconnect_child_entered_tree

1
_disconnect_child_entered_tree(p_node: Node) -> void

Flags: private

Private helper: Disconnect child_entered_tree signal if connected.


_connect_tree_exiting

1
_connect_tree_exiting(p_node: Node) -> void

Flags: private

Private helper: Connect tree_exiting signal if not already connected.


_disconnect_tree_exiting

1
_disconnect_tree_exiting(p_node: Node) -> void

Flags: private

Private helper: Disconnect tree_exiting signal if connected.


_connect_scene_tree_node_added

1
_connect_scene_tree_node_added() -> void

Flags: private


_on_scene_tree_node_added

1
_on_scene_tree_node_added(p_node: Node) -> void

Flags: private


_validate_after_injection

1
_validate_after_injection() -> void

Flags: private

Automatically validates the Grid Building setup after injection completes. This is called deferred after initial_injection_completed to ensure all nodes are properly injected and GBLevelContext/GBOwner are configured.


_report_warning

1
_report_warning(message: String) -> void

Flags: private

Private helper: Report warnings through direct print or push_warning.