SUI/godot/Init.gd

37 lines
1.4 KiB
GDScript

# STAROPENSOURCE UI SOURCE FILE
# Copyright (c) 2024 The StarOpenSource Project & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
extends Node
var core: Core
var core_config: CoreConfiguration = CoreConfiguration.new()
@onready var logger: CoreLoggerInstance = core.logger.get_instance("Init.gd", self)
@onready var sms: CoreBaseModule = core.sms
func _init() -> void:
core_config.logger_level = CoreTypes.LoggerLevel.DIAG
core = await Core.new(core_config)
func _ready() -> void:
await get_tree().process_frame
get_tree().root.add_child(core)
await core.complete_init()
logger.info("Loading Test.tscn into SceneTree")
sms.add_scene("test", ResourceLoader.load("res://Test.tscn").instantiate(), CoreTypes.SceneType.MAIN)
logger.info("Freeing")
queue_free()