GdlrModuleGraph¶
Inherits: RefCounted < Object
Compiles a module tree and runs its lifecycle.
Description¶
GdlrModuleManager creates and drives the graph for you. Use the graph directly when you need more than one graph, for example in tests:
var graph := GdlrModuleGraph.new(GameModule)
await graph.compile().await_resolved()
await graph.start().await_resolved()
var score: CapScore = graph.request(CapScore)
See GdlrModule for the lifecycle that the graph runs.
Tutorials¶
Methods¶
void |
|
compile() |
|
start() |
|
get_init_dependencies(ObjectScript: GDScript) |
|
void |
register_debug_plugin(plugin_name: String, plugin: GdlrModuleGraph.DebugPlugin) |
Constants¶
DEFAULT_MODULE_ENABLE_TIMEOUT_S = 90.0 🔗
Seconds that one GdlrModule.enable() call can take. After this time start() reports an error and triggers an assertion in debug builds. If execution continues, Godular moves to the next module.
Method Descriptions¶
void _init(root_module: Variant) 🔗
Creates a graph. root_module is a module script or a GdlrModuleDefinition.
GdbPromise compile() 🔗
Resolves every module definition from the root module, checks the tree exports, and builds one dependency container per module. Call it before start().
GdbPromise start() 🔗
Creates every module, injects dependencies, calls GdlrModule.register(), resolves every tree export, and then calls GdlrModule.enable() in dependency order. The promise resolves after the last GdlrModule.enable() call returns.
Dictionary get_module_definitions() 🔗
Returns the compiled module definitions keyed by module script. Available after compile().
Variant request(capability: Variant, _consumer_node: Node = null) 🔗
Returns the value of a tree export. Call it after start(). Before that, the export is not resolved and the method returns null. Outside the editor it also reports an error. _consumer_node only names the requester in error messages.
Dictionary get_init_dependencies(ObjectScript: GDScript) 🔗
Returns the dependencies that ObjectScript declares, as a dictionary from property name to token. It reads typed properties whose type extends GdlrCapability and the entries of a static INJECT array. See GdlrModule.
void register_debug_plugin(plugin_name: String, plugin: GdlrModuleGraph.DebugPlugin) 🔗
Registers plugin under plugin_name. A later call with the same name replaces the plugin and reports a warning.
Dictionary[String, GdlrModuleGraph.DebugPlugin] get_debug_plugins() 🔗
Returns the registered debug plugins keyed by name.