From 6a6e30fd31b2d5f41633fd2cc410ae83ada95abc Mon Sep 17 00:00:00 2001 From: salianifo Date: Wed, 23 Oct 2024 13:29:37 -0400 Subject: [PATCH] Portraits: Add text effect for extra_data (#2438) --- addons/dialogic/Modules/Character/index.gd | 5 ++++- addons/dialogic/Modules/Character/subsystem_portraits.gd | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/dialogic/Modules/Character/index.gd b/addons/dialogic/Modules/Character/index.gd index 805d62af8..3b1dd7ee6 100644 --- a/addons/dialogic/Modules/Character/index.gd +++ b/addons/dialogic/Modules/Character/index.gd @@ -13,7 +13,10 @@ func _get_settings_pages() -> Array: return [this_folder.path_join('settings_portraits.tscn')] func _get_text_effects() -> Array[Dictionary]: - return [{'command':'portrait', 'subsystem':'Portraits', 'method':'text_effect_portrait', 'arg':true}] + return [ + {'command':'portrait', 'subsystem':'Portraits', 'method':'text_effect_portrait', 'arg':true}, + {'command':'extra_data', 'subsystem':'Portraits', 'method':'text_effect_extradata', 'arg':true}, + ] func _get_special_resources() -> Dictionary: diff --git a/addons/dialogic/Modules/Character/subsystem_portraits.gd b/addons/dialogic/Modules/Character/subsystem_portraits.gd index b78abd21d..001e0cb64 100644 --- a/addons/dialogic/Modules/Character/subsystem_portraits.gd +++ b/addons/dialogic/Modules/Character/subsystem_portraits.gd @@ -698,4 +698,11 @@ func text_effect_portrait(_text_node:Control, _skipped:bool, argument:String) -> if dialogic.current_state_info.get('speaker', null): change_character_portrait(load(dialogic.current_state_info.speaker), argument) change_speaker(load(dialogic.current_state_info.speaker), argument) + + +## Called from the [extra_data=something] text effect. +func text_effect_extradata(_text_node:Control, _skipped:bool, argument:String) -> void: + if argument: + if dialogic.current_state_info.get('speaker', null): + change_character_extradata(load(dialogic.current_state_info.speaker), argument) #endregion