From f615a183eac3982a6fe365c38c5596253ef70dcb Mon Sep 17 00:00:00 2001 From: Josh Anthony Date: Tue, 14 Dec 2021 11:34:27 -0600 Subject: [PATCH] Stop agents from processing if the scene tree is paused (#57) --- .../Agents/GSAIKinematicBody2DAgent.gd | 2 +- .../Agents/GSAIKinematicBody3DAgent.gd | 2 +- .../Agents/GSAIRigidBody2DAgent.gd | 2 +- .../Agents/GSAIRigidBody3DAgent.gd | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIKinematicBody2DAgent.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIKinematicBody2DAgent.gd index c422e8f..c478318 100644 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIKinematicBody2DAgent.gd +++ b/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIKinematicBody2DAgent.gd @@ -50,7 +50,7 @@ func _apply_sliding_steering(accel: Vector3, delta: float) -> void: if not _body: return - if not _body.is_inside_tree(): + if not _body.is_inside_tree() or _body.get_tree().paused: return var velocity := GSAIUtils.to_vector2(linear_velocity + accel * delta).clamped(linear_speed_max) diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIKinematicBody3DAgent.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIKinematicBody3DAgent.gd index ddc556b..0b25b3a 100644 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIKinematicBody3DAgent.gd +++ b/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIKinematicBody3DAgent.gd @@ -132,7 +132,7 @@ func _on_SceneTree_physics_frame() -> void: if not _body: return - if not _body.is_inside_tree(): + if not _body.is_inside_tree() or _body.get_tree().paused: return var current_position := _body.transform.origin diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIRigidBody2DAgent.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIRigidBody2DAgent.gd index 763ae65..d758010 100644 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIRigidBody2DAgent.gd +++ b/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIRigidBody2DAgent.gd @@ -51,7 +51,7 @@ func _on_SceneTree_frame() -> void: if not _body: return - if not _body.is_inside_tree(): + if not _body.is_inside_tree() or _body.get_tree().paused: return var current_position := _body.global_position diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIRigidBody3DAgent.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIRigidBody3DAgent.gd index bc26959..35a1e96 100644 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIRigidBody3DAgent.gd +++ b/godot/addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIRigidBody3DAgent.gd @@ -50,7 +50,7 @@ func _on_SceneTree_frame() -> void: if not _body: return - if not _body.is_inside_tree(): + if not _body.is_inside_tree() or _body.get_tree().paused: return var current_position := _body.transform.origin