39 lines
876 B
GDScript
39 lines
876 B
GDScript
# core.gd
|
|
# CORE Holder
|
|
#
|
|
# This file is part of StarOpenSource CORE (SOSCORE)
|
|
# Made by the StarOpenSource Project and Contributers
|
|
# Licensed under GNU GPLv3
|
|
extends Node
|
|
|
|
var locked = false
|
|
var config = null
|
|
var wmgr = null
|
|
var smgr = null
|
|
|
|
func attach(type:String,component:Script) -> void:
|
|
if locked:
|
|
return
|
|
Logger.diag("core","Attaching " + type + " to CORE")
|
|
var comp = Control.new()
|
|
comp.name = type
|
|
comp.set_script(component)
|
|
match(type):
|
|
"config":
|
|
add_child(comp)
|
|
config = comp
|
|
"wmgr":
|
|
add_child(comp)
|
|
wmgr = comp
|
|
"smgr":
|
|
add_child(comp)
|
|
smgr = comp
|
|
_:
|
|
Logger.error("core","Failed attaching " + type + " to CORE: Invalid component")
|
|
comp.free()
|
|
return
|
|
Logger.diag("core","Attached " + type + " successfully")
|
|
|
|
func lock() -> void:
|
|
locked = true
|
|
Logger.diag("core","CORE is now locked. No new attachments can be made.")
|