Skip to content

Commit b67d63d

Browse files
committed
Merge branch 'main' into 11-3d-compatibility
# Conflicts: # addons/yet_another_behavior_tree/src/Nodes/Composite/BTSequence.gd
2 parents 06e58b8 + f6d2fa5 commit b67d63d

File tree

1 file changed

+16
-4
lines changed
  • addons/yet_another_behavior_tree/src/Nodes/Composite

1 file changed

+16
-4
lines changed

addons/yet_another_behavior_tree/src/Nodes/Composite/BTSequence.gd

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,21 @@ class_name BTSequence
2222
# Variables privées
2323
#------------------------------------------
2424

25+
var _running_child_index:int = -1
26+
2527
#------------------------------------------
2628
# Fonctions Godot redéfinies
2729
#------------------------------------------
2830

2931
func tick(actor:Node, blackboard:BTBlackboard) -> int:
30-
for child in _children:
31-
var result:int = child._execute(actor, blackboard)
32-
if result != BTTickResult.SUCCESS:
33-
return result
32+
for child_index in _children.size():
33+
if not save_progression or child_index >= _running_child_index:
34+
var child:BTNode = _children[child_index]
35+
var result:int = child._execute(actor, blackboard)
36+
if result != BTTickResult.SUCCESS:
37+
if save_progression and result == BTTickResult.RUNNING:
38+
_running_child_index = child_index
39+
return result
3440

3541
return BTTickResult.SUCCESS
3642

@@ -41,3 +47,9 @@ func tick(actor:Node, blackboard:BTBlackboard) -> int:
4147
#------------------------------------------
4248
# Fonctions privées
4349
#------------------------------------------
50+
51+
func start(blackboard:BTBlackboard) -> void:
52+
_running_child_index = 0
53+
54+
func stop(blackboard:BTBlackboard) -> void:
55+
_running_child_index = -1

0 commit comments

Comments
 (0)