diff --git a/addons/escoria-core/game/core-scripts/esc_game.gd b/addons/escoria-core/game/core-scripts/esc_game.gd index ea51bef6a..b3c0a766b 100644 --- a/addons/escoria-core/game/core-scripts/esc_game.gd +++ b/addons/escoria-core/game/core-scripts/esc_game.gd @@ -8,6 +8,9 @@ class_name ESCGame # Emitted when the user has confirmed the crash popup signal crash_popup_confirmed +# Signal sent when pause menu has to be displayed +signal request_pause_menu + # Editor debug modes # NONE - No debugging @@ -469,3 +472,14 @@ func escoria_show_ui(): # Manage signal room_deady from main.gd. func _on_room_ready(): room_ready_for_inputs = true + + +# Input function to manage specific input keys. +# Note that if any child of this class wishes to override _input, the overriding +# method MUST call its parent's version (i.e. this method). +func _input(event): + if escoria.inputs_manager.input_mode == escoria.inputs_manager.INPUT_NONE: + return + + if event.is_action_pressed("ui_cancel"): + emit_signal("request_pause_menu") diff --git a/addons/escoria-core/game/escoria.gd b/addons/escoria-core/game/escoria.gd index 37e9cc06f..16a4fb2d9 100644 --- a/addons/escoria-core/game/escoria.gd +++ b/addons/escoria-core/game/escoria.gd @@ -3,8 +3,6 @@ tool extends Node class_name Escoria -# Signal sent when pause menu has to be displayed -signal request_pause_menu # Signal sent when Escoria is paused signal paused @@ -223,9 +221,6 @@ func _input(event): and event.is_action_pressed(ESCInputsManager.ESC_SHOW_DEBUG_PROMPT): escoria.main.get_node("layers/debug_layer/esc_prompt_popup").popup() - if event.is_action_pressed("ui_cancel"): - emit_signal("request_pause_menu") - # Pauses or unpause the game # diff --git a/addons/escoria-core/game/inputs_manager.gd b/addons/escoria-core/game/inputs_manager.gd index 56d8cc618..573df4717 100644 --- a/addons/escoria-core/game/inputs_manager.gd +++ b/addons/escoria-core/game/inputs_manager.gd @@ -50,7 +50,7 @@ var custom_input_handler = null # Register core signals (from escoria.gd) func register_core(): - escoria.connect( + escoria.game_scene.connect( "request_pause_menu", self, "_on_pause_menu_requested" diff --git a/addons/escoria-ui-9verbs/game.gd b/addons/escoria-ui-9verbs/game.gd index 64544b9a2..b900017ac 100644 --- a/addons/escoria-ui-9verbs/game.gd +++ b/addons/escoria-ui-9verbs/game.gd @@ -336,7 +336,7 @@ func unpause_game(): escoria.set_game_paused(false) func pause_game(): - if not get_node(pause_menu).visible: + if not get_node(pause_menu).visible and not get_node(main_menu).visible: get_node(pause_menu).reset() get_node(pause_menu).set_save_enabled(escoria.save_manager.save_enabled) get_node(pause_menu).show() diff --git a/game/rooms/intro/esc/intro.esc b/game/rooms/intro/esc/intro.esc index 0eb759981..5ebf3c680 100644 --- a/game/rooms/intro/esc/intro.esc +++ b/game/rooms/intro/esc/intro.esc @@ -2,6 +2,12 @@ anim_block intro_animation_player RESET :ready | NO_UI +# Until we have a proper way to skip animations/cutscenes, we want to prevent +# something silly like being able to pause during the intro. +accept_input NONE + anim_block intro_animation_player intro +accept_input ALL + show_menu main