Skip to content

Commit

Permalink
Showing 2 changed files with 23 additions and 4 deletions.
25 changes: 22 additions & 3 deletions SynthEBD/Patcher/Asset Patching/AssetSelector.cs
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ public SubgroupCombination AssignAssets(NPCInfo npcInfo, AssetPackAssignmentMode
}
else if (_patcherState.GeneralSettings.bLinkNPCsWithSameName && npcInfo.IsValidLinkedUnique)
{
chosenCombination = GetCombinationFromSameNameNPC(npcInfo, mode);
chosenCombination = GetCombinationFromSameNameNPC(npcInfo, mode, availableAssetPacks);
}

if (chosenCombination == null)
@@ -174,9 +174,28 @@ public SubgroupCombination GetCombinationFromLinkedNPCGroup(NPCInfo npcInfo, Ass
return linkedCombination;
}

public SubgroupCombination GetCombinationFromSameNameNPC(NPCInfo npcInfo, AssetPackAssignmentMode mode)
public SubgroupCombination GetCombinationFromSameNameNPC(NPCInfo npcInfo, AssetPackAssignmentMode mode, HashSet<FlattenedAssetPack> availableAssetPacks)
{
SubgroupCombination linkedCombination = UniqueNPCData.GetUniqueNPCTrackerData(npcInfo, AssignmentType.PrimaryAssets) ?? null;
SubgroupCombination linkedCombination = null;
switch(mode)
{
case AssetPackAssignmentMode.Primary: linkedCombination = UniqueNPCData.GetUniqueNPCTrackerData(npcInfo, AssignmentType.PrimaryAssets); break;
case AssetPackAssignmentMode.MixIn:
Dictionary<string, SubgroupCombination> linkedCombinationDict = UniqueNPCData.GetUniqueNPCTrackerData(npcInfo, AssignmentType.MixInAssets);
if (linkedCombinationDict.ContainsKey(availableAssetPacks.First().GroupName)) // availableAssetPacks only contains the current Mix-in
{
linkedCombination = linkedCombinationDict[availableAssetPacks.First().GroupName];
}
break;
case AssetPackAssignmentMode.ReplacerVirtual:
List<UniqueNPCData.UniqueNPCTracker.LinkedAssetReplacerAssignment> linkedReplacerCombinations = UniqueNPCData.GetUniqueNPCTrackerData(npcInfo, AssignmentType.ReplacerAssets);
if (linkedReplacerCombinations != null)
{
var linkedAssignmentGroup = linkedReplacerCombinations.Where(x => x.ReplacerName == availableAssetPacks.First().GroupName).FirstOrDefault(); // availableAssetPacks only contains the current replacer
if (linkedAssignmentGroup != null) { linkedCombination = linkedAssignmentGroup.AssignedReplacerCombination; }
}
break;
}

if (linkedCombination != null && CombinationAllowedBySpecificNPCAssignment(npcInfo.SpecificNPCAssignment, linkedCombination, mode))
{
2 changes: 1 addition & 1 deletion SynthEBD/Patcher/Shared/AssetAndBodyShapeSelector.cs
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ public AssetAndBodyShapeAssignment ChooseCombinationAndBodyShape(out bool assets
#region Get Assignments from Same-Name Unique NPC
else if (_patcherState.GeneralSettings.bLinkNPCsWithSameName && npcInfo.IsValidLinkedUnique)
{
var linkedCombination = _assetSelector.GetCombinationFromSameNameNPC(npcInfo, mode);
var linkedCombination = _assetSelector.GetCombinationFromSameNameNPC(npcInfo, mode, availableAssetPacks);
if (linkedCombination != null)
{
selectedFromLinkedNPC = true;

0 comments on commit 9251520

Please sign in to comment.