fix(sprint-14): guarantee _start_close_lid tween callback when lid and gift are null

This commit is contained in:
Steven Wroblewski
2026-05-11 20:11:21 +02:00
parent 14a50364f3
commit 6a5a18ca42
+5 -5
View File
@@ -63,13 +63,13 @@ func _on_lid_opened() -> void:
func _start_close_lid() -> void:
var lid: Node2D = get_node_or_null("Lid") as Node2D
var gift: Node2D = get_node_or_null("Gift") as Node2D
var tween: Tween = create_tween().set_parallel(true)
var tween: Tween = create_tween()
if lid != null:
tween.tween_property(lid, "position:y", CLOSED_LID_Y, OPEN_DURATION)
tween.tween_property(lid, "modulate:a", 1.0, OPEN_DURATION)
tween.parallel().tween_property(lid, "position:y", CLOSED_LID_Y, OPEN_DURATION)
tween.parallel().tween_property(lid, "modulate:a", 1.0, OPEN_DURATION)
if gift != null:
tween.tween_property(gift, "modulate:a", 0.0, OPEN_DURATION)
tween.finished.connect(_on_reset_complete)
tween.parallel().tween_property(gift, "modulate:a", 0.0, OPEN_DURATION)
tween.tween_callback(_on_reset_complete)
func _on_reset_complete() -> void: