feat: say_last_dialog_option command

This commit is contained in:
2023-10-13 02:41:43 +02:00
parent 937e0fd8d3
commit 275458a8a4
8 changed files with 75 additions and 18 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -69,4 +69,4 @@ func register_components():
func autoload_components():
add_child(ESCItemComponentOutline.new())
add_child(ESCItemComponentInventoryChecker.new())
add_child(ESCItemComponentInventoryChecker.new())

View File

@@ -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

View File

@@ -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,

View File

@@ -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

View File

@@ -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"
1 keys en fr es
4 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
5 frontal_action4 Use Utiliser Usar
6 pegatinas_action2_eneko_smoking_say Eh! las pegatinas no se tocan Eh! las pegatinas no se tocan Eh! las pegatinas no se tocan
7 cocina_delante_intro_dialog_player
8 cocina_delante_intro_dialog_eneko
9 cocina_delante_intro_dialog_eneko_2
10 cocina_delante_intro_dialog_1_1 Uyuyuy, parece que alguien se ha despertado con el pie izquierdo.
11 cocina_delante_pegatinas_action1 Observar pegatinas
12 cocina_delante_pegatinas_action2 Coger una pegatina
13 cocina_delante_eneko_smoking_action1 Observar sujeto