Quest system fixed.

This commit is contained in:
2025-05-07 10:33:00 -05:00
parent 12746a520e
commit f940247a48
14 changed files with 94 additions and 29 deletions

View File

@@ -1,13 +1,21 @@
class_name QuestSystem extends Node
var quests:Array[Quest]
enum QuestKey {
TEST_QUEST
};
var quests:Dictionary[int, Quest]
func _ready() -> void:
_updateQuests()
pass
func _updateQuests() -> void:
quests = []
quests = {}
for quest in $Quests.get_children():
if quest is Quest:
quests.append(quest)
if quests.has(quest.questKey):
assert(false, "Quest with key %s already exists" % quest.questKey)
quests[quest.questKey] = quest
for quest in QuestKey:
assert(quests.has(QuestKey[quest]), "Quest with key %s does not exist" % quest)

View File

@@ -3,3 +3,7 @@ class_name UISystem extends Control
func _process(delta: float) -> void:
# This needs to always be at the end of the parent node's tree
get_parent().move_child(self, get_parent().get_child_count() - 1)
func showQuestsMenu(questKey = null) -> void:
$QuestMenu.setQuest(questKey)
$QuestMenu.show()