prevent intro from being played while draeven text is finished and not skipped to avoid illegal animation state

This commit is contained in:
betalars 2025-03-28 18:20:21 +01:00
parent a38b4d1956
commit ad64a118cc
4 changed files with 25 additions and 6 deletions

View File

@ -120,9 +120,11 @@ func trigger_intro():
intro.emit() intro.emit()
intro_triggered = true intro_triggered = true
var was_skipped = false
func skip_text(): func skip_text():
if not animation_complete: if not animation_complete:
animation_player.stop(true) animation_player.stop(true)
was_skipped = true
text_finished.emit() text_finished.emit()
func _on_text_finished(): func _on_text_finished():

View File

@ -783,7 +783,7 @@ func _ready() -> void:
$childhood.finished.connect(on_childhood_done) $childhood.finished.connect(on_childhood_done)
$JuiJutsu.finished.connect(on_jui_jutsu_done) $JuiJutsu.finished.connect(on_jui_jutsu_done)
$voice_training.finished.connect(on_voice_training_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): for id in range(Scenes.id.YOUTH_DRAEVEN, Scenes.id.YOUTH_JUI_JUTSU+1):
Scenes.sign_up_for_sequence(play_scene, id, 0) Scenes.sign_up_for_sequence(play_scene, id, 0)
@ -831,8 +831,16 @@ func on_draeven_done():
Scenes.continue_sequence(self) Scenes.continue_sequence(self)
$draven.hide() $draven.hide()
func try_intro():
if $draven.was_skipped:
play(\"intro\")
func scene_finished(_id: int, _repeat: bool): func scene_finished(_id: int, _repeat: bool):
queue(\"RESET\") 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"] [sub_resource type="BoxShape3D" id="BoxShape3D_cb3g8"]

View File

@ -23,21 +23,26 @@ func attatch_sticky_note(attatchment: StickyNote, custom_owner: Node, tween:bool
is_attatching = true is_attatching = true
attatchment.on_board = false attatchment.on_board = false
attached_sticky_note = attatchment attached_sticky_note = attatchment
attatchment.attached_to = self attatchment.attached_to = null
if tween: if tween:
await get_tree().process_frame await get_tree().process_frame
var height_tween: Tween = create_tween() var height_tween: Tween = create_tween()
height_tween.tween_property(self, "custom_minimum_size", minimum_size, 0.1) 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))) attatchment.tween_transform_to(Transform2D(0, get_screen_position() + ancor_position - Vector2(0, minimum_size.y)))
await attatchment.transform_tween_finished await attatchment.transform_tween_finished
await get_tree().process_frame
attatchment.reparent(self)
attatchment.position = ancor_position
else: else:
custom_minimum_size = minimum_size custom_minimum_size = minimum_size
attatchment.reparent(self) attatchment.reparent(self)
attatchment.position = ancor_position
is_attatching = false is_attatching = false
attatchment.owner = custom_owner attatchment.owner = custom_owner
attatchment.position = ancor_position attatchment.attached_to = self
attatchment.current_handle = custom_owner attatchment.current_handle = custom_owner
var is_gapped: bool = false var is_gapped: bool = false
func create_gap(): func create_gap():
var self_id = get_parent().get_children().find(self) var self_id = get_parent().get_children().find(self)

View File

@ -14,6 +14,8 @@ var attached_to: Node = null:
# cannot be explicitly typed, as this can be bnoth handled by picker and physics-board # cannot be explicitly typed, as this can be bnoth handled by picker and physics-board
var current_handle: Node var current_handle: Node
var position_locked: bool = false
signal transform_tween_finished signal transform_tween_finished
@export var text: String = "" : @export var text: String = "" :
@ -67,7 +69,6 @@ var mouse_diff: Vector2
@export_range(1.0, 10.0) var bounce_speed: float = 8 @export_range(1.0, 10.0) var bounce_speed: float = 8
var on_board: bool = false var on_board: bool = false
func _ready() -> void: func _ready() -> void:
input_event.connect(_on_input_event) input_event.connect(_on_input_event)
@ -172,8 +173,11 @@ func tween_transform_to(target: Transform2D):
var transform_tween: Tween = create_tween() var transform_tween: Tween = create_tween()
transform_tween.tween_property(self, "transform", target, 0.25) transform_tween.tween_property(self, "transform", target, 0.25)
await transform_tween.finished await transform_tween.finished
emit_signal("transform_tween_finished") transform_tween_finished.emit()
func reset_drag(): func reset_drag():
if attached_to != null: if attached_to != null:
attached_to.reclaim_sticky_note() attached_to.reclaim_sticky_note()
func free() -> void:
assert(false)