Fix: makes dialog players pausable by removing yields (#472)
This commit is contained in:
@@ -5,6 +5,12 @@ extends Node
|
||||
# Signal sent when pause menu has to be displayed
|
||||
signal request_pause_menu
|
||||
|
||||
# Signal sent when Escoria is paused
|
||||
signal paused
|
||||
|
||||
# Signal sent when Escoria is resumed from pause
|
||||
signal resumed
|
||||
|
||||
|
||||
# Escoria version number
|
||||
const ESCORIA_VERSION = "0.1.0"
|
||||
@@ -317,6 +323,10 @@ func _input(event):
|
||||
# #### Parameters
|
||||
# - p_paused: if true, pauses the game. If false, unpauses the game.
|
||||
func set_game_paused(p_paused: bool):
|
||||
if p_paused:
|
||||
emit_signal("paused")
|
||||
else:
|
||||
emit_signal("resumed")
|
||||
get_tree().paused = p_paused
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ func _ready():
|
||||
# - event: The input event
|
||||
func _input(event):
|
||||
if event is InputEventMouseButton and event.pressed \
|
||||
and is_speaking:
|
||||
and is_speaking and not _dialog_manager.get_type_player().is_paused:
|
||||
speedup()
|
||||
get_tree().set_input_as_handled()
|
||||
|
||||
@@ -108,6 +108,9 @@ func say(character: String, type: String, text: String) -> void:
|
||||
"No dialog manager supports the type %s" % type
|
||||
]
|
||||
)
|
||||
|
||||
_dialog_manager.connect("say_finished", self, "_on_say_finished", [], CONNECT_ONESHOT)
|
||||
|
||||
var matches = _keytext_regex.search(text)
|
||||
if not matches:
|
||||
escoria.logger.report_errors(
|
||||
@@ -130,11 +133,14 @@ func say(character: String, type: String, text: String) -> void:
|
||||
else:
|
||||
text = matches.get_string("text")
|
||||
|
||||
_dialog_manager.say(self, character, text, type)
|
||||
yield(_dialog_manager, "say_finished")
|
||||
_dialog_manager.say(self, character, text, type)
|
||||
|
||||
|
||||
# Handles the end of a say function after it has emitted say_finished.
|
||||
func _on_say_finished():
|
||||
is_speaking = false
|
||||
emit_signal("say_finished")
|
||||
|
||||
|
||||
|
||||
# Called when a dialog line is skipped
|
||||
func speedup() -> void:
|
||||
|
||||
@@ -51,6 +51,7 @@ func set_state(p_state: String, p_force: bool = false) -> void:
|
||||
|
||||
# Register to the object registry
|
||||
func _ready():
|
||||
pause_mode = Node.PAUSE_MODE_STOP
|
||||
escoria.object_manager.register_object(
|
||||
ESCObject.new(global_id, self),
|
||||
true
|
||||
|
||||
@@ -50,6 +50,7 @@ func set_state(p_state: String, p_force: bool = false):
|
||||
|
||||
# Register to the object registry
|
||||
func _ready():
|
||||
pause_mode = Node.PAUSE_MODE_STOP
|
||||
escoria.object_manager.register_object(
|
||||
ESCObject.new(global_id, self),
|
||||
true
|
||||
|
||||
@@ -34,6 +34,7 @@ func set_state(p_state: String, p_force: bool = false) -> void:
|
||||
|
||||
# Register to the object registry
|
||||
func _ready():
|
||||
pause_mode = Node.PAUSE_MODE_STOP
|
||||
escoria.object_manager.register_object(
|
||||
ESCObject.new(global_id, self),
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user