26 lines
776 B
GDScript3
26 lines
776 B
GDScript3
|
# autoload.gd
|
||
|
# CORE Autoloader
|
||
|
#
|
||
|
# This file is part of StarOpenSource CORE (SOSCORE)
|
||
|
# Made by the StarOpenSource Project and Contributers
|
||
|
# Licensed under GNU GPLv3
|
||
|
extends Node
|
||
|
|
||
|
func singleton(singleton_name:String,singleton_path:String) -> void:
|
||
|
var node = Control.new()
|
||
|
node.name = singleton_name
|
||
|
node.set_script(ResourceLoader.load(singleton_path))
|
||
|
get_tree().root.add_child(node)
|
||
|
|
||
|
func preset(plugin_id:String) -> bool:
|
||
|
var node = Control.new()
|
||
|
match(plugin_id):
|
||
|
"dialogmgr":
|
||
|
node.name = "DialogueManager"
|
||
|
node.set_script(ResourceLoader.load("res://addons/dialogue_manager/dialogue_manager.gd"))
|
||
|
_:
|
||
|
Logger.error("autoload","Failed adding preset \"" + plugin_id + "\": Invalid preset.")
|
||
|
return false
|
||
|
get_tree().root.add_child(node)
|
||
|
return true
|