bitbrain / beehave

🐝 behavior tree AI for Godot Engine
https://bitbra.in/beehave
MIT License
1.85k stars 116 forks source link

Until Fail Decorator #296

Closed RedstoneParadox closed 7 months ago

RedstoneParadox commented 8 months ago

Description

Adds a new decorator that runs its child and repeats until the child returns FAILURE, at which point it returns SUCCESS.

The original suggestion by @meticoeus provides additional context:

Motivation: implementing an indeterminate number of repeats based on some condition or set of conditions. This article explains a use-case involving poping data from a stack in the blackboard and going through a subtree based on that data until the stack is empty. I plan to do something similar in a project I'm working on. The number of repeats may grow while the child is repeating long running tasks due to an external actor adding more entities to the stack the sub tree will be using to loop.

Addressed issues

Addresses #240

RedstoneParadox commented 8 months ago

I'm not sure why the unit tests failed; I ran them personally and they all passed, including the new one. Edit: I forgot to update it after changing the decorator to return success instead of failure.

RcubDev commented 7 months ago

Can we close out https://github.com/bitbrain/beehave/issues/240 now that this has been merged?