Update demo documentation comments

This commit is contained in:
Serhii Snitsaruk 2024-07-07 13:22:02 +02:00
parent 5f40d38f8d
commit 86d31f5f00
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
10 changed files with 28 additions and 29 deletions

View File

@ -10,9 +10,9 @@
#* #*
@tool @tool
extends BTAction extends BTAction
## ArrivePos: Arrive to a position, with a bias to horizontal movement. ## Moves the agent to the specified position, favoring horizontal movement. [br]
## Returns SUCCESS when close to the target position (see tolerance); ## Returns [code]SUCCESS[/code] when close to the target position (see [member tolerance]);
## otherwise returns RUNNING. ## otherwise returns [code]RUNNING[/code].
## Blackboard variable that stores the target position (Vector2) ## Blackboard variable that stores the target position (Vector2)
@export var target_position_var := &"pos" @export var target_position_var := &"pos"

View File

@ -10,8 +10,8 @@
#* #*
@tool @tool
extends BTAction extends BTAction
## BackAway ## Moves the agent in the opposite direction of its current facing. [br]
## Returns RUNNING always. ## Returns [code]RUNNING[/code] always.
## Blackboard variable that stores desired speed. ## Blackboard variable that stores desired speed.
@export var speed_var: StringName = &"speed" @export var speed_var: StringName = &"speed"

View File

@ -10,8 +10,8 @@
#* #*
@tool @tool
extends BTAction extends BTAction
## FaceTarget and return SUCCESS. ## Flips the agent to face the target, returning [code]SUCCESS[/code]. [br]
## Returns FAILURE if target is not a valid Node2D instance. ## Returns [code]FAILURE[/code] if [member target_var] is not a valid [Node2D] instance.
## Blackboard variable that stores our target (expecting Node2D). ## Blackboard variable that stores our target (expecting Node2D).
@export var target_var: StringName = &"target" @export var target_var: StringName = &"target"

View File

@ -10,8 +10,8 @@
#* #*
@tool @tool
extends BTAction extends BTAction
## Get first node in group and save it to the blackboard. ## Stores the first node in the [member group] on the blackboard, returning [code]SUCCESS[/code]. [br]
## Returns FAILURE if group contains 0 nodes. ## Returns [code]FAILURE[/code] if the group contains 0 nodes.
## Name of the SceneTree group. ## Name of the SceneTree group.
@export var group: StringName @export var group: StringName

View File

@ -10,11 +10,10 @@
#* #*
@tool @tool
extends BTCondition extends BTCondition
## InRange condition checks if the agent is within a range of target, ## InRange condition checks if the agent is within a range of target,
## defined by distance_min and distance_max. ## defined by [member distance_min] and [member distance_max]. [br]
## Returns SUCCESS if the agent is within the defined range; ## Returns [code]SUCCESS[/code] if the agent is within the given range;
## otherwise, returns FAILURE. ## otherwise, returns [code]FAILURE[/code].
## Minimum distance to target. ## Minimum distance to target.
@export var distance_min: float @export var distance_min: float

View File

@ -10,9 +10,9 @@
#* #*
@tool @tool
extends BTCondition extends BTCondition
## IsAlignedWithTarget ## Checks if the agent is horizontally aligned with the target. [br]
## Returns SUCCESS if the agent is horizontally aligned with the target. ## Returns [code]SUCCESS[/code] if the agent is horizontally aligned with the target.
## Returns FAILURE if not aligned or if target is not a valid node instance. ## Returns [code]FAILURE[/code] if not aligned or if target is not a valid node instance.
@export var target_var: StringName = &"target" @export var target_var: StringName = &"target"

View File

@ -10,9 +10,10 @@
#* #*
@tool @tool
extends BTAction extends BTAction
## MoveForward: Applies velocity each tick until duration is exceeded. ## Applies velocity in the direction the agent is facing on each tick
## Returns SUCCESS if elapsed time exceeded duration. ## until the [member duration] is exceeded. [br]
## Returns RUNNING if elapsed time didn't exceed duration. ## Returns [code]SUCCESS[/code] if the elapsed time exceeds [member duration]. [br]
## Returns [code]RUNNING[/code] if the elapsed time does not exceed [member duration]. [br]
## Blackboard variable that stores desired speed. ## Blackboard variable that stores desired speed.
@export var speed_var: StringName = &"speed" @export var speed_var: StringName = &"speed"

View File

@ -10,11 +10,10 @@
#* #*
@tool @tool
extends BTAction extends BTAction
## Pursue: Move towards target until agent is flanking it. ## Move towards the target until the agent is flanking it. [br]
## ## Returns [code]RUNNING[/code] while moving towards the target but not yet at the desired position. [br]
## Returns RUNNING, while moving towards target but not yet at the desired position. ## Returns [code]SUCCESS[/code] when at the desired position relative to the target (flanking it). [br]
## Returns SUCCESS, when at the desired position from target (flanking it). ## Returns [code]FAILURE[/code] if the target is not a valid [Node2D] instance. [br]
## Returns FAILURE, if target is not a valid Node2D instance.
## How close should the agent be to the desired position to return SUCCESS. ## How close should the agent be to the desired position to return SUCCESS.
const TOLERANCE := 30.0 const TOLERANCE := 30.0

View File

@ -10,8 +10,9 @@
#* #*
@tool @tool
extends BTAction extends BTAction
## SelectFlankingPos on the side of a target, and return SUCCESS. ## Selects a position on the target's side and stores it on the
## Returns FAILURE, if the target is not valid. ## blackboard, returning [code]SUCCESS[/code]. [br]
## Returns [code]FAILURE[/code] if the target is not valid.
enum AgentSide { enum AgentSide {
CLOSEST, CLOSEST,
@ -71,4 +72,3 @@ func _tick(_delta: float) -> Status:
flank_pos = target.global_position - offset flank_pos = target.global_position - offset
blackboard.set_var(position_var, flank_pos) blackboard.set_var(position_var, flank_pos)
return SUCCESS return SUCCESS

View File

@ -1,7 +1,7 @@
@tool @tool
extends BTAction extends BTAction
## SelectRandomNearbyPos: Select a position nearby within specified range. ## Selects a random position nearby within the specified range and stores it on the blackboard. [br]
## Returns SUCCESS. ## Returns [code]SUCCESS[/code].
## Minimum distance to the desired position. ## Minimum distance to the desired position.
@export var range_min: float = 300.0 @export var range_min: float = 300.0