You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to suggest a decorator to repeat their child X times as I have many enemies that would use this behavior and I dont think is too specific to my project.
Why not use a Limiter?
For two reasons. It doesnt work as I expect with long running tasks and it always returns FAILURE, forcing me to always use it with a Succeeder.
To quote the docs:
The Limiter node executes its child a specified number of times (x). When the maximum number of ticks is reached, it returns a FAILURE status code.
This is good to use in conditions that return imediately but it doesnt work well with long running tasks. It could be a bug but right now if a Limiter is set to execute 3 times it will do this:
Limiter::before_run()
child.tick() -> RUNNING, returning RUNNING as well
child.tick() -> RUNNING, returning RUNNING as well
child.tick() -> RUNNING, returning RUNNING as well
done executing child, returning FAILURE
Limiter::after_run()
Proposal
Make a decorator that only counts a child execution when it returns SUCCESS or FAILURE. So if it is set to repeat 3 times the child will have to returnSUCCESS or FAILURE 3 times to stop.
Give the freedom to choose what to return when it ends, either SUCCESS or FAILURE.
Give the freedom to choose to stop with a child returns something you are not expecting (ie: return FAILURE if one of the repetitions returns FAILURE)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I would like to suggest a decorator to repeat their child X times as I have many enemies that would use this behavior and I dont think is too specific to my project.
Why not use a
Limiter
?For two reasons. It doesnt work as I expect with long running tasks and it always returns FAILURE, forcing me to always use it with a Succeeder.
To quote the docs:
This is good to use in conditions that return imediately but it doesnt work well with long running tasks. It could be a bug but right now if a Limiter is set to execute 3 times it will do this:
Proposal
SUCCESS
orFAILURE
. So if it is set to repeat 3 times the child will have to returnSUCCESS
orFAILURE
3 times to stop.SUCCESS
orFAILURE
.Beta Was this translation helpful? Give feedback.
All reactions