From edbbd130dcf63ee4f98532109dc3aface83d5faf Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 14 Apr 2024 00:13:26 +0200 Subject: [PATCH] Move logging statements to separate signals --- behaviours/hunter.gd | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/behaviours/hunter.gd b/behaviours/hunter.gd index 5421a3c..3a07ac5 100644 --- a/behaviours/hunter.gd +++ b/behaviours/hunter.gd @@ -15,12 +15,17 @@ func _on_detection_area_body_entered(body: Node2D) -> void: var edibles: Array = body.find_children("Edible", "Edible", false, false) for edible in edibles: if edible.tag == tag: - Log.p(self, "Tracking a new target: %s" % body) possible_targets.push_back(body) tracked.emit(body) func _on_detection_area_body_exited(body: Node2D) -> void: if body in possible_targets: - Log.p(self, "Not tracking anymore target: %s" % body) possible_targets.erase(body) untracked.emit(body) + + +func _on_tracked(body: Node2D) -> void: + Log.p(self, "Tracking a new target: %s" % body) + +func _on_untracked(body:Node2D) -> void: + Log.p(self, "Not tracking anymore target: %s" % body)