Skip to content

Commit

Permalink
[feat] Add support for retrieving properties of variable type Resource
Browse files Browse the repository at this point in the history
with format variable["property"]
  • Loading branch information
real-ezTheDev committed Aug 15, 2024
1 parent 2f3f01f commit 6547385
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion addons/ez_dialogue/dialogue_reader.gd
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func next(choice_index: int = 0):
if is_running:
return

dialogue_visit_history = []
if choice_index >= 0 && choice_index < _pending_choice_actions.size():
# select a choice
var commands = _pending_choice_actions[choice_index] as Array[DialogueCommand]
Expand Down Expand Up @@ -271,6 +270,13 @@ func _retrieve_nested_values(searchKeys: Array):
printerr("Error in [%s]: Can't find key '%s' from the stack '%s'"\
%[_get_current_node_name(), searchKeys[key],searchKeys[0]])
return false
elif currentKey is Resource:
if (currentKey as Resource).get(searchKeys[key]):
currentKey = (currentKey as Resource).get(searchKeys[key])
else:
printerr("Error in [%s]: Can't find key '%s' from the stack '%s'"\
%[_get_current_node_name(), searchKeys[key],searchKeys[0]])
return false
else: # fail safe since we only care for nested dictionaries.
break
return currentKey
Expand Down

0 comments on commit 6547385

Please sign in to comment.