From ad64a118cc1bddad0b6ab7b01bca4bd59ee90608 Mon Sep 17 00:00:00 2001 From: betalars Date: Fri, 28 Mar 2025 18:20:21 +0100 Subject: [PATCH] prevent intro from being played while draeven text is finished and not skipped to avoid illegal animation state --- .../youth_room/scnees/scene_player.gd | 2 ++ src/base-environments/youth_room/youth_room.tscn | 10 +++++++++- src/logic-scenes/board/empty_sticky_note_panel.gd | 11 ++++++++--- src/logic-scenes/board/sticky-note.gd | 8 ++++++-- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/base-environments/youth_room/scnees/scene_player.gd b/src/base-environments/youth_room/scnees/scene_player.gd index dbcdaf2..35b6d05 100644 --- a/src/base-environments/youth_room/scnees/scene_player.gd +++ b/src/base-environments/youth_room/scnees/scene_player.gd @@ -120,9 +120,11 @@ func trigger_intro(): intro.emit() intro_triggered = true +var was_skipped = false func skip_text(): if not animation_complete: animation_player.stop(true) + was_skipped = true text_finished.emit() func _on_text_finished(): diff --git a/src/base-environments/youth_room/youth_room.tscn b/src/base-environments/youth_room/youth_room.tscn index a6f192a..989dd6e 100644 --- a/src/base-environments/youth_room/youth_room.tscn +++ b/src/base-environments/youth_room/youth_room.tscn @@ -783,7 +783,7 @@ func _ready() -> void: $childhood.finished.connect(on_childhood_done) $JuiJutsu.finished.connect(on_jui_jutsu_done) $voice_training.finished.connect(on_voice_training_done) - $draven.intro.connect(func(): play(\"intro\")) + $draven.intro.connect(try_intro) for id in range(Scenes.id.YOUTH_DRAEVEN, Scenes.id.YOUTH_JUI_JUTSU+1): Scenes.sign_up_for_sequence(play_scene, id, 0) @@ -831,8 +831,16 @@ func on_draeven_done(): Scenes.continue_sequence(self) $draven.hide() +func try_intro(): + if $draven.was_skipped: + play(\"intro\") + func scene_finished(_id: int, _repeat: bool): queue(\"RESET\") + +func play(anin_name: StringName = \"\", a: float = -1, b: float = 1, c: bool = false) -> void: + print(\"anim player accessed!\") + super.play(anin_name, a, b, c) " [sub_resource type="BoxShape3D" id="BoxShape3D_cb3g8"] diff --git a/src/logic-scenes/board/empty_sticky_note_panel.gd b/src/logic-scenes/board/empty_sticky_note_panel.gd index 123e8e0..b8da04a 100644 --- a/src/logic-scenes/board/empty_sticky_note_panel.gd +++ b/src/logic-scenes/board/empty_sticky_note_panel.gd @@ -23,20 +23,25 @@ func attatch_sticky_note(attatchment: StickyNote, custom_owner: Node, tween:bool is_attatching = true attatchment.on_board = false attached_sticky_note = attatchment - attatchment.attached_to = self + attatchment.attached_to = null if tween: await get_tree().process_frame var height_tween: Tween = create_tween() height_tween.tween_property(self, "custom_minimum_size", minimum_size, 0.1) attatchment.tween_transform_to(Transform2D(0, get_screen_position() + ancor_position - Vector2(0, minimum_size.y))) await attatchment.transform_tween_finished + await get_tree().process_frame + attatchment.reparent(self) + attatchment.position = ancor_position else: custom_minimum_size = minimum_size - attatchment.reparent(self) + attatchment.reparent(self) + attatchment.position = ancor_position is_attatching = false attatchment.owner = custom_owner - attatchment.position = ancor_position + attatchment.attached_to = self attatchment.current_handle = custom_owner + var is_gapped: bool = false func create_gap(): diff --git a/src/logic-scenes/board/sticky-note.gd b/src/logic-scenes/board/sticky-note.gd index c37b801..ee07bad 100644 --- a/src/logic-scenes/board/sticky-note.gd +++ b/src/logic-scenes/board/sticky-note.gd @@ -14,6 +14,8 @@ var attached_to: Node = null: # cannot be explicitly typed, as this can be bnoth handled by picker and physics-board var current_handle: Node +var position_locked: bool = false + signal transform_tween_finished @export var text: String = "" : @@ -67,7 +69,6 @@ var mouse_diff: Vector2 @export_range(1.0, 10.0) var bounce_speed: float = 8 var on_board: bool = false - func _ready() -> void: input_event.connect(_on_input_event) @@ -172,8 +173,11 @@ func tween_transform_to(target: Transform2D): var transform_tween: Tween = create_tween() transform_tween.tween_property(self, "transform", target, 0.25) await transform_tween.finished - emit_signal("transform_tween_finished") + transform_tween_finished.emit() func reset_drag(): if attached_to != null: attached_to.reclaim_sticky_note() + +func free() -> void: + assert(false)