Fix custom module support loading code

This commit is contained in:
JeremyStar™ 2024-03-22 21:41:27 +01:00
parent 50b00a8e67
commit 5d9b6fa028

View file

@ -175,6 +175,8 @@ func register_custom_module(module_name: String, module_class: CoreBaseModule) -
logger.errorf("Core", "Registering module failed: A custom module with the name \"" + module_name + "\" already exists.") logger.errorf("Core", "Registering module failed: A custom module with the name \"" + module_name + "\" already exists.")
return false return false
module_class.name = module_name module_class.name = module_name
logger.diagf("Core", "Updating variables")
module_class.core = self
logger.diagf("Core", "Adding module to SceneTree") logger.diagf("Core", "Adding module to SceneTree")
custom_modules_node.add_child(module_class) custom_modules_node.add_child(module_class)
logger.diagf("Core", "Merging module with custom_modules") logger.diagf("Core", "Merging module with custom_modules")
@ -201,7 +203,7 @@ func get_custom_module(module_name: String) -> CoreBaseModule:
logger.diagf("Core", "Getting custom module \"" + module_name + "\"") logger.diagf("Core", "Getting custom module \"" + module_name + "\"")
if !custom_modules.has(module_name): if !custom_modules.has(module_name):
logger.errorf("Core", "Getting module failed: A custom module with the name \"" + module_name + "\" does not exist.") logger.errorf("Core", "Getting module failed: A custom module with the name \"" + module_name + "\" does not exist.")
return return null
return custom_modules[module_name] return custom_modules[module_name]
# (Re-)Load configuration # (Re-)Load configuration