-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds 'block_say' command/structure to allow for the reuse of di…
…alog players, which can produce a better visual experience for characters that have speech spanning more than one dialog box
- Loading branch information
Showing
13 changed files
with
252 additions
and
25 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
addons/escoria-core/game/core-scripts/esc/commands/block_say.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# `block_say` | ||
# | ||
# `say` commands used subsequent to using the `block_say` command will reuse the | ||
# dialog box type used by the next `say` command encountered. This reuse will | ||
# continue until a call to `end_block_say` is made. | ||
# | ||
# Using `block_say` more than once prior to calling `end_block_say` has the following | ||
# behaviour: | ||
# | ||
# - If no `say` command has yet been encountered since the first use of `block_say`, | ||
# the result of using this command will be as described above. | ||
# - If a `say` command has been encountered since the first use of `block_say`, | ||
# the dialog box used with that `say` command will continue to be used for subsequent | ||
# `say` commands. Note that the dialog box used with the next `say` command may be | ||
# different than the one currently being reused. | ||
# | ||
# Example: | ||
# `block say` | ||
# `say player "Picture's looking good."` | ||
# `say player "And so am I."` | ||
# `end_block_say` | ||
# | ||
# @ESC | ||
extends ESCBaseCommand | ||
class_name BlockSayCommand | ||
|
||
|
||
# Constructor | ||
func _init() -> void: | ||
pass | ||
|
||
|
||
# Return the descriptor of the arguments of this command | ||
func configure() -> ESCCommandArgumentDescriptor: | ||
return ESCCommandArgumentDescriptor.new(0) | ||
|
||
|
||
# Validate whether the given arguments match the command descriptor | ||
func validate(arguments: Array): | ||
return true | ||
|
||
|
||
# Run the command | ||
func run(command_params: Array) -> int: | ||
escoria.dialog_player.enable_preserve_dialog_box() | ||
return ESCExecution.RC_OK | ||
|
||
|
||
# Function called when the command is interrupted. | ||
func interrupt(): | ||
escoria.logger.debug( | ||
self, | ||
"[%s] interrupt() function not implemented." % get_command_name() | ||
) |
45 changes: 45 additions & 0 deletions
45
addons/escoria-core/game/core-scripts/esc/commands/end_block_say.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# `end_block_say` | ||
# | ||
# `say` commands used subsequent to using the `end_block_say` command will no longer | ||
# reuse the dialog box type used by the previous `say` command(s) encountered. | ||
# | ||
# Using `end_block_say` more than once is safe and idempotent. | ||
# | ||
# Example: | ||
# `block say` | ||
# `say player "Picture's looking good."` | ||
# `say player "And so am I."` | ||
# `end_block_say` | ||
# | ||
# @ESC | ||
extends ESCBaseCommand | ||
class_name EndBlockSayCommand | ||
|
||
|
||
# Constructor | ||
func _init() -> void: | ||
pass | ||
|
||
|
||
# Return the descriptor of the arguments of this command | ||
func configure() -> ESCCommandArgumentDescriptor: | ||
return ESCCommandArgumentDescriptor.new(0) | ||
|
||
|
||
# Validate whether the given arguments match the command descriptor | ||
func validate(arguments: Array): | ||
return true | ||
|
||
|
||
# Run the command | ||
func run(command_params: Array) -> int: | ||
escoria.dialog_player.disable_preserve_dialog_box() | ||
return ESCExecution.RC_OK | ||
|
||
|
||
# Function called when the command is interrupted. | ||
func interrupt(): | ||
escoria.logger.debug( | ||
self, | ||
"[%s] interrupt() function not implemented." % get_command_name() | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.