Make unitbase.gd more verbose

This commit is contained in:
JeremyStar™ 2024-04-06 13:13:27 +02:00
parent baf98e0329
commit 0ee7198845
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -29,6 +29,8 @@ func after_each() -> void:
# Framework management
func load_framework(config: CoreConfiguration = CoreConfiguration.new()) -> void:
if is_framework_loaded(): await unload_framework()
ldiag("Loading framework")
core = Core.new(config)
get_tree().root.add_child(core)
await get_tree().process_frame
@ -36,12 +38,16 @@ func load_framework(config: CoreConfiguration = CoreConfiguration.new()) -> void
func unload_framework() -> void:
if is_framework_loaded():
ldiag("Unloading framework")
await core.cleanup()
get_tree().root.remove_child.call_deferred(core)
core = null
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
# 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