-
Notifications
You must be signed in to change notification settings - Fork 479
Rewoven cutscene: Actually switch to the scene #2688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # SPDX-FileCopyrightText: The Threadbare Authors | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| extends AnimationPlayer | ||
|
|
||
|
|
||
| func _ready() -> void: | ||
| animation_finished.connect(_on_animation_finished) | ||
|
|
||
|
|
||
| func _on_animation_finished(_anim_name: StringName) -> void: | ||
| # Go back home. Usually Fray's End and next to the Eternal Loom: | ||
| var home_scene: String = ThreadbareProjectSettings.get_setting( | ||
| ThreadbareProjectSettings.HOME_SCENE | ||
| ) | ||
| SceneSwitcher.change_to_file_with_transition( | ||
| home_scene, "", Transitions.Effect.FADE, Transitions.Effect.FADE | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://k3q1kntww4eb |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,10 +5,15 @@ extends Node2D | |
|
|
||
| signal retelling_started | ||
| signal retelling_finished | ||
| signal load_cinematic | ||
| signal play_cinematic | ||
| signal give_retelling_upgrade(type: InventoryItem.ItemType) | ||
|
|
||
| ## Paths to world-rewoven cutscenes that will be shown. | ||
| ## They must switch back to Fray's End after playing an animation. | ||
| @export var cutscene_paths: Array[String] = [ | ||
| "res://scenes/game_elements/fx/world_rewoven/components/world_rewoven_cutscene_1.tscn", | ||
| "res://scenes/game_elements/fx/world_rewoven/components/world_rewoven_cutscene_2.tscn", | ||
| ] | ||
|
|
||
| var elders: Array[Elder] | ||
|
|
||
| @onready var interact_area: InteractArea = %InteractArea | ||
|
|
@@ -77,16 +82,29 @@ func give_spirit_upgrade() -> void: | |
|
|
||
|
|
||
| func on_offering_succeeded() -> void: | ||
| load_cinematic.emit() | ||
| var cutscene_path: String = cutscene_paths.pick_random() | ||
| var load_error: Error = ResourceLoader.load_threaded_request(cutscene_path) | ||
|
|
||
| GameState.global.facts.rewoven_cutscenes = [cutscene_path] | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: this generic fact is placeholder, while I figure out a way to generate an array of cutscenes to display using actual quest unlockers.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm marking this PR as ready for review to do the first part of the ticket (actually switch to the scene existing cutscenes, not new ones in the world). Should I leave this as an Array? |
||
|
|
||
| if load_error != OK: | ||
| push_error("Failed to start loading %s: %s" % [cutscene_path, error_string(load_error)]) | ||
|
|
||
| loom_offering_animation_player.play(&"loom_offering") | ||
| await loom_offering_animation_player.animation_finished | ||
| GameState.quest.inventory.clear_inventory() | ||
|
|
||
| play_cinematic.emit() | ||
| if load_error != OK: | ||
| on_rewoven_finished() | ||
| return | ||
|
|
||
| var cutscene_packed: PackedScene = ResourceLoader.load_threaded_get(cutscene_path) | ||
| SceneSwitcher.change_to_packed_with_transition( | ||
| cutscene_packed, "", Transitions.Effect.FADE, Transitions.Effect.FADE | ||
| ) | ||
|
|
||
|
|
||
| func on_cinematic_finished() -> void: | ||
| func on_rewoven_finished() -> void: | ||
| var elder: Elder = _find_elder(GameState.quest.quest) | ||
| if elder: | ||
| await elder.congratulate_player() | ||
|
|
||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way to do this would be to put a
SceneLinkinto each cutscene, pointing at HOME, and connectfinishedto itsswitch. I think this is fine though, particularly since we'll surely iterate on this to e.g. play multiple cutscenes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I like that more! I'll open a follow up PR.