mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2024-11-18 09:07:18 +01:00
Removed yields from the agents.
This commit is contained in:
parent
2236e48f45
commit
3957f155da
@ -24,14 +24,17 @@ var _body_ref : WeakRef
|
||||
|
||||
|
||||
func _init(_body: KinematicBody2D, _movement_type: int = MovementType.SLIDE) -> void:
|
||||
if !_body.is_inside_tree():
|
||||
yield(_body, "ready")
|
||||
|
||||
self.body = _body
|
||||
self.movement_type = _movement_type
|
||||
|
||||
if !_body.is_inside_tree():
|
||||
_body.connect("ready", self, "_body_ready")
|
||||
else:
|
||||
_body_ready()
|
||||
|
||||
func _body_ready() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
_body.get_tree().connect("physics_frame", self, "_on_SceneTree_physics_frame")
|
||||
body.get_tree().connect("physics_frame", self, "_on_SceneTree_physics_frame")
|
||||
|
||||
|
||||
# Moves the agent's `body` by target `acceleration`.
|
||||
|
@ -24,14 +24,17 @@ var _body_ref : WeakRef
|
||||
|
||||
|
||||
func _init(_body: KinematicBody, _movement_type: int = MovementType.SLIDE) -> void:
|
||||
if !_body.is_inside_tree():
|
||||
yield(_body, "ready")
|
||||
|
||||
self.body = _body
|
||||
self.movement_type = _movement_type
|
||||
|
||||
if !_body.is_inside_tree():
|
||||
_body.connect("ready", self, "_body_ready")
|
||||
else:
|
||||
_body_ready()
|
||||
|
||||
func _body_ready() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
_body.get_tree().connect("physics_frame", self, "_on_SceneTree_physics_frame")
|
||||
body.get_tree().connect("physics_frame", self, "_on_SceneTree_physics_frame")
|
||||
|
||||
|
||||
# Moves the agent's `body` by target `acceleration`.
|
||||
|
@ -12,12 +12,16 @@ var _body_ref : WeakRef
|
||||
|
||||
|
||||
func _init(_body : RigidBody2D) -> void:
|
||||
if not _body.is_inside_tree():
|
||||
yield(_body, "ready")
|
||||
self.body = _body
|
||||
|
||||
if !_body.is_inside_tree():
|
||||
_body.connect("ready", self, "_body_ready")
|
||||
else:
|
||||
_body_ready()
|
||||
|
||||
func _body_ready() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
_body.get_tree().connect("physics_frame", self, "_on_SceneTree_frame")
|
||||
body.get_tree().connect("physics_frame", self, "_on_SceneTree_frame")
|
||||
|
||||
|
||||
# Moves the agent's `body` by target `acceleration`.
|
||||
|
@ -11,12 +11,16 @@ var _last_position: Vector3
|
||||
var _body_ref: WeakRef
|
||||
|
||||
func _init(_body: RigidBody) -> void:
|
||||
if not _body.is_inside_tree():
|
||||
yield(_body, "ready")
|
||||
self.body = _body
|
||||
|
||||
if !_body.is_inside_tree():
|
||||
_body.connect("ready", self, "_body_ready")
|
||||
else:
|
||||
_body_ready()
|
||||
|
||||
func _body_ready() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
_body.get_tree().connect("physics_frame", self, "_on_SceneTree_frame")
|
||||
body.get_tree().connect("physics_frame", self, "_on_SceneTree_frame")
|
||||
|
||||
|
||||
# Moves the agent's `body` by target `acceleration`.
|
||||
|
Loading…
Reference in New Issue
Block a user