From 78b85fca1b85f89444bb6f973e5ff4320fb057fe Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Fri, 17 May 2024 01:50:07 +0200 Subject: [PATCH] Fix errors --- src/classes/communication.gd | 3 +++ src/presenloader.gd | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/classes/communication.gd b/src/classes/communication.gd index 7cfb94a..9cc6a01 100644 --- a/src/classes/communication.gd +++ b/src/classes/communication.gd @@ -52,6 +52,9 @@ func _process(_delta: float) -> void: switch_slide(current_slide + 1) if Input.is_action_just_pressed("navigate_backwards"): switch_slide(current_slide - 1) + +func _update_variables() -> void: + logger.diag("Updating variables") entrypoint = presenloader.entrypoint_node manifest = presenloader.manifest diff --git a/src/presenloader.gd b/src/presenloader.gd index 7707a19..9bdaee7 100644 --- a/src/presenloader.gd +++ b/src/presenloader.gd @@ -37,6 +37,9 @@ var diraccess: DirAccess = null func _ready() -> void: # Register cleanup hook core.register_cleanup_hook(func() -> void: queue_free()) + + # Add 'communication' as a child + add_child(communication) func load_presentation(load_path: String) -> String: logger.info(core.misc.stringify_variables("Loading presentation located at %path%", { "path": load_path })) @@ -90,6 +93,9 @@ func load_presentation(load_path: String) -> String: # Inject entrypoint inject_entrypoint() + # Update 'communication''s variables + communication._update_variables() + return "" func check_required_files() -> String: @@ -233,10 +239,10 @@ func inject_entrypoint() -> void: entrypoint_node.api = communication # Add to SceneTree - get_tree().root.add_child(entrypoint_node) + get_tree().root.add_child.call_deferred(entrypoint_node) # Execute initialize() - await entrypoint_node.initialize() + entrypoint_node.initialize.call_deferred() # +++ etc +++ func write_temporary_file(bytes: PackedByteArray) -> void: