Files
gymkhana/patches/esc_dialog_option.patch

51 lines
1.5 KiB
Diff

diff --git a/addons/escoria-core/game/core-scripts/esc/types/esc_dialog_option.gd b/addons/escoria-core/game/core-scripts/esc/types/esc_dialog_option.gd
index e3701e59..9b9f390d 100644
--- a/addons/escoria-core/game/core-scripts/esc/types/esc_dialog_option.gd
+++ b/addons/escoria-core/game/core-scripts/esc/types/esc_dialog_option.gd
@@ -4,11 +4,15 @@
extends ESCStatement
class_name ESCDialogOption
-
+var _option: String
## Option text displayed in the HUD.
var option: String:
- get = get_translated_option
-
+ get:
+ return get_translated_option()
+ set(value):
+ _option = value
+ option = value
+
## Maps back to the parsed source option.
var source_option
@@ -29,8 +33,8 @@ var _is_valid: bool:
## Returns the translated version of the option, if one exists; otherwise, the default text is returned. (`String`)
func get_translated_option() -> String:
# Check if text has a key
- if ":" in option:
- var splitted_text = option.split(":")
+ if ":" in _option:
+ var splitted_text = _option.split(":")
var key = splitted_text[0]
var translated_text = tr(key)
@@ -40,7 +44,14 @@ func get_translated_option() -> String:
if splitted_text.size() > 1:
return splitted_text[1]
- return option
+ return _option
+
+func get_translation_id() -> String:
+ if ":" in _option:
+ var splitted_text = _option.split(":")
+ return splitted_text[0]
+
+ return _option
## Whether this dialog option is valid. Note: this value isn't currently used as part of any meaningful validation checks.[br]