2023-03-18 18:02:07 +01:00
|
|
|
# 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
|
|
|
|
|
2023-05-29 20:46:47 +02:00
|
|
|
@onready
|
|
|
|
var core = get_node(NodePath("/root/core"))
|
|
|
|
|
2023-03-18 18:02:07 +01:00
|
|
|
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
|
2023-05-29 20:46:47 +02:00
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
core.setready()
|