-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Show editor warnings * Update BeehaveRoot warning condition Co-authored-by: miguel <[email protected]>
- Loading branch information
Showing
17 changed files
with
89 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
## Decorator nodes are used to transform the result received by its child. | ||
## Must only have one child. | ||
extends BeehaveNode | ||
|
||
class_name Decorator | ||
@tool | ||
class_name Decorator extends BeehaveNode | ||
@icon("../../icons/category_decorator.svg") | ||
|
||
|
||
func _ready(): | ||
if Engine.is_editor_hint(): | ||
return | ||
|
||
if self.get_child_count() != 1: | ||
push_error("Beehave Error: Decorator %s should have only one child (NodePath: %s)" % [self.name, self.get_path()]) | ||
|
||
|
||
func _get_configuration_warnings() -> PackedStringArray: | ||
var warnings: PackedStringArray = super._get_configuration_warnings() | ||
|
||
if get_child_count() != 1: | ||
warnings.append("Decorator should have exactly one child node.") | ||
|
||
return warnings |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
## Conditions are leaf nodes that either return SUCCESS or FAILURE depending on | ||
## a single simple condition. They should never return `RUNNING`. | ||
extends Leaf | ||
|
||
class_name ConditionLeaf | ||
@tool | ||
class_name ConditionLeaf extends Leaf | ||
@icon("../../icons/condition.svg") |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
## Base class for all leaf nodes of the tree. | ||
extends BeehaveNode | ||
|
||
class_name Leaf | ||
@tool | ||
class_name Leaf extends BeehaveNode | ||
@icon("../../icons/action.svg") | ||
|
||
|
||
func _get_configuration_warnings() -> PackedStringArray: | ||
var warnings: PackedStringArray = [] | ||
|
||
var children: Array[Node] = get_children() | ||
|
||
if children.any(func(x): return x is BeehaveNode): | ||
warnings.append("Leaf nodes should not have any child nodes. They won't be ticked.") | ||
|
||
return warnings |
This file contains 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