28 lines
654 B
GDScript
28 lines
654 B
GDScript
class_name EventQuestAllObjectivesComplete extends "res://scripts/Event/Flow/EventGroup.gd"
|
|
|
|
@export var questKey:QuestSystem.QuestKey = QuestSystem.QuestKey.TEST_QUEST
|
|
@export var triggerMultipleTimes: bool = false
|
|
|
|
func _enter_tree() -> void:
|
|
QUEST.questUpdated.connect(onQuestUpdated)
|
|
|
|
func _exit_tree() -> void:
|
|
QUEST.questUpdated.disconnect(onQuestUpdated)
|
|
|
|
func onQuestUpdated(quest:Quest) -> void:
|
|
if self.ended:
|
|
if !self.triggerMultipleTimes:
|
|
return
|
|
self.reset()
|
|
|
|
if quest.questKey != self.questKey:
|
|
return
|
|
|
|
if !quest.isStarted():
|
|
return
|
|
|
|
for objective in quest.objectives:
|
|
if !objective.isCompleted():
|
|
return
|
|
|
|
self.start() |