Skip to content

Commit

Permalink
Exclude completed quests from active person check
Browse files Browse the repository at this point in the history
NPCs can only belong to a single quest at a time. This is determined by their Person record existing in another quest's resources.
However, it's possible for a completed quest to continue locking out NPC during tombstone period where quest is otherwise finished.
This change frees NPC for another quest as soon as previous quest is completed without also waiting for tombstone period to expire and quest instance being unloaded from quest machine.
  • Loading branch information
Interkarma committed Apr 9, 2023
1 parent 3c57976 commit 8391ba0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Assets/Scripts/Game/Questing/QuestMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,11 @@ public Person[] ActiveFactionPersons(int factionID)
List<Person> assignedFound = new List<Person>();
foreach (Quest quest in quests.Values)
{
// Exclude completed quests from active person check
// This prevents completed/tombstoned quests from locking out NPC
if (quest.QuestComplete)
continue;

QuestResource[] persons = quest.GetAllResources(typeof(Person));
if (persons == null || persons.Length == 0)
continue;
Expand Down

0 comments on commit 8391ba0

Please sign in to comment.