Some event stuff
This commit is contained in:
31
scripts/Event/Trigger/EventQuestObjectiveComplete.gd
Normal file
31
scripts/Event/Trigger/EventQuestObjectiveComplete.gd
Normal file
@@ -0,0 +1,31 @@
|
||||
class_name EventQuestObjectiveComplete extends "res://scripts/Event/Flow/EventGroup.gd"
|
||||
|
||||
@export var triggerIfObjectiveUncompletedThenComplatedAgain: bool = false
|
||||
@export var quest:QuestSystem.QuestKey = QuestSystem.QuestKey.TEST_QUEST
|
||||
@export var objectiveIndex:int = 0
|
||||
|
||||
var hasTriggered:bool = false
|
||||
|
||||
func _enter_tree() -> void:
|
||||
QUEST.questUpdated.connect(onQuestUpdated)
|
||||
pass
|
||||
|
||||
func _exit_tree() -> void:
|
||||
QUEST.questUpdated.disconnect(onQuestUpdated)
|
||||
pass
|
||||
|
||||
func onQuestUpdated(quest:Quest) -> void:
|
||||
if self.ended:
|
||||
if !self.triggerIfObjectiveUncompletedThenComplatedAgain:
|
||||
return
|
||||
self.reset()
|
||||
|
||||
if !quest.isStarted():
|
||||
return
|
||||
|
||||
if !quest.objectives[objectiveIndex].isCompleted():
|
||||
return
|
||||
|
||||
print("onObjectiveCompleted: %s" % quest.questKey)
|
||||
self.start()
|
||||
pass
|
Reference in New Issue
Block a user