Skip to content

Commit

Permalink
fix: avoids being able to pause during transitions; also moves pausin…
Browse files Browse the repository at this point in the history
…g request responsibility to UI; also fixes issue w/ trying to pause during intro and main menu
  • Loading branch information
BHSDuncan authored and StraToN committed May 11, 2022
1 parent ff17854 commit aeffe09
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
14 changes: 14 additions & 0 deletions addons/escoria-core/game/core-scripts/esc_game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
5 changes: 0 additions & 5 deletions addons/escoria-core/game/escoria.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
#
Expand Down
2 changes: 1 addition & 1 deletion addons/escoria-core/game/inputs_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion addons/escoria-ui-9verbs/game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions game/rooms/intro/esc/intro.esc
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit aeffe09

Please sign in to comment.