Make unitbase.gd more verbose
This commit is contained in:
parent
baf98e0329
commit
0ee7198845
1 changed files with 7 additions and 1 deletions
|
@ -29,6 +29,8 @@ func after_each() -> void:
|
||||||
|
|
||||||
# Framework management
|
# Framework management
|
||||||
func load_framework(config: CoreConfiguration = CoreConfiguration.new()) -> void:
|
func load_framework(config: CoreConfiguration = CoreConfiguration.new()) -> void:
|
||||||
|
if is_framework_loaded(): await unload_framework()
|
||||||
|
ldiag("Loading framework")
|
||||||
core = Core.new(config)
|
core = Core.new(config)
|
||||||
get_tree().root.add_child(core)
|
get_tree().root.add_child(core)
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
|
@ -36,12 +38,16 @@ func load_framework(config: CoreConfiguration = CoreConfiguration.new()) -> void
|
||||||
|
|
||||||
func unload_framework() -> void:
|
func unload_framework() -> void:
|
||||||
if is_framework_loaded():
|
if is_framework_loaded():
|
||||||
|
ldiag("Unloading framework")
|
||||||
await core.cleanup()
|
await core.cleanup()
|
||||||
get_tree().root.remove_child.call_deferred(core)
|
get_tree().root.remove_child.call_deferred(core)
|
||||||
core = null
|
core = null
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
|
else: lcrash("Can't unload framework: Framework is not loaded")
|
||||||
|
|
||||||
func is_framework_loaded() -> bool: return get_node_or_null("/root/CORE") != null
|
func is_framework_loaded() -> bool: return get_node_or_null("/root/CORE") != null
|
||||||
|
|
||||||
# Helper functions
|
# Helper functions
|
||||||
func wait_process_time() -> void: await get_tree().create_timer(0.1).timeout
|
func wait_process_time() -> void:
|
||||||
|
ldiag("Waiting process time")
|
||||||
|
await get_tree().create_timer(0.1).timeout
|
||||||
|
|
Loading…
Reference in a new issue