Skip to content

Commit

Permalink
Fix bug in disabled child checking
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonlamb committed Jul 22, 2017
1 parent 38dc0c8 commit 063f32e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions addons/com.brandonlamb.bt/selector.gd
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ func tick(actor, ctx):
for idx in range(last_child_index, get_child_count()):
var child = get_child(idx)

if child.disabled:
break

last_child_index = idx
last_result = child.tick(actor, ctx)

if child.disabled:
last_result = OK
else:
last_result = child.tick(actor, ctx)

if typeof(last_result) == TYPE_OBJECT and last_result extends BehvError:
break
Expand Down
9 changes: 5 additions & 4 deletions addons/com.brandonlamb.bt/sequence.gd
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ func tick(actor, ctx):
for idx in range(last_child_index, get_child_count()):
var child = get_child(idx)

if child.disabled:
break

last_child_index = idx
last_result = child.tick(actor, ctx)

if child.disabled:
last_result = OK
else:
last_result = child.tick(actor, ctx)

if typeof(last_result) == TYPE_OBJECT and last_result extends BehvError:
break
Expand Down

0 comments on commit 063f32e

Please sign in to comment.