Skip to content

Commit 5e9a054

Browse files
Merge pull request #2713 from df-ferital/npc-answer-consistency
Fix inconsistency in NPC answers about a person and their location
2 parents 1f6c276 + 504969e commit 5e9a054

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Assets/Scripts/Game/TalkManager.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,28 @@ NPCKnowledgeAboutItem GetNPCKnowledgeAboutItem(ListItem listItem)
580580
return NPCKnowledgeAboutItem.KnowsAboutItem;
581581
}
582582

583+
// Fixed from classic: an NPC who is no aware of the location of a quest building
584+
// where a quest person is located obviously can't know the person location
585+
if (listItem.questionType == QuestionType.Person && currentKeySubjectBuildingKey != -1)
586+
{
587+
foreach (ListItem buildingGroupListItem in listTopicLocation)
588+
{
589+
ListItem buildingListItem = buildingGroupListItem.listChildItems.Find(x => x.buildingKey == currentKeySubjectBuildingKey);
590+
if (buildingListItem != null)
591+
{
592+
// Set the NPC knowledge about the building if it has not been set yet
593+
if (buildingListItem.npcKnowledgeAboutItem == NPCKnowledgeAboutItem.NotSet)
594+
buildingListItem.npcKnowledgeAboutItem = GetNPCKnowledgeAboutItem(buildingListItem);
595+
596+
if (buildingListItem.npcKnowledgeAboutItem == NPCKnowledgeAboutItem.DoesNotKnowAboutItem)
597+
return NPCKnowledgeAboutItem.DoesNotKnowAboutItem;
598+
599+
// Found the building, no need to continue
600+
break;
601+
}
602+
}
603+
}
604+
583605
// Make roll result be the same every time for a given NPC
584606
if (currentNPCType == NPCType.Mobile)
585607
DFRandom.Seed = (uint)lastTargetMobileNPC.GetHashCode();

0 commit comments

Comments
 (0)