Reset BT
if tick
returns Success or Failure.
#44
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Today, ticking a behavior tree after it has finished has confusing results. Looking at the code, it seems the intent was that once a
State
finishes, it is not expected to tick again. For example, if you tick a Sequence/Select after it has finished, it always returnsRunning
. Here's an example test that shows this strange behavior:This is clearly wrong. We could fix this particular issue (make Sequence/Select return a finished status if you tick it again), but it's not clear that ticking a finished behavior makes sense at all - so perhaps we should stop that.
There are two options then:
State
anOption
andtake
it once theState
finishes. This requires us to return an error to the user, and the user to for example, reset the tree.This PR does the latter. It is likely what users would expect (you can keep ticking your tree), and the behavior is well defined.