From a7f00b222db0d9d9ba8e558b57f82c5d11275a88 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 28 Apr 2024 11:33:18 +0200 Subject: [PATCH] Document `SacrificeStone` --- entities/sacrifice_stone.gd | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/entities/sacrifice_stone.gd b/entities/sacrifice_stone.gd index 7fe02f4..c063b5a 100644 --- a/entities/sacrifice_stone.gd +++ b/entities/sacrifice_stone.gd @@ -2,6 +2,7 @@ extends Node2D class_name SacrificeStone +## Emitted when the sacrifice on top of the stone changes. signal sacrifice_changed(entity: PhysicsBody2D, type: Enums.MonsterType) @@ -10,10 +11,10 @@ var current_type: Enums.MonsterType = Enums.MonsterType.None func _on_tracked(body: PhysicsBody2D): + # If a monster is dragged on top of the SacrificeStone while another monster is already on top of it, ignore the capture and let the collision resolve instead if current_monster != null: - Log.w(self, "Captured two entities") return - + # Make sure the monster is sacrificable, and if it is, lock it in and emit [signal sacrifice_changed]. var types: Array = body.find_children("*", "Sacrificable", false, false) for type in types: current_monster = body @@ -21,9 +22,6 @@ func _on_tracked(body: PhysicsBody2D): sacrifice_changed.emit(current_monster, current_type) break - if current_monster == null: - Log.w(self, "Captured entity with no Sacrificable") - func _on_untracked(body: PhysicsBody2D): if body == current_monster: current_monster = null