This commit is contained in:
Rowland Rowland 2023-05-11 11:36:10 +01:00
commit 2ef306a49c

View File

@ -54,12 +54,13 @@ void UQuestSystem::TickComponent(float DeltaTime, ELevelTick TickType, FActorCom
void UQuestSystem::CheckActiveQuestConditions()
{
TArray<UQuest*> JustCompletedQuests;
for (UQuest* Quest : ActiveQuests)
{
if (Quest->CheckConditions(GetWorldState()))
{
CompletedQuests.Add(Quest);
Quest->ApplyRewards(PlayerInventory);
JustCompletedQuests.Add(Quest);
for (TTuple<FString, bool> QuestFlag : Quest->QuestFlagsOnComplete)
{
QuestFlags.Add(QuestFlag.Key, QuestFlag.Value);
@ -79,6 +80,11 @@ void UQuestSystem::CheckActiveQuestConditions()
}
UpdateQuestGoalsUI(Quest);
}
for (UQuest* Quest : JustCompletedQuests)
{
ActiveQuests.Remove(Quest);
Quest->ApplyRewards(PlayerInventory);
}
}
UWorldState* UQuestSystem::GetWorldState() const