Skip to content

Commit

Permalink
Fix to choice right after condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Jowan-Spooner committed Aug 25, 2024
1 parent 4b349a0 commit 4eb5782
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions addons/dialogic/Core/DialogicGameHandler.gd
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ func start_timeline(timeline:Variant, label_or_idx:Variant = "") -> void:

current_timeline = timeline
current_timeline_events = current_timeline.events
for event in current_timeline_events:
event.dialogic = self
current_event_idx = -1

if typeof(label_or_idx) == TYPE_STRING:
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Modules/Choice/subsystem_choices.gd
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func is_question(index:int) -> bool:

if dialogic.current_timeline_events[index] is DialogicChoiceEvent:
if index != 0 and dialogic.current_timeline_events[index-1] is DialogicEndBranchEvent:
if dialogic.current_timeline_events[dialogic.current_timeline_events[index-1].find_opening_index()] is DialogicChoiceEvent:
if dialogic.current_timeline_events[dialogic.current_timeline_events[index-1].find_opening_index(index-1)] is DialogicChoiceEvent:
return false
else:
return true
Expand Down
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Condition/event_condition.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ func _execute() -> void:

if condition.is_empty(): condition = "true"

var result :bool= dialogic.Expressions.execute_condition(condition)
var result: bool = dialogic.Expressions.execute_condition(condition)
if not result:
var idx :int = dialogic.current_event_idx
var idx: int = dialogic.current_event_idx
var ignore := 1
while true:
idx += 1
Expand Down
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Core/event_end_branch.gd
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func find_next_index() -> int:
return idx


func find_opening_index() -> int:
var idx: int = dialogic.current_event_idx
func find_opening_index(at_index:int) -> int:
var idx: int = at_index

var ignore: int = 1
while true:
Expand Down

0 comments on commit 4eb5782

Please sign in to comment.