fix: handles the case where no coroutines are run as part of room creation; also fixes a small bug in ESCCamera

This commit is contained in:
Duncan Brown
2022-04-02 15:02:27 -04:00
committed by Julian Murgia
parent 503d6134dd
commit 85b86f38be
3 changed files with 31 additions and 1 deletions

View File

@@ -54,12 +54,30 @@ func set_scene(p_scene: Node) -> void:
escoria.object_manager.set_current_room(p_scene)
add_child(p_scene)
# In cases where the room being created doesn't return because of a
# coroutine, finish_current_scene_init() will already have been called
# and so we don't want to risk repeating ourselves.
if p_scene == current_scene:
return
# This actually moves the scene closest to the root node, but will
# still be drawn behind the next node, which should be the previous
# room.
move_child(p_scene, 0)
current_scene = p_scene
check_game_scene_methods()
set_camera_limits()
# Only called by the room manager in the case where it hasn't executed a
# coroutine prior to calling set_scene_finish().
func finish_current_scene_init(p_scene: Node) -> void:
move_child(p_scene, 0)
current_scene = p_scene
check_game_scene_methods()