Skip to content

Commit 649fe17

Browse files
committed
Merge branch 'dev'
2 parents e5ff4f1 + f818a82 commit 649fe17

11 files changed

+47
-18
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
*/obj/*
55

66
.editorconfig
7+
8+
UniquePlayer/Properties/launchSettings.json

Tests/TextureSets_Tests.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
using Moq;
22
using Mutagen.Bethesda;
3+
using Mutagen.Bethesda.Plugins;
4+
using Mutagen.Bethesda.Plugins.Cache;
5+
using Mutagen.Bethesda.Plugins.Exceptions;
36
using Mutagen.Bethesda.Skyrim;
47
using System.Collections.Generic;
58
using System.IO;
@@ -42,7 +45,7 @@ public void TestUpdateTextureSet()
4245
EditorID = "oldTextureSet",
4346
};
4447

45-
linkCache.Setup(x => x.TryResolve<ITextureSetGetter>(textureSetFormKey, out oldTextureSet)).Returns(true);
48+
linkCache.Setup(x => x.TryResolve<ITextureSetGetter>(textureSetFormKey, out oldTextureSet, ResolveTarget.Winner)).Returns(true);
4649

4750
TextureSets program = new(patchMod.Object, linkCache.Object);
4851

@@ -73,7 +76,7 @@ public void TestUpdateTextureSet2()
7376
Diffuse = "replaced_d.dds",
7477
};
7578

76-
linkCache.Setup(x => x.TryResolve<ITextureSetGetter>(textureSetFormKey, out oldTextureSet)).Returns(true);
79+
linkCache.Setup(x => x.TryResolve<ITextureSetGetter>(textureSetFormKey, out oldTextureSet, ResolveTarget.Winner)).Returns(true);
7780

7881
var patchMod = new SkyrimMod(PatchModKey, SkyrimRelease.SkyrimSE);
7982

Tests/UpdateHeadParts_Tests.cs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
using Moq;
22
using Mutagen.Bethesda;
3+
using Mutagen.Bethesda.Plugins;
4+
using Mutagen.Bethesda.Plugins.Cache;
5+
using Mutagen.Bethesda.Plugins.Exceptions;
36
using Mutagen.Bethesda.Skyrim;
47
using System.Collections.Generic;
58
using System.IO;

UniquePlayer/FormKeys/FormList.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Autogenerated by https://github.com/Mutagen-Modding/Mutagen.Bethesda.FormKeys
22

3+
using Mutagen.Bethesda.Plugins;
34
using Mutagen.Bethesda.Skyrim;
45

56
namespace Mutagen.Bethesda.FormKeys.SkyrimSE
@@ -8,7 +9,7 @@ public static partial class RaceCompatibility
89
{
910
public static class FormList
1011
{
11-
private static FormLink<IFormListGetter> Construct(uint id) => new FormLink<IFormListGetter>(ModKey.MakeFormKey(id));
12+
private static FormLink<IFormListGetter> Construct(uint id) => new(ModKey.MakeFormKey(id));
1213
public static FormLink<IFormListGetter> PlayableRaceList => Construct(0xd62);
1314
public static FormLink<IFormListGetter> PlayableVampireList => Construct(0xd63);
1415
}

UniquePlayer/FormKeys/Keyword.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Autogenerated by https://github.com/Mutagen-Modding/Mutagen.Bethesda.FormKeys
22

3+
using Mutagen.Bethesda.Plugins;
34
using Mutagen.Bethesda.Skyrim;
45

56
namespace Mutagen.Bethesda.FormKeys.SkyrimSE
@@ -8,7 +9,7 @@ public static partial class RaceCompatibility
89
{
910
public static class Keyword
1011
{
11-
private static FormLink<IKeywordGetter> Construct(uint id) => new FormLink<IKeywordGetter>(ModKey.MakeFormKey(id));
12+
private static FormLink<IKeywordGetter> Construct(uint id) => new(ModKey.MakeFormKey(id));
1213
public static FormLink<IKeywordGetter> ActorProxyBreton => Construct(0x1d8a);
1314
public static FormLink<IKeywordGetter> ActorProxyArgonian => Construct(0x1d8b);
1415
public static FormLink<IKeywordGetter> ActorProxyKhajiit => Construct(0x1d8c);

UniquePlayer/FormKeys/ModKey.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Mutagen.Bethesda.Plugins;
12
using System.CodeDom.Compiler;
23

34
namespace Mutagen.Bethesda.FormKeys.SkyrimSE

UniquePlayer/FormKeys/Quest.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Autogenerated by https://github.com/Mutagen-Modding/Mutagen.Bethesda.FormKeys
22

3+
using Mutagen.Bethesda.Plugins;
34
using Mutagen.Bethesda.Skyrim;
45

56
namespace Mutagen.Bethesda.FormKeys.SkyrimSE
@@ -8,7 +9,7 @@ public static partial class RaceCompatibility
89
{
910
public static class Quest
1011
{
11-
private static FormLink<IQuestGetter> Construct(uint id) => new FormLink<IQuestGetter>(ModKey.MakeFormKey(id));
12+
private static FormLink<IQuestGetter> Construct(uint id) => new(ModKey.MakeFormKey(id));
1213
public static FormLink<IQuestGetter> RaceDispatcher => Construct(0x9f27);
1314
}
1415
}

UniquePlayer/HeadParts.cs

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
using Mutagen.Bethesda;
2+
using Mutagen.Bethesda.Plugins;
3+
using Mutagen.Bethesda.Plugins.Cache;
4+
using Mutagen.Bethesda.Plugins.Exceptions;
5+
using Mutagen.Bethesda.Plugins.Records;
26
using Mutagen.Bethesda.Skyrim;
37
using Noggog;
48
using System;
@@ -71,10 +75,13 @@ public void UpdateHeadPart(IFormLinkGetter<IHeadPartGetter> headPartItem, string
7175
};
7276

7377
var newHeadPart = PatchMod.HeadParts.AddNew($"{headPart.EditorID}_UniquePlayer");
74-
newHeadPart.DeepCopyIn(headPart, new HeadPart.TranslationMask(defaultOn: true)
78+
79+
newHeadPart.DeepCopyIn(headPart, out var foo, new HeadPart.TranslationMask(defaultOn: true)
7580
{
7681
EditorID = false
7782
});
83+
if (foo.IsInError() && foo.Overall is Exception e) throw e;
84+
7885
// TODO duplicate headPart FormList and restrict to player only?
7986

8087
newHeadPart.Parts.ForEach(x =>
@@ -90,7 +97,7 @@ public void UpdateHeadPart(IFormLinkGetter<IHeadPartGetter> headPartItem, string
9097
}
9198
catch (Exception e)
9299
{
93-
throw RecordException.Factory(e, headPart);
100+
throw RecordException.Enrich(e, headPart);
94101
}
95102
}
96103
}

UniquePlayer/Program.cs

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
using Mutagen.Bethesda;
22
using Mutagen.Bethesda.FormKeys.SkyrimSE;
3+
using Mutagen.Bethesda.Plugins;
4+
using Mutagen.Bethesda.Plugins.Cache;
5+
using Mutagen.Bethesda.Plugins.Exceptions;
6+
using Mutagen.Bethesda.Plugins.Order;
37
using Mutagen.Bethesda.Skyrim;
48
using Mutagen.Bethesda.Synthesis;
59
using Noggog;
@@ -21,7 +25,7 @@ public class Program
2125

2226
private readonly ILinkCache<ISkyrimMod, ISkyrimModGetter> LinkCache;
2327

24-
private readonly LoadOrder<IModListing<ISkyrimModGetter>> LoadOrder;
28+
private readonly ILoadOrder<IModListing<ISkyrimModGetter>> LoadOrder;
2529

2630
private readonly IFileSystem _fileSystem;
2731
private readonly System.IO.Abstractions.IPath Path;
@@ -112,12 +116,12 @@ public void RunPatch()
112116

113117
var victimRaceFormKeys = playableRaceFormLinks.Select(x => x.FormKey.AsLinkGetter<IRaceGetter>()).Concat(playableVampireRaceFormLinks.Select(x => x.FormKey.AsLinkGetter<IRaceGetter>())).ToHashSet();
114118

115-
var otherFormLists =
119+
var otherFormLists = (
116120
from x in LoadOrder.PriorityOrder.WinningOverrides<IFormListGetter>()
117121
where !x.Equals(RaceCompatibility.FormList.PlayableRaceList)
118122
&& !x.Equals(RaceCompatibility.FormList.PlayableVampireList)
119123
&& x.ContainedFormLinks.Any(y => victimRaceFormKeys.Contains(y.FormKey.AsLink<IRaceGetter>()))
120-
select PatchMod.FormLists.GetOrAddAsOverride(x);
124+
select PatchMod.FormLists.GetOrAddAsOverride(x)).ToList();
121125

122126
var modifiedPlayableRaceFormList = PatchMod.FormLists.GetOrAddAsOverride(playableRaceFormList);
123127
var modifiedPlayableVampireRaceFormList = PatchMod.FormLists.GetOrAddAsOverride(playableVampireRaceFormList);
@@ -132,7 +136,7 @@ from x in LoadOrder.PriorityOrder.WinningOverrides<IFormListGetter>()
132136
var vampireRace = vampireRaceLink.Resolve(LinkCache);
133137

134138
if (!race.Flags.HasFlag(Race.Flag.Playable))
135-
throw RecordException.Factory(new Exception("Race in PlayableRaceList was not playable"), race);
139+
throw RecordException.Create("Race in PlayableRaceList was not playable", race);
136140

137141
var newRace = CopyRace(race, texturesPath, meshesPath);
138142

@@ -203,12 +207,13 @@ void applyModelEdit(Model? model)
203207
if (needsEdit)
204208
{
205209
var newArmorAddon = PatchMod.ArmorAddons.AddNew($"{armorAddon.EditorID}_UniquePlayer");
206-
newArmorAddon.DeepCopyIn(armorAddon, new ArmorAddon.TranslationMask(defaultOn: true)
210+
newArmorAddon.DeepCopyIn(armorAddon, out var ex, new ArmorAddon.TranslationMask(defaultOn: true)
207211
{
208212
EditorID = false,
209213
Race = false,
210214
AdditionalRaces = false
211215
});
216+
if (ex.Overall is Exception e) throw e;
212217
newArmorAddon.Race.SetTo(replacementRaces.First());
213218
replacementRaces.Skip(1).ForEach(x => newArmorAddon.AdditionalRaces.Add(x));
214219

@@ -258,11 +263,12 @@ from armor in LoadOrder.PriorityOrder.WinningOverrides<IArmorGetter>()
258263
public Race CopyRace(IRaceGetter oldRace, string texturesPath, string meshesPath)
259264
{
260265
var newRace = PatchMod.Races.AddNew($"{oldRace.EditorID}_UniquePlayer");
261-
newRace.DeepCopyIn(oldRace, new Race.TranslationMask(defaultOn: true)
266+
newRace.DeepCopyIn(oldRace, out var ex, new Race.TranslationMask(defaultOn: true)
262267
{
263268
EditorID = false,
264269
ArmorRace = false
265270
});
271+
if (ex.Overall is Exception e) throw e;
266272
newRace.MorphRace.SetTo(oldRace);
267273
replacementPlayableRacesDict.Add(oldRace.FormKey, newRace.FormKey);
268274

UniquePlayer/TextureSets.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
using Mutagen.Bethesda;
2+
using Mutagen.Bethesda.Plugins;
3+
using Mutagen.Bethesda.Plugins.Cache;
4+
using Mutagen.Bethesda.Plugins.Exceptions;
25
using Mutagen.Bethesda.Skyrim;
36
using System;
47
using System.Collections.Generic;
@@ -51,10 +54,11 @@ public bool UpdateTextureSet(IFormLinkGetter<ITextureSetGetter> textureSetFormLi
5154
}
5255

5356
var newTxst = PatchMod.TextureSets.AddNew($"{txst.EditorID}_UniquePlayer");
54-
newTxst.DeepCopyIn(txst, new TextureSet.TranslationMask(defaultOn: true)
57+
newTxst.DeepCopyIn(txst, out var ex, new TextureSet.TranslationMask(defaultOn: true)
5558
{
5659
EditorID = false
5760
});
61+
if (ex.Overall is Exception e) throw e;
5862
replacementTextureSets.Add(textureSetFormKey, newTxst.FormKey);
5963

6064
newTxst.Diffuse = TexturePaths.ChangeTexturePath(txst.Diffuse, ref changed, texturesPath);
@@ -69,7 +73,7 @@ public bool UpdateTextureSet(IFormLinkGetter<ITextureSetGetter> textureSetFormLi
6973
}
7074
catch (Exception e)
7175
{
72-
throw RecordException.Factory("UpdatTextureSet", txst, e);
76+
throw RecordException.Enrich(e, txst);
7377
}
7478
}
7579

UniquePlayer/UniquePlayer.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<PrivateAssets>all</PrivateAssets>
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
</PackageReference>
15-
<PackageReference Include="Mutagen.Bethesda" Version="0.29.3" />
16-
<PackageReference Include="Mutagen.Bethesda.Synthesis" Version="0.18.3" />
17-
<PackageReference Include="Mutagen.Bethesda.FormKeys.SkyrimSE" Version="2.0.0" />
15+
<PackageReference Include="Mutagen.Bethesda" Version="0.30.6" />
16+
<PackageReference Include="Mutagen.Bethesda.Synthesis" Version="0.19.2" />
17+
<PackageReference Include="Mutagen.Bethesda.FormKeys.SkyrimSE" Version="2.1.0" />
1818
</ItemGroup>
1919
</Project>

0 commit comments

Comments
 (0)