Skip to content

Commit

Permalink
Add facade methods in escoria.gd
Browse files Browse the repository at this point in the history
  • Loading branch information
StraToN committed Oct 7, 2024
1 parent a81eaaa commit a23f097
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
5 changes: 3 additions & 2 deletions addons/escoria-core/game/escoria.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions addons/escoria-core/game/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit a23f097

Please sign in to comment.