active-logic / activelogic-cs

Behavior Trees and Case Logic for C#7
GNU Affero General Public License v3.0
106 stars 7 forks source link

`Once` should return fail/complete status of decorated task, not `fail` #30

Closed eelstork closed 3 years ago

eelstork commented 3 years ago

Originally Once was implemented as a (thread safe) conditional. As such it returns:

In the third case, Once should retain and return the final status of the decorated task.

There isn't a solution here that's going to be compatible with thread pooling but, thread safety is on a best effort basis, not a requirement across the board.

Rarely used the Once decorator until recently. Seems a good alternative to ordered composites in a typical workflow, where stateless by default works well, and stateful nodes are ~1/10.

eelstork commented 3 years ago

c71bb04910e85575a6b2f98ac5fb3a2590808077