Преглед на файлове

:beetle: Fix already connected signal

DricomDragon преди 1 седмица
родител
ревизия
2ae477450f
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  1. 6 0
      godot/component/entity/collectibles/chocolate/chocolate.gd

+ 6 - 0
godot/component/entity/collectibles/chocolate/chocolate.gd

@@ -6,10 +6,16 @@ const COLLECT_ANIM := "collection"
 
 @onready var chocolateAnimation: AnimationPlayer = $ChocolateAnimation
 
+var _collected := false
+
 
 func _on_chocolate_tablet_body_entered(body: Node3D) -> void:
+	if _collected:
+		return
+
 	if body is Walker:
 		_give_chocolate_to(body)
+		_collected = true
 
 
 func _give_chocolate_to(walker: Walker) -> void: