2023-03-18 16:34:12 +01:00
|
|
|
# coreloader.gd
|
|
|
|
# CORE Loader
|
|
|
|
#
|
|
|
|
# This file is part of StarOpenSource CORE (SOSCORE)
|
|
|
|
# Made by the StarOpenSource Project and Contributers
|
|
|
|
# Licensed under GNU GPLv3
|
|
|
|
extends Node
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
await get_tree().create_timer(1.5).timeout
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Starting initialization")
|
|
|
|
Logger.diag("coreloader","Loading configuration file")
|
2023-03-18 16:34:12 +01:00
|
|
|
var scr_config = ResourceLoader.load("res://CORE/config.gd")
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Preloading core scripts")
|
2023-03-18 16:34:12 +01:00
|
|
|
var scr_core = ResourceLoader.load("res://CORE/core.gd")
|
|
|
|
var scr_wmgr = ResourceLoader.load("res://CORE/wmgr.gd")
|
|
|
|
var scr_smgr = ResourceLoader.load("res://CORE/smgr.gd")
|
2023-05-29 20:46:47 +02:00
|
|
|
var scr_resmgr = ResourceLoader.load("res://CORE/resmgr.gd")
|
|
|
|
var scr_events = ResourceLoader.load("res://CORE/events.gd")
|
2023-06-29 17:22:13 +02:00
|
|
|
var scr_splash = ResourceLoader.load("res://CORE/splash.tscn").instantiate()
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Constructing CORE")
|
2023-03-18 16:34:12 +01:00
|
|
|
var core = Control.new()
|
|
|
|
core.name = "core"
|
|
|
|
core.script = scr_core
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Attaching CORE to /root/")
|
2023-03-18 16:34:12 +01:00
|
|
|
get_tree().root.add_child(core)
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Attaching configuration file to CORE")
|
2023-03-18 16:34:12 +01:00
|
|
|
core.attach("config",scr_config)
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Attaching wmgr to CORE")
|
2023-03-18 16:34:12 +01:00
|
|
|
core.attach("wmgr",scr_wmgr)
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Attaching smgr to CORE")
|
2023-03-18 16:34:12 +01:00
|
|
|
core.attach("smgr",scr_smgr)
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Attaching resmgr to CORE")
|
2023-05-29 20:46:47 +02:00
|
|
|
core.attach("resmgr",scr_resmgr)
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Attaching events to CORE")
|
2023-05-29 20:46:47 +02:00
|
|
|
core.attach("events",scr_events)
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Attaching splash to CORE")
|
2023-06-29 17:22:13 +02:00
|
|
|
core.attach("splash",scr_splash,false)
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Locking CORE")
|
2023-03-18 16:34:12 +01:00
|
|
|
core.lock()
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Waiting for CORE to fully initialize")
|
2023-05-29 20:46:47 +02:00
|
|
|
while !core.readylized:
|
|
|
|
await get_tree().create_timer(1).timeout
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","CORE has been initialized and is ready.")
|
|
|
|
Logger.diag("coreloader","Preloading project init script")
|
2023-03-18 16:34:12 +01:00
|
|
|
var initscr = ResourceLoader.load(core.config.core_startscript)
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Constructing project init script")
|
2023-03-18 16:34:12 +01:00
|
|
|
var initscr_obj = Control.new()
|
|
|
|
initscr_obj.name = "ProjectInitScript"
|
|
|
|
initscr_obj.set_script(initscr)
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Adding project init script to /root/")
|
2023-03-18 16:34:12 +01:00
|
|
|
get_tree().root.add_child(initscr_obj)
|
2023-07-07 10:58:49 +02:00
|
|
|
Logger.diag("coreloader","Removing coreloader")
|
2023-03-19 13:14:30 +01:00
|
|
|
queue_free()
|