From a23f0971dbd4c4c5e1dd484f74f8b542beb0ce78 Mon Sep 17 00:00:00 2001 From: Julian Murgia Date: Mon, 7 Oct 2024 23:05:02 +0200 Subject: [PATCH] Add facade methods in escoria.gd --- addons/escoria-core/game/escoria.gd | 5 +++-- addons/escoria-core/game/main.gd | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/addons/escoria-core/game/escoria.gd b/addons/escoria-core/game/escoria.gd index 0a4d954fe..e9afc9056 100644 --- a/addons/escoria-core/game/escoria.gd +++ b/addons/escoria-core/game/escoria.gd @@ -200,8 +200,9 @@ func quit(): # Handle anything necessary if the game started a scene directly. func _handle_direct_scene_run() -> void: - if escoria.is_direct_room_run: - escoria.object_manager.set_current_room(get_tree().get_current_scene()) + var current_scene: Node = get_tree().get_current_scene() + if escoria.is_direct_room_run and current_scene is ESCRoom: + escoria.object_manager.set_current_room(current_scene) # Used by game.gd to determine whether the game scene is ready to take inputs diff --git a/addons/escoria-core/game/main.gd b/addons/escoria-core/game/main.gd index af4826e3b..8a36ddb82 100644 --- a/addons/escoria-core/game/main.gd +++ b/addons/escoria-core/game/main.gd @@ -263,3 +263,21 @@ func _disable_collisions() -> void: item.monitoring = false item.monitorable = false +####################################################################"" +# Facades for current_scene + +func hide_ui() -> void: + if escoria.main.current_scene != null: + escoria.main.current_scene.game.hide_ui() + +func hide_current_scene() -> void: + if escoria.main.current_scene != null: + escoria.main.current_scene.hide() + +func show_ui() -> void: + if escoria.main.current_scene != null: + escoria.main.current_scene.game.show_ui() + +func show_current_scene() -> void: + if escoria.main.current_scene != null: + escoria.main.current_scene.show()