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. Callrun_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
Gets the scoped root nodes for injection
validate_runtime
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(); callrun_validation()or call into the container from host code after the composition container has been injected andGBLevelContext/GBOwnerare available.
run_validation
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
get_runtime_issues
create_with_injection
Flags: static
Creates a GBInjectorSystem with dependency injection from container.
resolve_gb_dependencies
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
Injects dependencies into a single node (not recursive). Also connects signals to monitor future children and node exiting.
inject_recursive
Injects dependencies into the node and all its children recursively. Used only on startup to cover existing tree nodes.
set_injection_meta
Sets the meta data on the object following a successful injection.
remove_injection_meta
Removes the injection meta data from the object.
Private Methods
_init
Flags: private
_ready
Flags: private
_initialize
Flags: private
_inject_existing
Flags: private
_on_node_added_to_scope
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
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
Flags: private
Handler for node exiting tree to clean up signal connections
_connect_child_entered_tree
Flags: private
Private helper: Connect child_entered_tree signal if not already connected.
_disconnect_child_entered_tree
Flags: private
Private helper: Disconnect child_entered_tree signal if connected.
_connect_tree_exiting
Flags: private
Private helper: Connect tree_exiting signal if not already connected.
_disconnect_tree_exiting
Flags: private
Private helper: Disconnect tree_exiting signal if connected.
_connect_scene_tree_node_added
Flags: private
_on_scene_tree_node_added
Flags: private
_validate_after_injection
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
Flags: private
Private helper: Report warnings through direct print or push_warning.