Skip to content

Commit 08b903f

Browse files
authored
Fix expression jumps only evaluating once (#840)
1 parent 0a4c4ac commit 08b903f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

addons/dialogue_manager/dialogue_manager.gd

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func get_line(resource: DialogueResource, key: String, extra_game_states: Array)
164164
if not resource.lines.has(key):
165165
assert(false, DMConstants.translate(&"errors.key_not_found").format({ key = key }))
166166

167-
var data: Dictionary = resource.lines.get(key)
167+
var data: Dictionary = resource.lines.get(key).duplicate(true)
168168

169169
# If next_id is an expression we need to resolve it.
170170
if data.has(&"next_id_expression"):
@@ -207,14 +207,13 @@ func get_line(resource: DialogueResource, key: String, extra_game_states: Array)
207207
cummulative_weight += sibling.weight
208208

209209
# Find any simultaneously said lines.
210-
var concurrent_lines: Array[DialogueLine] = []
211210
if data.has(&"concurrent_lines"):
212211
# If the list includes this line then it isn't the origin line so ignore it.
213212
if not data.concurrent_lines.has(data.id):
214-
for concurrent_id: String in data.concurrent_lines:
215-
var concurrent_line: DialogueLine = await get_line(resource, concurrent_id, extra_game_states)
216-
if concurrent_line:
217-
concurrent_lines.append(concurrent_line)
213+
# Resolve IDs to their actual lines.
214+
data.concurrent_lines = data.concurrent_lines.map(func(line_id):
215+
return await get_line(resource, line_id, extra_game_states)
216+
)
218217

219218
# If this line is blank and it's the last line then check for returning snippets.
220219
if data.type in [DMConstants.TYPE_COMMENT, DMConstants.TYPE_UNKNOWN]:
@@ -252,7 +251,6 @@ func get_line(resource: DialogueResource, key: String, extra_game_states: Array)
252251

253252
# Set up a line object.
254253
var line: DialogueLine = await create_dialogue_line(data, extra_game_states)
255-
line.concurrent_lines = concurrent_lines
256254

257255
# If the jump point somehow has no content then just end.
258256
if not line: return null

0 commit comments

Comments
 (0)