Fix: Check child count before applying interrupt#121
Merged
Conversation
So it doesn't throw an error, when: - there's no child node inside the BeehaveTree - the BeehaveTree is disabled
Owner
|
Could you also add a test here? https://github.com/bitbrain/beehave/blob/godot-4.x/test/beehave_tree_test.gd |
* EmptyTree A tree, that is activated and has no children * OnlyOneActionTree A tree with only one action in it * DeactivatedTree A tree that is deactivated
bitbrain
approved these changes
Feb 13, 2023
lostptr
pushed a commit
to lostptr/beehave
that referenced
this pull request
Feb 13, 2023
* Fix: Check child count before applying interrupt So it doesn't throw an error, when: - there's no child node inside the BeehaveTree - the BeehaveTree is disabled * Add duck typing check for interrupt method in child * 🧪 Add Trees to UnitTestScene to cause errors if fix is not applied * EmptyTree A tree, that is activated and has no children * OnlyOneActionTree A tree with only one action in it * DeactivatedTree A tree that is deactivated --------- Co-authored-by: miguel <miguel-gonzalez@gmx.de>
bitbrain
added a commit
that referenced
this pull request
Feb 15, 2023
…118 * Added `enter()` and `exit()` methods for beehave nodes - Added `enter()` and `exit()` methods in BeehaveNode. - Adjusted some composites to use those methods now - Since it's the parent's responsability to call those methods, all tests needed to be adjusted so that a `BeehaveTree` is added as the root. - Some tests needed adjustments because now decorators **will** throw errors if they have no children. - A new test was added to validade the enter and exit methods. - A new test action was added to make those tests possible. * Changed `enter` and `exit` to `before_run` and `after_run` - A short explanation of those methods was also added in the README. * Fix: Check child count before applying interrupt (#121) * Fix: Check child count before applying interrupt So it doesn't throw an error, when: - there's no child node inside the BeehaveTree - the BeehaveTree is disabled * Add duck typing check for interrupt method in child * 🧪 Add Trees to UnitTestScene to cause errors if fix is not applied * EmptyTree A tree, that is activated and has no children * OnlyOneActionTree A tree with only one action in it * DeactivatedTree A tree that is deactivated --------- Co-authored-by: miguel <miguel-gonzalez@gmx.de> * 🐛 do only unregister monitor when present (#128) * Update addons/beehave/nodes/beehave_tree.gd --------- Co-authored-by: miguel <miguel-gonzalez@gmx.de> Co-authored-by: Patrick Werner <paddi@tastenklopfer.io>
bitbrain
added a commit
that referenced
this pull request
Feb 15, 2023
…118 * Added `enter()` and `exit()` methods for beehave nodes - Added `enter()` and `exit()` methods in BeehaveNode. - Adjusted some composites to use those methods now - Since it's the parent's responsability to call those methods, all tests needed to be adjusted so that a `BeehaveTree` is added as the root. - Some tests needed adjustments because now decorators **will** throw errors if they have no children. - A new test was added to validade the enter and exit methods. - A new test action was added to make those tests possible. * Changed `enter` and `exit` to `before_run` and `after_run` - A short explanation of those methods was also added in the README. * Fix: Check child count before applying interrupt (#121) * Fix: Check child count before applying interrupt So it doesn't throw an error, when: - there's no child node inside the BeehaveTree - the BeehaveTree is disabled * Add duck typing check for interrupt method in child * 🧪 Add Trees to UnitTestScene to cause errors if fix is not applied * EmptyTree A tree, that is activated and has no children * OnlyOneActionTree A tree with only one action in it * DeactivatedTree A tree that is deactivated --------- Co-authored-by: miguel <miguel-gonzalez@gmx.de> * 🐛 do only unregister monitor when present (#128) * Update addons/beehave/nodes/beehave_tree.gd --------- Co-authored-by: miguel <miguel-gonzalez@gmx.de> Co-authored-by: Patrick Werner <paddi@tastenklopfer.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Currently, an out of bounds error will happen when: