Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ func _get_configuration_warnings() -> PackedStringArray:
return warnings


func has_quests() -> bool:
return _storybook and _storybook.has_quests()


## Show a storybook to the player, and wait for them to select a story or close the book.
func show_storybook() -> void:
if not _storybook:
Expand All @@ -81,6 +85,10 @@ func congratulate_player() -> void:
func _before_dialogue() -> void:
if eternal_loom and eternal_loom.is_item_offering_possible():
talk_behavior.title = "go_to_loom"
elif not _storybook or not _storybook.has_quests():
talk_behavior.title = "no_quests"
else:
talk_behavior.title = ""


func _on_interaction_ended() -> void:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: The Threadbare Authors
# SPDX-License-Identifier: MPL-2.0
~ start

LoreQuest Elder: [[Hi|Hello|Greetings]], StoryWeaver. We've been waiting for you. Our world is unraveling!
LoreQuest Elder: We need you to recover the Sacred Elements: the threads of Memory, Imagination, and Spirit! Will you help us?
do show_storybook()
Expand Down Expand Up @@ -35,3 +36,6 @@ LoreQuest Elder: Go on, StoryWeaver: take the threads to the Eternal Loom.
LoreQuest Elder: Thank you, StoryWeaver! The fabric of the world slowly heals!
LoreQuest Elder: Go forth: our world still needs your help.
=> END
~ no_quests
LoreQuest Elder: I don't have any quests for you. Talk to my fellow Elders.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

=> END
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ StoryQuest Elder: Go on, StoryWeaver: take the threads to the Eternal Loom.
StoryQuest Elder: Thank you, StoryWeaver! The fabric of the world slowly heals!
StoryQuest Elder: Go forth: our world still needs your help.
=> END
~ no_quests
StoryQuest Elder: I don't have any quests for you. Talk to my fellow Elders.
=> END
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ Template Elder: Go on, StoryWeaver: take the threads to the Eternal Loom.
Template Elder: Thank you, StoryWeaver! The fabric of the world slowly heals!
Template Elder: Go forth: our world still needs your help.
=> END
~ no_quests
Template Elder: I don't have any quests for you. Talk to my fellow Elders.
=> END
14 changes: 11 additions & 3 deletions scenes/menus/storybook/components/storybook.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const QUEST_RESOURCE_NAME := "quest.tres"

## Directory to scan for quests. This directory should have 1 or more subdirectories, each of which
## have a [code]quest.tres[/code] file within.
@export_dir var quest_directory: String = "res://scenes/quests/story_quests"
@export_dir var quest_directory: String = "res://scenes/quests/story_quests":
set = _set_quest_directory

var _quests: Array[Quest] = []
var _current_spread_index: int = -1
Expand All @@ -49,11 +50,14 @@ func _enumerate_quests() -> Array[Quest]:
return quests


func _set_quest_directory(new_value: String) -> void:
quest_directory = new_value
_quests = _enumerate_quests()


func _ready() -> void:
animated_book.animation_finished.connect(_on_animation_finished)

_quests = _enumerate_quests()

var previous_button: Button = null
for i in _quests.size():
var quest: Quest = _quests[i]
Expand Down Expand Up @@ -186,3 +190,7 @@ func _on_back_button_pressed() -> void:

func reset_focus() -> void:
_switch_to_page(0)


func has_quests() -> bool:
return not _quests.is_empty()
Loading