Files
Dawn-Godot/scripts/Quest/Quest.gd

37 lines
853 B
GDScript

class_name Quest extends Node
@export_multiline var title:String = ""
@export var questKey:QuestSystem.QuestKey = QuestSystem.QuestKey.TEST_QUEST
var questStarted:bool = false
var questComplete:bool = false
var objectives:Array[QuestObjective]
func _ready() -> void:
objectives = []
for child in get_children():
if child is QuestObjective:
objectives.append(child)
child.onQuestReady(self)
func start() -> void:
questStarted = true
questComplete = false
QUEST.questStarted.emit(self)
QUEST.questUpdated.emit(self)
func isCompleted() -> bool:
return questComplete
func isStarted() -> bool:
return questStarted
func objectiveUpdated(objective:QuestObjective) -> void:
QUEST.questUpdated.emit(self)
func getTransContext() -> TransContext:
var ctx:TransContext = TransContext.new()
ctx.addTransPlural("title", title)
return ctx