zkat / big-brain

Utility AI library for the Bevy game engine
Other
1.01k stars 61 forks source link

feat(thinker): otherwise clause no longer overrides running action #56

Closed zkat closed 1 year ago

zkat commented 1 year ago

Fixes: https://github.com/zkat/big-brain/issues/47

The way actions are intended to work is that they will generally keep running to completion if they're triggered by a Scorer, as long as the Thinker doesn't happen to pick a different Action in the process. The otherwise clause was messing with this because the moment the Scorer stopped applying (which is a very common scenario!), things would fall back to the otherwise clause and immediately override the action. Per #47 this caused some unexpected behavior.

BREAKING CHANGE: This patch changes the behavior for otherwise such that it won't override an existing action if it's still running, but it'll still execute as soon as that action finishes. I think this is really what people expect this to do, so let's give it a shot!