Skip to content

Commit 2584aec

Browse files
committed
Add default impl of AsyncActionNode#on_halted
1 parent 04f435d commit 2584aec

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

btpy/__init__.py

+8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ class AsyncActionNode(StatefulActionNode):
3232
this method can return a final `NodeStatus` value to indicate its exit
3333
condition.
3434
35+
Optionally, subclasses can override the `on_halted()` method which is called
36+
when the tree halts. The default implementation does nothing. The `run()`
37+
method will never be called again after a halt.
38+
3539
Note:
3640
It is the responsibility of the action author to not block the main
3741
behavior tree loop with long-running tasks. `yield` calls should be
@@ -64,3 +68,7 @@ def on_running(self) -> NodeStatus:
6468
# Otherwise, just assume the action finished successfully.
6569
else:
6670
return NodeStatus.SUCCESS
71+
72+
def on_halted(self):
73+
# Default action: do nothing
74+
pass

0 commit comments

Comments
 (0)