Skip to content

Commit

Permalink
Move Class Descriptions Below Class Names (#236)
Browse files Browse the repository at this point in the history
This allows the descriptions to be seen in the editor.
  • Loading branch information
mechPenSketch authored Oct 26, 2023
1 parent 5a93aaa commit a35038e
Show file tree
Hide file tree
Showing 24 changed files with 67 additions and 59 deletions.
5 changes: 3 additions & 2 deletions addons/beehave/blackboard.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## The blackboard is an object that can be used to store and access data between
## multiple nodes of the behavior tree.
@icon("icons/blackboard.svg")
class_name Blackboard extends Node

## The blackboard is an object that can be used to store and access data between
## multiple nodes of the behavior tree.

var blackboard: Dictionary = {}

func keys() -> Array[String]:
Expand Down
5 changes: 3 additions & 2 deletions addons/beehave/nodes/beehave_node.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## A node in the behavior tree. Every node must return `SUCCESS`, `FAILURE` or
## `RUNNING` when ticked.
@tool
class_name BeehaveNode extends Node

## A node in the behavior tree. Every node must return `SUCCESS`, `FAILURE` or
## `RUNNING` when ticked.

enum {
SUCCESS,
FAILURE,
Expand Down
3 changes: 2 additions & 1 deletion addons/beehave/nodes/beehave_tree.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## Controls the flow of execution of the entire behavior tree.
@tool
@icon("../icons/tree.svg")
class_name BeehaveTree extends Node

## Controls the flow of execution of the entire behavior tree.

enum {
SUCCESS,
FAILURE,
Expand Down
2 changes: 1 addition & 1 deletion addons/beehave/nodes/composites/composite.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## A Composite node controls the flow of execution of its children in a specific manner.
@tool
@icon("../../icons/category_composite.svg")
class_name Composite extends BeehaveNode

## A Composite node controls the flow of execution of its children in a specific manner.

var running_child: BeehaveNode = null

Expand Down
8 changes: 4 additions & 4 deletions addons/beehave/nodes/composites/selector.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## Selector nodes will attempt to execute each of its children until one of
## them return `SUCCESS`. If all children return `FAILURE`, this node will also
## return `FAILURE`.
## If a child returns `RUNNING` it will tick again.
@tool
@icon("../../icons/selector.svg")
class_name SelectorComposite extends Composite

## Selector nodes will attempt to execute each of its children until one of
## them return `SUCCESS`. If all children return `FAILURE`, this node will also
## return `FAILURE`.
## If a child returns `RUNNING` it will tick again.

var last_execution_index: int = 0

Expand Down
7 changes: 4 additions & 3 deletions addons/beehave/nodes/composites/selector_random.gd
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
## This node will attempt to execute all of its children just like a
## [code]SelectorStar[/code] would, with the exception that the children
## will be executed in a random order.
@tool
@icon("../../icons/selector_random.svg")
class_name SelectorRandomComposite extends RandomizedComposite

## This node will attempt to execute all of its children just like a
## [code]SelectorStar[/code] would, with the exception that the children
## will be executed in a random order.

## A shuffled list of the children that will be executed in reverse order.
var _children_bag: Array[Node] = []
var c: Node
Expand Down
7 changes: 4 additions & 3 deletions addons/beehave/nodes/composites/selector_reactive.gd
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@tool
@icon("../../icons/selector_reactive.svg")
class_name SelectorReactiveComposite extends Composite

## Selector Reactive nodes will attempt to execute each of its children until one of
## them return `SUCCESS`. If all children return `FAILURE`, this node will also
## return `FAILURE`.
## If a child returns `RUNNING` it will restart.
@tool
@icon("../../icons/selector_reactive.svg")
class_name SelectorReactiveComposite extends Composite

func tick(actor: Node, blackboard: Blackboard) -> int:
for c in get_children():
Expand Down
10 changes: 5 additions & 5 deletions addons/beehave/nodes/composites/sequence.gd
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## Sequence nodes will attempt to execute all of its children and report
## `SUCCESS` in case all of the children report a `SUCCESS` status code.
## If at least one child reports a `FAILURE` status code, this node will also
## return `FAILURE` and restart.
## In case a child returns `RUNNING` this node will tick again.
@tool
@icon("../../icons/sequence.svg")
class_name SequenceComposite extends Composite

## Sequence nodes will attempt to execute all of its children and report
## `SUCCESS` in case all of the children report a `SUCCESS` status code.
## If at least one child reports a `FAILURE` status code, this node will also
## return `FAILURE` and restart.
## In case a child returns `RUNNING` this node will tick again.

var successful_index: int = 0

Expand Down
7 changes: 4 additions & 3 deletions addons/beehave/nodes/composites/sequence_random.gd
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
## This node will attempt to execute all of its children just like a
## [code]SequenceStar[/code] would, with the exception that the children
## will be executed in a random order.
@tool
@icon("../../icons/sequence_random.svg")
class_name SequenceRandomComposite extends RandomizedComposite

## This node will attempt to execute all of its children just like a
## [code]SequenceStar[/code] would, with the exception that the children
## will be executed in a random order.

# Emitted whenever the children are shuffled.
signal reset(new_order: Array[Node])

Expand Down
8 changes: 4 additions & 4 deletions addons/beehave/nodes/composites/sequence_reactive.gd
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@tool
@icon("../../icons/sequence_reactive.svg")
class_name SequenceReactiveComposite extends Composite

## Reactive Sequence nodes will attempt to execute all of its children and report
## `SUCCESS` in case all of the children report a `SUCCESS` status code.
## If at least one child reports a `FAILURE` status code, this node will also
## return `FAILURE` and restart.
## In case a child returns `RUNNING` this node will restart.
@tool
@icon("../../icons/sequence_reactive.svg")
class_name SequenceReactiveComposite extends Composite


var successful_index: int = 0

Expand Down
8 changes: 4 additions & 4 deletions addons/beehave/nodes/composites/sequence_star.gd
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@tool
@icon("../../icons/sequence_reactive.svg")
class_name SequenceStarComposite extends Composite

## Sequence Star nodes will attempt to execute all of its children and report
## `SUCCESS` in case all of the children report a `SUCCESS` status code.
## If at least one child reports a `FAILURE` status code, this node will also
## return `FAILURE` and tick again.
## In case a child returns `RUNNING` this node will restart.
@tool
@icon("../../icons/sequence_reactive.svg")
class_name SequenceStarComposite extends Composite


var successful_index: int = 0

Expand Down
4 changes: 2 additions & 2 deletions addons/beehave/nodes/decorators/decorator.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Decorator nodes are used to transform the result received by its child.
## Must only have one child.
@tool
@icon("../../icons/category_decorator.svg")
class_name Decorator extends BeehaveNode

## Decorator nodes are used to transform the result received by its child.
## Must only have one child.

var running_child: BeehaveNode = null

Expand Down
2 changes: 1 addition & 1 deletion addons/beehave/nodes/decorators/failer.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## A Failer node will always return a `FAILURE` status code.
@tool
@icon("../../icons/failer.svg")
class_name AlwaysFailDecorator extends Decorator

## A Failer node will always return a `FAILURE` status code.

func tick(actor: Node, blackboard: Blackboard) -> int:
var c = get_child(0)
Expand Down
4 changes: 2 additions & 2 deletions addons/beehave/nodes/decorators/inverter.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## An inverter will return `FAILURE` in case it's child returns a `SUCCESS` status
## code or `SUCCESS` in case its child returns a `FAILURE` status code.
@tool
@icon("../../icons/inverter.svg")
class_name InverterDecorator extends Decorator

## An inverter will return `FAILURE` in case it's child returns a `SUCCESS` status
## code or `SUCCESS` in case its child returns a `FAILURE` status code.

func tick(actor: Node, blackboard: Blackboard) -> int:
var c = get_child(0)
Expand Down
5 changes: 3 additions & 2 deletions addons/beehave/nodes/decorators/limiter.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
## The limiter will execute its child `x` amount of times. When the number of
## maximum ticks is reached, it will return a `FAILURE` status code.
@tool
@icon("../../icons/limiter.svg")
class_name LimiterDecorator extends Decorator

## The limiter will execute its child `x` amount of times. When the number of
## maximum ticks is reached, it will return a `FAILURE` status code.

@onready var cache_key = 'limiter_%s' % self.get_instance_id()

@export var max_count : float = 0
Expand Down
2 changes: 1 addition & 1 deletion addons/beehave/nodes/decorators/succeeder.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## A succeeder node will always return a `SUCCESS` status code.
@tool
@icon("../../icons/succeeder.svg")
class_name AlwaysSucceedDecorator extends Decorator

## A succeeder node will always return a `SUCCESS` status code.

func tick(actor: Node, blackboard: Blackboard) -> int:
var c = get_child(0)
Expand Down
7 changes: 4 additions & 3 deletions addons/beehave/nodes/decorators/time_limiter.gd
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
## The Time Limit Decorator will give its child a set amount of time to finish
## before interrupting it and return a `FAILURE` status code. The timer is reset
## every time before the node runs.
@tool
@icon("../../icons/limiter.svg")
class_name TimeLimiterDecorator extends Decorator

## The Time Limit Decorator will give its child a set amount of time to finish
## before interrupting it and return a `FAILURE` status code. The timer is reset
## every time before the node runs.

@export var wait_time: = 0.0

var time_left: = 0.0
Expand Down
8 changes: 4 additions & 4 deletions addons/beehave/nodes/leaves/action.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## Actions are leaf nodes that define a task to be performed by an actor.
## Their execution can be long running, potentially being called across multiple
## frame executions. In this case, the node should return `RUNNING` until the
## action is completed.
@tool
@icon("../../icons/action.svg")
class_name ActionLeaf extends Leaf

## Actions are leaf nodes that define a task to be performed by an actor.
## Their execution can be long running, potentially being called across multiple
## frame executions. In this case, the node should return `RUNNING` until the
## action is completed.

func get_class_name() -> Array[StringName]:
var classes := super()
Expand Down
6 changes: 3 additions & 3 deletions addons/beehave/nodes/leaves/blackboard_compare.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Compares two values using the specified comparison operator.
## Returns [code]FAILURE[/code] if any of the expression fails or the
## comparison operation returns [code]false[/code], otherwise it returns [code]SUCCESS[/code].
@tool
class_name BlackboardCompareCondition extends ConditionLeaf

## Compares two values using the specified comparison operator.
## Returns [code]FAILURE[/code] if any of the expression fails or the
## comparison operation returns [code]false[/code], otherwise it returns [code]SUCCESS[/code].

enum Operators {
EQUAL,
Expand Down
4 changes: 2 additions & 2 deletions addons/beehave/nodes/leaves/blackboard_erase.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Erases the specified key from the blackboard.
## Returns [code]FAILURE[/code] if expression execution fails, otherwise [code]SUCCESS[/code].
@tool
class_name BlackboardEraseAction extends ActionLeaf

## Erases the specified key from the blackboard.
## Returns [code]FAILURE[/code] if expression execution fails, otherwise [code]SUCCESS[/code].

## Expression representing a blackboard key.
@export_placeholder(EXPRESSION_PLACEHOLDER) var key: String = ""
Expand Down
4 changes: 2 additions & 2 deletions addons/beehave/nodes/leaves/blackboard_has.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Returns [code]FAILURE[/code] if expression execution fails or the specified key doesn't exist.
## Returns [code]SUCCESS[/code] if blackboard has the specified key.
@tool
class_name BlackboardHasCondition extends ConditionLeaf

## Returns [code]FAILURE[/code] if expression execution fails or the specified key doesn't exist.
## Returns [code]SUCCESS[/code] if blackboard has the specified key.

## Expression representing a blackboard key.
@export_placeholder(EXPRESSION_PLACEHOLDER) var key: String = ""
Expand Down
4 changes: 2 additions & 2 deletions addons/beehave/nodes/leaves/blackboard_set.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Sets the specified key to the specified value.
## Returns [code]FAILURE[/code] if expression execution fails, otherwise [code]SUCCESS[/code].
@tool
class_name BlackboardSetAction extends ActionLeaf

## Sets the specified key to the specified value.
## Returns [code]FAILURE[/code] if expression execution fails, otherwise [code]SUCCESS[/code].

## Expression representing a blackboard key.
@export_placeholder(EXPRESSION_PLACEHOLDER) var key: String = ""
Expand Down
4 changes: 2 additions & 2 deletions addons/beehave/nodes/leaves/condition.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Conditions are leaf nodes that either return SUCCESS or FAILURE depending on
## a single simple condition. They should never return `RUNNING`.
@tool
@icon("../../icons/condition.svg")
class_name ConditionLeaf extends Leaf

## Conditions are leaf nodes that either return SUCCESS or FAILURE depending on
## a single simple condition. They should never return `RUNNING`.

func get_class_name() -> Array[StringName]:
var classes := super()
Expand Down
2 changes: 1 addition & 1 deletion addons/beehave/nodes/leaves/leaf.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Base class for all leaf nodes of the tree.
@tool
@icon("../../icons/category_leaf.svg")
class_name Leaf extends BeehaveNode

## Base class for all leaf nodes of the tree.

const EXPRESSION_PLACEHOLDER: String = "Insert an expression..."

Expand Down

0 comments on commit a35038e

Please sign in to comment.