mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2024-11-10 00:52:10 +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
|
||||
# not have to using a KinematicBody2D
|
||||
# category: Specialized agents
|
||||
# @category - Specialized agents
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIKinematicBody2DAgent
|
||||
|
||||
@ -31,7 +31,7 @@ func _init(_body: KinematicBody2D, _movement_type: int = MovementType.SLIDE) ->
|
||||
|
||||
|
||||
# Moves the agent's `body` by target `acceleration`.
|
||||
# tags: virtual
|
||||
# @tags - virtual
|
||||
func _apply_steering(acceleration: GSAITargetAcceleration, delta: float) -> void:
|
||||
_applied_steering = true
|
||||
match movement_type:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# A specialized steering agent that updates itself every frame so the user does
|
||||
# not have to using a KinematicBody
|
||||
# category: Specialized agents
|
||||
# @category - Specialized agents
|
||||
extends GSAISpecializedAgent
|
||||
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`.
|
||||
# tags: virtual
|
||||
# @tags - virtual
|
||||
func _apply_steering(acceleration: GSAITargetAcceleration, delta: float) -> void:
|
||||
_applied_steering = true
|
||||
match movement_type:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# A specialized steering agent that updates itself every frame so the user does
|
||||
# not have to using a RigidBody2D
|
||||
# category: Specialized agents
|
||||
# @category - Specialized agents
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIRigidBody2DAgent
|
||||
|
||||
@ -21,7 +21,7 @@ func _init(_body: RigidBody2D) -> void:
|
||||
|
||||
|
||||
# Moves the agent's `body` by target `acceleration`.
|
||||
# tags: virtual
|
||||
# @tags - virtual
|
||||
func _apply_steering(acceleration: GSAITargetAcceleration, _delta: float) -> void:
|
||||
var _body: RigidBody2D = _body_ref.get_ref()
|
||||
if not _body:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# A specialized steering agent that updates itself every frame so the user does
|
||||
# not have to using a RigidBody
|
||||
# category: Specialized agents
|
||||
# @category - Specialized agents
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIRigidBody3DAgent
|
||||
|
||||
@ -20,7 +20,7 @@ func _init(_body: RigidBody) -> void:
|
||||
|
||||
|
||||
# Moves the agent's `body` by target `acceleration`.
|
||||
# tags: virtual
|
||||
# @tags - virtual
|
||||
func _apply_steering(acceleration: GSAITargetAcceleration, _delta: float) -> void:
|
||||
var _body: RigidBody = _body_ref.get_ref()
|
||||
if not _body:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# 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.
|
||||
# category: Specialized agents
|
||||
# tags: abstract
|
||||
# @category - Specialized agents
|
||||
# @tags - abstract
|
||||
extends GSAISteeringAgent
|
||||
class_name GSAISpecializedAgent
|
||||
|
||||
@ -34,6 +34,6 @@ var _applied_steering := false
|
||||
|
||||
|
||||
# Moves the agent's body by target `acceleration`.
|
||||
# tags: virtual
|
||||
# @tags - virtual
|
||||
func _apply_steering(_acceleration: GSAITargetAcceleration, _delta: float) -> void:
|
||||
pass
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Calculates acceleration to take an agent to its target's location. The
|
||||
# calculation attempts to arrive with zero remaining velocity.
|
||||
# category: Individual behaviors
|
||||
# @category - Individual behaviors
|
||||
class_name GSAIArrive
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Steers the agent to avoid obstacles in its path. Approximates obstacles as
|
||||
# spheres.
|
||||
# category: Group behaviors
|
||||
# @category - Group behaviors
|
||||
class_name GSAIAvoidCollisions
|
||||
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`
|
||||
# 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:
|
||||
var relative_position := neighbor.position - agent.position
|
||||
var relative_velocity := neighbor.linear_velocity - agent.linear_velocity
|
||||
|
@ -6,7 +6,7 @@
|
||||
# behavior : GSAISteeringBehavior,
|
||||
# weight : float
|
||||
# }
|
||||
# category: Combination behaviors
|
||||
# @category - Combination behaviors
|
||||
class_name GSAIBlend
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Calculates an acceleration that attempts to move the agent towards the center
|
||||
# of mass of the agents in the area defined by the `GSAIProximity`.
|
||||
# category: Group behaviors
|
||||
# @category - Group behaviors
|
||||
class_name GSAICohesion
|
||||
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
|
||||
# to the center of mass of the group.
|
||||
# tags: virtual
|
||||
# @tags - virtual
|
||||
func _report_neighbor(neighbor: GSAISteeringAgent) -> bool:
|
||||
_center_of_mass += neighbor.position
|
||||
return true
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Calculates acceleration to take an agent away from where a target agent is
|
||||
# moving.
|
||||
# category: Individual behaviors
|
||||
# @category - Individual behaviors
|
||||
class_name GSAIEvade
|
||||
extends GSAIPursue
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Calculates angular acceleration to rotate a target to face its target's
|
||||
# position. The behavior attemps to arrive with zero remaining angular velocity.
|
||||
# category: Individual behaviors
|
||||
# @category - Individual behaviors
|
||||
class_name GSAIFace
|
||||
extends GSAIMatchOrientation
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Calculates acceleration to take an agent directly away from a target agent.
|
||||
# category: Individual behaviors
|
||||
# @category - Individual behaviors
|
||||
class_name GSAIFlee
|
||||
extends GSAISeek
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Produces a linear acceleration that moves the agent along the specified path.
|
||||
# category: Individual behaviors
|
||||
# @category - Individual behaviors
|
||||
class_name GSAIFollowPath
|
||||
extends GSAIArrive
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Calculates an angular acceleration to match an agent's orientation to its
|
||||
# direction of travel.
|
||||
# category: Individual behaviors
|
||||
# @category - Individual behaviors
|
||||
class_name GSAILookWhereYouGo
|
||||
extends GSAIMatchOrientation
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# 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
|
||||
# velocity.
|
||||
# category: Individual behaviors
|
||||
# @category - Individual behaviors
|
||||
class_name GSAIMatchOrientation
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Container for multiple behaviors that returns the result of the first child
|
||||
# behavior with non-zero acceleration.
|
||||
# category: Combination behaviors
|
||||
# @category - Combination behaviors
|
||||
class_name GSAIPriority
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Calculates an acceleration to make an agent intercept another based on the
|
||||
# target agent's movement.
|
||||
# category: Individual behaviors
|
||||
# @category - Individual behaviors
|
||||
class_name GSAIPursue
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Calculates an acceleration to take an agent to a target agent's position
|
||||
# directly.
|
||||
# category: Individual behaviors
|
||||
# @category - Individual behaviors
|
||||
class_name GSAISeek
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
# 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
|
||||
# accumulates.
|
||||
# category: Group behaviors
|
||||
# @category - Group behaviors
|
||||
class_name GSAISeparation
|
||||
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
|
||||
# acceleration that `neighbor` imposes based on its distance from the owner agent.
|
||||
# tags: virtual
|
||||
# @tags - virtual
|
||||
func _report_neighbor(neighbor: GSAISteeringAgent) -> bool:
|
||||
var to_agent := agent.position - neighbor.position
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Represents an agent with only a location and an orientation.
|
||||
# category: Base types
|
||||
# @category - Base types
|
||||
class_name GSAIAgentLocation
|
||||
|
||||
# The agent's position in space.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base type for group-based steering behaviors.
|
||||
# category: Base types
|
||||
# @category - Base types
|
||||
class_name GSAIGroupBehavior
|
||||
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
|
||||
# relevant
|
||||
# tags: virtual
|
||||
# @tags - virtual
|
||||
func _report_neighbor(_neighbor: GSAISteeringAgent) -> bool:
|
||||
return false
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Represents a path made up of Vector3 waypoints, split into segments path
|
||||
# follow behaviors can use.
|
||||
# category: Base types
|
||||
# @category - Base types
|
||||
class_name GSAIPath
|
||||
extends Reference
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# It is the character's responsibility to keep this information up to date for
|
||||
# the steering toolkit to work correctly.
|
||||
# category: Base types
|
||||
# @category - Base types
|
||||
extends GSAIAgentLocation
|
||||
class_name GSAISteeringAgent
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
# The `calculate_steering` function is the entry point for all behaviors.
|
||||
# Individual steering behaviors encapsulate the steering logic.
|
||||
# category: Base types
|
||||
# @category - Base types
|
||||
class_name GSAISteeringBehavior
|
||||
|
||||
# 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
|
||||
# system.
|
||||
# category: Base types
|
||||
# @category - Base types
|
||||
class_name GSAITargetAcceleration
|
||||
|
||||
# Linear acceleration
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Math and vector utility functions.
|
||||
# Category: Utilities
|
||||
# @Category - Utilities
|
||||
class_name GSAIUtils
|
||||
|
||||
# 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
|
||||
# owner agent, regardless of distance.
|
||||
# category: Proximities
|
||||
# @category - Proximities
|
||||
extends GSAIProximity
|
||||
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
|
||||
# adds one to the count if its `callback` returns true.
|
||||
# tags: virtual
|
||||
# @tags - virtual
|
||||
func _find_neighbors(callback: FuncRef) -> int:
|
||||
var neighbor_count := 0
|
||||
var agent_count := agents.size()
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Base container type that stores data to find the neighbors of an agent.
|
||||
# category: Proximities
|
||||
# tags: abstract
|
||||
# @category - Proximities
|
||||
# @tags - abstract
|
||||
extends Reference
|
||||
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
|
||||
# adds one to the count if its `callback` returns true.
|
||||
# tags: virtual
|
||||
# @tags - virtual
|
||||
func _find_neighbors(_callback: FuncRef) -> int:
|
||||
return 0
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Determines any agent that is in the specified list as being neighbors with the owner agent if
|
||||
# they lie within the specified radius.
|
||||
# category: Proximities
|
||||
# @category - Proximities
|
||||
extends GSAIProximity
|
||||
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
|
||||
# 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:
|
||||
var agent_count := agents.size()
|
||||
var neighbor_count := 0
|
||||
|
Loading…
Reference in New Issue
Block a user