feat: say_last_dialog_option command
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
# `say_last_dialog_option`
|
||||
#
|
||||
# Current player says the text of the last selected dialog option.
|
||||
#
|
||||
# @ESC
|
||||
extends ESCBaseCommand
|
||||
class_name SayLastDialogOptionCommand
|
||||
|
||||
|
||||
# Return the descriptor of the arguments of this command
|
||||
func configure() -> ESCCommandArgumentDescriptor:
|
||||
return ESCCommandArgumentDescriptor.new()
|
||||
|
||||
# Run the command
|
||||
func run(_command_params: Array) -> int:
|
||||
escoria.current_state = escoria.GAME_STATE.DIALOG
|
||||
|
||||
if !escoria.dialog_player:
|
||||
escoria.logger.error(
|
||||
self,
|
||||
"[%s]: No dialog player was registered and the say command was encountered."
|
||||
% get_command_name()
|
||||
)
|
||||
escoria.current_state = escoria.GAME_STATE.DEFAULT
|
||||
return ESCExecution.RC_ERROR
|
||||
|
||||
if not escoria.main.current_scene.player:
|
||||
escoria.logger.warn(
|
||||
self,
|
||||
"[%s]: No player item in the current scene was registered and the say command was encountered."
|
||||
% get_command_name()
|
||||
)
|
||||
escoria.current_state = escoria.GAME_STATE.DEFAULT
|
||||
return ESCExecution.RC_CANCEL
|
||||
|
||||
var last_chosen_option = escoria.globals_manager.get_global("ESC_DIALOG_CHOSEN_OPTION")
|
||||
# Surround text with quotes. Required by escoria.dialog_player.say()
|
||||
var text = "\"%s\"" % last_chosen_option
|
||||
|
||||
var speaking_character_global_id = escoria.main.current_scene.player.global_id
|
||||
|
||||
escoria.dialog_player.say(
|
||||
speaking_character_global_id,
|
||||
"",
|
||||
text
|
||||
)
|
||||
yield(escoria.dialog_player, "say_finished")
|
||||
escoria.current_state = escoria.GAME_STATE.DEFAULT
|
||||
|
||||
return ESCExecution.RC_OK
|
||||
@@ -173,6 +173,9 @@ func do_choose(dialog_player: Node, dialog: ESCDialog, type: String = "simple"):
|
||||
|
||||
var option = yield(chooser, "option_chosen")
|
||||
dialog_player.remove_child(chooser)
|
||||
# MODIFIED FOR RETURN TO MONKEY UI
|
||||
escoria.globals_manager.set_global("ESC_DIALOG_CHOSEN_OPTION", option.option)
|
||||
# END MODIFIED FOR RETURN TO MONKEY UI
|
||||
emit_signal("option_chosen", option)
|
||||
|
||||
|
||||
|
||||
@@ -1,30 +1,24 @@
|
||||
:action1
|
||||
say current_player "Tiene pinta de que fuma"
|
||||
|
||||
#1
|
||||
:talk
|
||||
:intro_dialog
|
||||
say current_player cocina_delante_intro_dialog_player:"Egunon! Que bien se duerme en este pueblo."
|
||||
# say eneko_smoking cocina_delante_intro_dialog_eneko:"Mira tú, el señorito se ha dignado a aparecer."
|
||||
# say eneko_smoking cocina_delante_intro_dialog_eneko_2:"¿Piensas hacer algo de provecho o te vas a pasar toda la mañana sentado fumando porros?"
|
||||
|
||||
say current_player "Hello!"
|
||||
say eneko_smoking "How can I help you?"
|
||||
|
||||
#2
|
||||
?
|
||||
#3
|
||||
- "I sell fine leather jackets."
|
||||
|
||||
- cocina_delante_intro_dialog_1_1:"Uyuyuy, parece que alguien se ha despertado con el pie izquierdo."
|
||||
# say current_player "1 {ESC_DIALOG_CHOSEN_OPTION}"
|
||||
say_last_dialog_option
|
||||
say eneko_smoking "Aha. Well, I don't like leather."
|
||||
stop
|
||||
|
||||
#4
|
||||
- "Can you tell me where the train station is?"
|
||||
|
||||
say eneko_smoking "Sure. You just go right, then right."
|
||||
say current_player "Okay?"
|
||||
say eneko_smoking "Then right and then right."
|
||||
say current_player "Aha?"
|
||||
say eneko_smoking "And then you ask somebody else."
|
||||
stop
|
||||
#5
|
||||
!
|
||||
|
||||
:action2
|
||||
|
||||
@@ -232,7 +232,7 @@ inventory_texture = ExtResource( 13 )
|
||||
dialog_color = Color( 1, 1, 1, 1 )
|
||||
tooltips = {
|
||||
"action1": "Admirar la patata",
|
||||
"action2": "Cogerla",
|
||||
"action2": "Cogerla"
|
||||
}
|
||||
count_textures = [ {
|
||||
"start": 1,
|
||||
|
||||
@@ -24,7 +24,7 @@ set_angle player 180
|
||||
accept_input SKIP
|
||||
set_gui_visible false
|
||||
walk_block player puerta_cocina_start
|
||||
# set_angle player 90
|
||||
# queue_event eneko_smoking talk
|
||||
set_angle player 90
|
||||
queue_event eneko_smoking intro_dialog
|
||||
set_gui_visible true
|
||||
accept_input ALL
|
||||
|
||||
@@ -4,6 +4,10 @@ frontal_action3,Admire,Admire,Admirar
|
||||
frontal_action3_say,"It's my lifelong headlight, I love it","C'est ma lampe frontale de toujours, je l'adore","Es mi frontal de toda la vida, le tengo cariño"
|
||||
frontal_action4,Use,Utiliser,Usar
|
||||
pegatinas_action2_eneko_smoking_say,Eh! las pegatinas no se tocan,Eh! las pegatinas no se tocan,Eh! las pegatinas no se tocan
|
||||
cocina_delante_intro_dialog_player,,,
|
||||
cocina_delante_intro_dialog_eneko,,,
|
||||
cocina_delante_intro_dialog_eneko_2,,,
|
||||
cocina_delante_intro_dialog_1_1,,,"Uyuyuy, parece que alguien se ha despertado con el pie izquierdo."
|
||||
cocina_delante_pegatinas_action1,,,"Observar pegatinas"
|
||||
cocina_delante_pegatinas_action2,,,"Coger una pegatina"
|
||||
cocina_delante_eneko_smoking_action1,,,"Observar sujeto"
|
||||
|
||||
|
@@ -204,7 +204,7 @@ _global_script_classes=[ {
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/escoria-core/game/scenes/dialogs/esc_dialog_options_chooser.gd"
|
||||
}, {
|
||||
"base": "StateMachine",
|
||||
"base": "Node",
|
||||
"class": "ESCDialogPlayer",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/escoria-core/game/scenes/dialogs/esc_dialog_player.gd"
|
||||
@@ -585,6 +585,11 @@ _global_script_classes=[ {
|
||||
"path": "res://addons/escoria-core/game/core-scripts/esc/commands/say.gd"
|
||||
}, {
|
||||
"base": "ESCBaseCommand",
|
||||
"class": "SayLastDialogOptionCommand",
|
||||
"language": "GDScript",
|
||||
"path": "res://gymkhana/addons/escoria-ui-return-monkey-island-dialog-simple/commands/say_last_dialog_option.gd"
|
||||
}, {
|
||||
"base": "ESCBaseCommand",
|
||||
"class": "SayRandomCommand",
|
||||
"language": "GDScript",
|
||||
"path": "res://gymkhana/addons/escoria-ui-return-monkey-island-dialog-simple/commands/say_random.gd"
|
||||
@@ -860,6 +865,7 @@ _global_script_class_icons={
|
||||
"RandGlobalCommand": "",
|
||||
"RepeatCommand": "",
|
||||
"SayCommand": "",
|
||||
"SayLastDialogOptionCommand": "",
|
||||
"SayRandomCommand": "",
|
||||
"SaySequenceCommand": "",
|
||||
"SchedEventCommand": "",
|
||||
|
||||
Reference in New Issue
Block a user