diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIAvoidCollisions.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIAvoidCollisions.gd index dbf11ed..d42acde 100644 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIAvoidCollisions.gd +++ b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIAvoidCollisions.gd @@ -18,7 +18,7 @@ func _calculate_steering(acceleration: GSAITargetAcceleration) -> void: _first_minimum_separation = 0 _first_distance = 0 - var neighbor_count : int = proximity._find_neighbors(_callback) + var neighbor_count : int = proximity.find_neighbors(_callback) if neighbor_count == 0 or not _first_neighbor: acceleration.set_zero() diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIBlend.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIBlend.gd index 8f3306b..4d43898 100644 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIBlend.gd +++ b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIBlend.gd @@ -11,6 +11,7 @@ class_name GSAIBlend extends GSAISteeringBehavior var _behaviors : Array = Array() +#note only add a getter var _accel : GSAITargetAcceleration = GSAITargetAcceleration.new() # Appends a behavior to the internal array along with its `weight`. diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAICohesion.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAICohesion.gd index 4767529..8874f6d 100644 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAICohesion.gd +++ b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAICohesion.gd @@ -11,7 +11,7 @@ func _calculate_steering(acceleration: GSAITargetAcceleration) -> void: acceleration.set_zero() _center_of_mass = Vector3.ZERO - var neighbor_count = proximity._find_neighbors(_callback) + var neighbor_count = proximity.find_neighbors(_callback) if neighbor_count > 0: _center_of_mass *= 1.0 / neighbor_count acceleration.linear = ((_center_of_mass - agent.position).normalized() * agent.linear_acceleration_max) diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeparation.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeparation.gd index 4a0e1d5..b1dcbd4 100644 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeparation.gd +++ b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeparation.gd @@ -11,14 +11,14 @@ extends GSAIGroupBehavior # The coefficient to calculate how fast the separation strength decays with distance. var decay_coefficient : float = 1.0 -var _acceleration : GSAITargetAcceleration +var acceleration : GSAITargetAcceleration -func _calculate_steering(acceleration : GSAITargetAcceleration) -> void: +func _calculate_steering(_acceleration : GSAITargetAcceleration) -> void: acceleration.set_zero() - self._acceleration = acceleration + self.acceleration = _acceleration # warning-ignore:return_value_discarded - proximity._find_neighbors(_callback) + proximity.find_neighbors(_callback) # Callback for the proximity to call when finding neighbors. Determines the amount of @@ -34,6 +34,6 @@ func _report_neighbor(neighbor : GSAISteeringAgent) -> bool: if strength > acceleration_max: strength = acceleration_max - _acceleration.linear += to_agent * (strength / sqrt(distance_squared)) + acceleration.linear += to_agent * (strength / sqrt(distance_squared)) return true diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/GSAISteeringBehavior.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/GSAISteeringBehavior.gd index aa31863..7d03f13 100644 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/GSAISteeringBehavior.gd +++ b/godot/addons/com.gdquest.godot-steering-ai-framework/GSAISteeringBehavior.gd @@ -17,10 +17,9 @@ var agent : GSAISteeringAgent # Sets the `acceleration` with the behavior's desired amount of acceleration. func calculate_steering(acceleration: GSAITargetAcceleration) -> void: if is_enabled: - _calculate_steering(acceleration) + call("_calculate_steering", acceleration) else: acceleration.set_zero() - func _calculate_steering(acceleration: GSAITargetAcceleration) -> void: acceleration.set_zero() diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Proximities/GSAIProximity.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Proximities/GSAIProximity.gd index 16395f4..769f36d 100644 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Proximities/GSAIProximity.gd +++ b/godot/addons/com.gdquest.godot-steering-ai-framework/Proximities/GSAIProximity.gd @@ -9,6 +9,8 @@ var agent : GSAISteeringAgent # The agents who are part of this group and could be potential neighbors var agents : Array = Array() +func find_neighbors(_callback: FuncRef) -> int: + return call("_find_neighbors", _callback) # Returns a number of neighbors based on a `callback` function. #