From 9d74b49ab62908d4acf53dde444413886b8b28e5 Mon Sep 17 00:00:00 2001 From: Radio Date: Thu, 4 Jun 2026 15:15:11 +0300 Subject: escoria setup and old branch archives --- .../esc_dialog_simple_state_machine.gd | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 addons/escoria-dialog-simple/esc_dialog_simple_state_machine.gd (limited to 'addons/escoria-dialog-simple/esc_dialog_simple_state_machine.gd') diff --git a/addons/escoria-dialog-simple/esc_dialog_simple_state_machine.gd b/addons/escoria-dialog-simple/esc_dialog_simple_state_machine.gd new file mode 100644 index 0000000..4c48f60 --- /dev/null +++ b/addons/escoria-dialog-simple/esc_dialog_simple_state_machine.gd @@ -0,0 +1,34 @@ +extends StateMachine +## Instanciation of this dialogs state machine implementation. + +# Constructor +func _init(): + _create_states() + _add_states_to_machine() + current_state_name = "idle" + # This line is very important here: it defines the initial state of the + # dialogs state machine. Since Escoria can't guess which state is the default one + # it has to be assigned here. If it happens to be null on initialize() call, + # an error is triggered. + START_STATE = states_map[current_state_name] + initialize(START_STATE) + + +# Creates the states for this state machine. +func _create_states() -> void: + states_map = { + "idle": preload("res://addons/escoria-dialog-simple/states/dialog_idle.gd").new(), + "say": preload("res://addons/escoria-dialog-simple/states/dialog_say.gd").new(), + "say_fast": preload("res://addons/escoria-dialog-simple/states/dialog_say_fast.gd").new(), + "say_finish": preload("res://addons/escoria-dialog-simple/states/dialog_say_finish.gd").new(), + "visible": preload("res://addons/escoria-dialog-simple/states/dialog_visible.gd").new(), + "finish": preload("res://addons/escoria-dialog-simple/states/dialog_finish.gd").new(), + "interrupt": preload("res://addons/escoria-dialog-simple/states/dialog_interrupt.gd").new(), + "choices": preload("res://addons/escoria-dialog-simple/states/dialog_choices.gd").new() + } + + +# Adds any created states into the state machine as children. +func _add_states_to_machine() -> void: + for key in states_map: + add_child(states_map[key]) -- cgit v1.3