Ensure player is set at start location if there is one (#435)

This is done even if there is no ESC script attached to the room.
First default position will then be the start ESCLocation if there is one.
Else, fallback to origin (0,0).
This commit is contained in:
Julian Murgia
2021-11-12 22:57:44 +01:00
committed by GitHub
parent e9fc3a030e
commit bbe885edc2
9 changed files with 192 additions and 19 deletions

View File

@@ -40,10 +40,11 @@ func set_scene(p_scene: Node) -> void:
if current_scene != null:
clear_scene()
if not p_scene.is_inside_tree() or not p_scene in get_children():
add_child(p_scene)
elif p_scene in get_children():
move_child(p_scene, 0)
if p_scene.is_inside_tree() and not p_scene.get_parent() != self:
p_scene.get_parent().remove_child(p_scene)
add_child(p_scene)
move_child(p_scene, 0)
current_scene = p_scene
check_game_scene_methods()