mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2024-11-14 04:57:19 +01:00
Update doc-comments to use JSDoc style
This commit is contained in:
parent
89e4dc4c2b
commit
a2d0258ff1
@ -1,6 +1,6 @@
|
|||||||
# A specialized steering agent that updates itself every frame so the user does
|
# A specialized steering agent that updates itself every frame so the user does
|
||||||
# not have to using a KinematicBody2D
|
# not have to using a KinematicBody2D
|
||||||
# category: Specialized agents
|
# @category - Specialized agents
|
||||||
extends GSAISpecializedAgent
|
extends GSAISpecializedAgent
|
||||||
class_name GSAIKinematicBody2DAgent
|
class_name GSAIKinematicBody2DAgent
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ func _init(_body: KinematicBody2D, _movement_type: int = MovementType.SLIDE) ->
|
|||||||
|
|
||||||
|
|
||||||
# Moves the agent's `body` by target `acceleration`.
|
# Moves the agent's `body` by target `acceleration`.
|
||||||
# tags: virtual
|
# @tags - virtual
|
||||||
func _apply_steering(acceleration: GSAITargetAcceleration, delta: float) -> void:
|
func _apply_steering(acceleration: GSAITargetAcceleration, delta: float) -> void:
|
||||||
_applied_steering = true
|
_applied_steering = true
|
||||||
match movement_type:
|
match movement_type:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# A specialized steering agent that updates itself every frame so the user does
|
# A specialized steering agent that updates itself every frame so the user does
|
||||||
# not have to using a KinematicBody
|
# not have to using a KinematicBody
|
||||||
# category: Specialized agents
|
# @category - Specialized agents
|
||||||
extends GSAISpecializedAgent
|
extends GSAISpecializedAgent
|
||||||
class_name GSAIKinematicBody3DAgent
|
class_name GSAIKinematicBody3DAgent
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ func _init(_body: KinematicBody, _movement_type: int = MovementType.SLIDE) -> vo
|
|||||||
|
|
||||||
|
|
||||||
# Moves the agent's `body` by target `acceleration`.
|
# Moves the agent's `body` by target `acceleration`.
|
||||||
# tags: virtual
|
# @tags - virtual
|
||||||
func _apply_steering(acceleration: GSAITargetAcceleration, delta: float) -> void:
|
func _apply_steering(acceleration: GSAITargetAcceleration, delta: float) -> void:
|
||||||
_applied_steering = true
|
_applied_steering = true
|
||||||
match movement_type:
|
match movement_type:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# A specialized steering agent that updates itself every frame so the user does
|
# A specialized steering agent that updates itself every frame so the user does
|
||||||
# not have to using a RigidBody2D
|
# not have to using a RigidBody2D
|
||||||
# category: Specialized agents
|
# @category - Specialized agents
|
||||||
extends GSAISpecializedAgent
|
extends GSAISpecializedAgent
|
||||||
class_name GSAIRigidBody2DAgent
|
class_name GSAIRigidBody2DAgent
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ func _init(_body: RigidBody2D) -> void:
|
|||||||
|
|
||||||
|
|
||||||
# Moves the agent's `body` by target `acceleration`.
|
# Moves the agent's `body` by target `acceleration`.
|
||||||
# tags: virtual
|
# @tags - virtual
|
||||||
func _apply_steering(acceleration: GSAITargetAcceleration, _delta: float) -> void:
|
func _apply_steering(acceleration: GSAITargetAcceleration, _delta: float) -> void:
|
||||||
var _body: RigidBody2D = _body_ref.get_ref()
|
var _body: RigidBody2D = _body_ref.get_ref()
|
||||||
if not _body:
|
if not _body:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# A specialized steering agent that updates itself every frame so the user does
|
# A specialized steering agent that updates itself every frame so the user does
|
||||||
# not have to using a RigidBody
|
# not have to using a RigidBody
|
||||||
# category: Specialized agents
|
# @category - Specialized agents
|
||||||
extends GSAISpecializedAgent
|
extends GSAISpecializedAgent
|
||||||
class_name GSAIRigidBody3DAgent
|
class_name GSAIRigidBody3DAgent
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ func _init(_body: RigidBody) -> void:
|
|||||||
|
|
||||||
|
|
||||||
# Moves the agent's `body` by target `acceleration`.
|
# Moves the agent's `body` by target `acceleration`.
|
||||||
# tags: virtual
|
# @tags - virtual
|
||||||
func _apply_steering(acceleration: GSAITargetAcceleration, _delta: float) -> void:
|
func _apply_steering(acceleration: GSAITargetAcceleration, _delta: float) -> void:
|
||||||
var _body: RigidBody = _body_ref.get_ref()
|
var _body: RigidBody = _body_ref.get_ref()
|
||||||
if not _body:
|
if not _body:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# A base class for a specialized steering agent that updates itself every frame
|
# A base class for a specialized steering agent that updates itself every frame
|
||||||
# so the user does not have to. All other specialized agents derive from this.
|
# so the user does not have to. All other specialized agents derive from this.
|
||||||
# category: Specialized agents
|
# @category - Specialized agents
|
||||||
# tags: abstract
|
# @tags - abstract
|
||||||
extends GSAISteeringAgent
|
extends GSAISteeringAgent
|
||||||
class_name GSAISpecializedAgent
|
class_name GSAISpecializedAgent
|
||||||
|
|
||||||
@ -34,6 +34,6 @@ var _applied_steering := false
|
|||||||
|
|
||||||
|
|
||||||
# Moves the agent's body by target `acceleration`.
|
# Moves the agent's body by target `acceleration`.
|
||||||
# tags: virtual
|
# @tags - virtual
|
||||||
func _apply_steering(_acceleration: GSAITargetAcceleration, _delta: float) -> void:
|
func _apply_steering(_acceleration: GSAITargetAcceleration, _delta: float) -> void:
|
||||||
pass
|
pass
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Calculates acceleration to take an agent to its target's location. The
|
# Calculates acceleration to take an agent to its target's location. The
|
||||||
# calculation attempts to arrive with zero remaining velocity.
|
# calculation attempts to arrive with zero remaining velocity.
|
||||||
# category: Individual behaviors
|
# @category - Individual behaviors
|
||||||
class_name GSAIArrive
|
class_name GSAIArrive
|
||||||
extends GSAISteeringBehavior
|
extends GSAISteeringBehavior
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Steers the agent to avoid obstacles in its path. Approximates obstacles as
|
# Steers the agent to avoid obstacles in its path. Approximates obstacles as
|
||||||
# spheres.
|
# spheres.
|
||||||
# category: Group behaviors
|
# @category - Group behaviors
|
||||||
class_name GSAIAvoidCollisions
|
class_name GSAIAvoidCollisions
|
||||||
extends GSAIGroupBehavior
|
extends GSAIGroupBehavior
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
|||||||
|
|
||||||
# Callback for the proximity to call when finding neighbors. Keeps track of every `neighbor`
|
# Callback for the proximity to call when finding neighbors. Keeps track of every `neighbor`
|
||||||
# that was found but only keeps the one the owning agent will most likely collide with.
|
# that was found but only keeps the one the owning agent will most likely collide with.
|
||||||
# tags: virtual
|
# @tags - virtual
|
||||||
func _report_neighbor(neighbor: GSAISteeringAgent) -> bool:
|
func _report_neighbor(neighbor: GSAISteeringAgent) -> bool:
|
||||||
var relative_position := neighbor.position - agent.position
|
var relative_position := neighbor.position - agent.position
|
||||||
var relative_velocity := neighbor.linear_velocity - agent.linear_velocity
|
var relative_velocity := neighbor.linear_velocity - agent.linear_velocity
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
# behavior : GSAISteeringBehavior,
|
# behavior : GSAISteeringBehavior,
|
||||||
# weight : float
|
# weight : float
|
||||||
# }
|
# }
|
||||||
# category: Combination behaviors
|
# @category - Combination behaviors
|
||||||
class_name GSAIBlend
|
class_name GSAIBlend
|
||||||
extends GSAISteeringBehavior
|
extends GSAISteeringBehavior
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Calculates an acceleration that attempts to move the agent towards the center
|
# Calculates an acceleration that attempts to move the agent towards the center
|
||||||
# of mass of the agents in the area defined by the `GSAIProximity`.
|
# of mass of the agents in the area defined by the `GSAIProximity`.
|
||||||
# category: Group behaviors
|
# @category - Group behaviors
|
||||||
class_name GSAICohesion
|
class_name GSAICohesion
|
||||||
extends GSAIGroupBehavior
|
extends GSAIGroupBehavior
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
|||||||
|
|
||||||
# Callback for the proximity to call when finding neighbors. Adds `neighbor`'s position
|
# Callback for the proximity to call when finding neighbors. Adds `neighbor`'s position
|
||||||
# to the center of mass of the group.
|
# to the center of mass of the group.
|
||||||
# tags: virtual
|
# @tags - virtual
|
||||||
func _report_neighbor(neighbor: GSAISteeringAgent) -> bool:
|
func _report_neighbor(neighbor: GSAISteeringAgent) -> bool:
|
||||||
_center_of_mass += neighbor.position
|
_center_of_mass += neighbor.position
|
||||||
return true
|
return true
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Calculates acceleration to take an agent away from where a target agent is
|
# Calculates acceleration to take an agent away from where a target agent is
|
||||||
# moving.
|
# moving.
|
||||||
# category: Individual behaviors
|
# @category - Individual behaviors
|
||||||
class_name GSAIEvade
|
class_name GSAIEvade
|
||||||
extends GSAIPursue
|
extends GSAIPursue
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Calculates angular acceleration to rotate a target to face its target's
|
# Calculates angular acceleration to rotate a target to face its target's
|
||||||
# position. The behavior attemps to arrive with zero remaining angular velocity.
|
# position. The behavior attemps to arrive with zero remaining angular velocity.
|
||||||
# category: Individual behaviors
|
# @category - Individual behaviors
|
||||||
class_name GSAIFace
|
class_name GSAIFace
|
||||||
extends GSAIMatchOrientation
|
extends GSAIMatchOrientation
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Calculates acceleration to take an agent directly away from a target agent.
|
# Calculates acceleration to take an agent directly away from a target agent.
|
||||||
# category: Individual behaviors
|
# @category - Individual behaviors
|
||||||
class_name GSAIFlee
|
class_name GSAIFlee
|
||||||
extends GSAISeek
|
extends GSAISeek
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Produces a linear acceleration that moves the agent along the specified path.
|
# Produces a linear acceleration that moves the agent along the specified path.
|
||||||
# category: Individual behaviors
|
# @category - Individual behaviors
|
||||||
class_name GSAIFollowPath
|
class_name GSAIFollowPath
|
||||||
extends GSAIArrive
|
extends GSAIArrive
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Calculates an angular acceleration to match an agent's orientation to its
|
# Calculates an angular acceleration to match an agent's orientation to its
|
||||||
# direction of travel.
|
# direction of travel.
|
||||||
# category: Individual behaviors
|
# @category - Individual behaviors
|
||||||
class_name GSAILookWhereYouGo
|
class_name GSAILookWhereYouGo
|
||||||
extends GSAIMatchOrientation
|
extends GSAIMatchOrientation
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Calculates an angular acceleration to match an agent's orientation to that of
|
# Calculates an angular acceleration to match an agent's orientation to that of
|
||||||
# its target. Attempts to make the agent arrive with zero remaining angular
|
# its target. Attempts to make the agent arrive with zero remaining angular
|
||||||
# velocity.
|
# velocity.
|
||||||
# category: Individual behaviors
|
# @category - Individual behaviors
|
||||||
class_name GSAIMatchOrientation
|
class_name GSAIMatchOrientation
|
||||||
extends GSAISteeringBehavior
|
extends GSAISteeringBehavior
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Container for multiple behaviors that returns the result of the first child
|
# Container for multiple behaviors that returns the result of the first child
|
||||||
# behavior with non-zero acceleration.
|
# behavior with non-zero acceleration.
|
||||||
# category: Combination behaviors
|
# @category - Combination behaviors
|
||||||
class_name GSAIPriority
|
class_name GSAIPriority
|
||||||
extends GSAISteeringBehavior
|
extends GSAISteeringBehavior
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Calculates an acceleration to make an agent intercept another based on the
|
# Calculates an acceleration to make an agent intercept another based on the
|
||||||
# target agent's movement.
|
# target agent's movement.
|
||||||
# category: Individual behaviors
|
# @category - Individual behaviors
|
||||||
class_name GSAIPursue
|
class_name GSAIPursue
|
||||||
extends GSAISteeringBehavior
|
extends GSAISteeringBehavior
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Calculates an acceleration to take an agent to a target agent's position
|
# Calculates an acceleration to take an agent to a target agent's position
|
||||||
# directly.
|
# directly.
|
||||||
# category: Individual behaviors
|
# @category - Individual behaviors
|
||||||
class_name GSAISeek
|
class_name GSAISeek
|
||||||
extends GSAISteeringBehavior
|
extends GSAISteeringBehavior
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# The acceleration is an average based on all neighbors, multiplied by a
|
# The acceleration is an average based on all neighbors, multiplied by a
|
||||||
# strength decreasing by the inverse square law in relation to distance, and it
|
# strength decreasing by the inverse square law in relation to distance, and it
|
||||||
# accumulates.
|
# accumulates.
|
||||||
# category: Group behaviors
|
# @category - Group behaviors
|
||||||
class_name GSAISeparation
|
class_name GSAISeparation
|
||||||
extends GSAIGroupBehavior
|
extends GSAIGroupBehavior
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
|||||||
|
|
||||||
# Callback for the proximity to call when finding neighbors. Determines the amount of
|
# Callback for the proximity to call when finding neighbors. Determines the amount of
|
||||||
# acceleration that `neighbor` imposes based on its distance from the owner agent.
|
# acceleration that `neighbor` imposes based on its distance from the owner agent.
|
||||||
# tags: virtual
|
# @tags - virtual
|
||||||
func _report_neighbor(neighbor: GSAISteeringAgent) -> bool:
|
func _report_neighbor(neighbor: GSAISteeringAgent) -> bool:
|
||||||
var to_agent := agent.position - neighbor.position
|
var to_agent := agent.position - neighbor.position
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Represents an agent with only a location and an orientation.
|
# Represents an agent with only a location and an orientation.
|
||||||
# category: Base types
|
# @category - Base types
|
||||||
class_name GSAIAgentLocation
|
class_name GSAIAgentLocation
|
||||||
|
|
||||||
# The agent's position in space.
|
# The agent's position in space.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base type for group-based steering behaviors.
|
# Base type for group-based steering behaviors.
|
||||||
# category: Base types
|
# @category - Base types
|
||||||
class_name GSAIGroupBehavior
|
class_name GSAIGroupBehavior
|
||||||
extends GSAISteeringBehavior
|
extends GSAISteeringBehavior
|
||||||
|
|
||||||
@ -15,6 +15,6 @@ func _init(agent: GSAISteeringAgent, _proximity: GSAIProximity).(agent) -> void:
|
|||||||
|
|
||||||
# Internal callback for the behavior to define whether or not a member is
|
# Internal callback for the behavior to define whether or not a member is
|
||||||
# relevant
|
# relevant
|
||||||
# tags: virtual
|
# @tags - virtual
|
||||||
func _report_neighbor(_neighbor: GSAISteeringAgent) -> bool:
|
func _report_neighbor(_neighbor: GSAISteeringAgent) -> bool:
|
||||||
return false
|
return false
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Represents a path made up of Vector3 waypoints, split into segments path
|
# Represents a path made up of Vector3 waypoints, split into segments path
|
||||||
# follow behaviors can use.
|
# follow behaviors can use.
|
||||||
# category: Base types
|
# @category - Base types
|
||||||
class_name GSAIPath
|
class_name GSAIPath
|
||||||
extends Reference
|
extends Reference
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# It is the character's responsibility to keep this information up to date for
|
# It is the character's responsibility to keep this information up to date for
|
||||||
# the steering toolkit to work correctly.
|
# the steering toolkit to work correctly.
|
||||||
# category: Base types
|
# @category - Base types
|
||||||
extends GSAIAgentLocation
|
extends GSAIAgentLocation
|
||||||
class_name GSAISteeringAgent
|
class_name GSAISteeringAgent
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# The `calculate_steering` function is the entry point for all behaviors.
|
# The `calculate_steering` function is the entry point for all behaviors.
|
||||||
# Individual steering behaviors encapsulate the steering logic.
|
# Individual steering behaviors encapsulate the steering logic.
|
||||||
# category: Base types
|
# @category - Base types
|
||||||
class_name GSAISteeringBehavior
|
class_name GSAISteeringBehavior
|
||||||
|
|
||||||
# If `false`, all calculations return zero amounts of acceleration.
|
# If `false`, all calculations return zero amounts of acceleration.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# A desired linear and angular amount of acceleration requested by the steering
|
# A desired linear and angular amount of acceleration requested by the steering
|
||||||
# system.
|
# system.
|
||||||
# category: Base types
|
# @category - Base types
|
||||||
class_name GSAITargetAcceleration
|
class_name GSAITargetAcceleration
|
||||||
|
|
||||||
# Linear acceleration
|
# Linear acceleration
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Math and vector utility functions.
|
# Math and vector utility functions.
|
||||||
# Category: Utilities
|
# @Category - Utilities
|
||||||
class_name GSAIUtils
|
class_name GSAIUtils
|
||||||
|
|
||||||
# Returns the `vector` with its length capped to `limit`.
|
# Returns the `vector` with its length capped to `limit`.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Determines any agent that is in the specified list as being neighbors with the
|
# Determines any agent that is in the specified list as being neighbors with the
|
||||||
# owner agent, regardless of distance.
|
# owner agent, regardless of distance.
|
||||||
# category: Proximities
|
# @category - Proximities
|
||||||
extends GSAIProximity
|
extends GSAIProximity
|
||||||
class_name GSAIInfiniteProximity
|
class_name GSAIInfiniteProximity
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ func _init(agent: GSAISteeringAgent, agents: Array).(agent, agents) -> void:
|
|||||||
#
|
#
|
||||||
# `_find_neighbors` calls `callback` for each agent in the `agents` array and
|
# `_find_neighbors` calls `callback` for each agent in the `agents` array and
|
||||||
# adds one to the count if its `callback` returns true.
|
# adds one to the count if its `callback` returns true.
|
||||||
# tags: virtual
|
# @tags - virtual
|
||||||
func _find_neighbors(callback: FuncRef) -> int:
|
func _find_neighbors(callback: FuncRef) -> int:
|
||||||
var neighbor_count := 0
|
var neighbor_count := 0
|
||||||
var agent_count := agents.size()
|
var agent_count := agents.size()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Base container type that stores data to find the neighbors of an agent.
|
# Base container type that stores data to find the neighbors of an agent.
|
||||||
# category: Proximities
|
# @category - Proximities
|
||||||
# tags: abstract
|
# @tags - abstract
|
||||||
extends Reference
|
extends Reference
|
||||||
class_name GSAIProximity
|
class_name GSAIProximity
|
||||||
|
|
||||||
@ -19,6 +19,6 @@ func _init(_agent: GSAISteeringAgent, _agents: Array) -> void:
|
|||||||
#
|
#
|
||||||
# `_find_neighbors` calls `callback` for each agent in the `agents` array and
|
# `_find_neighbors` calls `callback` for each agent in the `agents` array and
|
||||||
# adds one to the count if its `callback` returns true.
|
# adds one to the count if its `callback` returns true.
|
||||||
# tags: virtual
|
# @tags - virtual
|
||||||
func _find_neighbors(_callback: FuncRef) -> int:
|
func _find_neighbors(_callback: FuncRef) -> int:
|
||||||
return 0
|
return 0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Determines any agent that is in the specified list as being neighbors with the owner agent if
|
# Determines any agent that is in the specified list as being neighbors with the owner agent if
|
||||||
# they lie within the specified radius.
|
# they lie within the specified radius.
|
||||||
# category: Proximities
|
# @category - Proximities
|
||||||
extends GSAIProximity
|
extends GSAIProximity
|
||||||
class_name GSAIRadiusProximity
|
class_name GSAIRadiusProximity
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ func _init(agent: GSAISteeringAgent, agents: Array, _radius: float).(agent, agen
|
|||||||
#
|
#
|
||||||
# `_find_neighbors` calls `callback` for each agent in the `agents` array that lie within
|
# `_find_neighbors` calls `callback` for each agent in the `agents` array that lie within
|
||||||
# the radius around the owning agent and adds one to the count if its `callback` returns true.
|
# the radius around the owning agent and adds one to the count if its `callback` returns true.
|
||||||
# tags: virtual
|
# @tags - virtual
|
||||||
func _find_neighbors(callback: FuncRef) -> int:
|
func _find_neighbors(callback: FuncRef) -> int:
|
||||||
var agent_count := agents.size()
|
var agent_count := agents.size()
|
||||||
var neighbor_count := 0
|
var neighbor_count := 0
|
||||||
|
Loading…
Reference in New Issue
Block a user