Fix: disable ESCGame inputs until signal room_ready is emitted (#582)

* Fix: disable ESCGame inputs until signal room_ready is emitted
* fix: add a new function to use in _input() to check for inputs

* Apply suggestions from code review
Co-authored-by: balloonpopper <5151242+balloonpopper@users.noreply.github.com>
Co-authored-by: Duncan Brown <duncan@prometheussoftware.ca>
This commit is contained in:
Julian Murgia
2022-04-30 20:10:14 +02:00
committed by GitHub
parent 0414833c6d
commit 8a58aa7efc
4 changed files with 32 additions and 5 deletions

View File

@@ -389,3 +389,14 @@ func _handle_direct_scene_run() -> void:
if current_scene_root is ESCRoom:
escoria.object_manager.set_current_room(current_scene_root)
# Used by game.gd to determine whether the game scene is ready to take inputs
# from the _input() function. To do so, the current_scene must be set, the game
# scene must be set, and the game scene must've been notified that the room
# is ready.
#
# *Returns*
# true if game scene is ready for inputs
func is_ready_for_inputs() -> bool:
return escoria.main.current_scene and escoria.main.current_scene.game \
and escoria.main.current_scene.game.room_ready_for_inputs