mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-21 07:17:53 +01:00
Add checking for supported features with the currently new supported features 'Atch', 'Shp' and 'Atr'.
This commit is contained in:
parent
98203e4e8a
commit
318a41fe52
14 changed files with 216 additions and 37 deletions
|
|
@ -1,4 +1,3 @@
|
|||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
using OtterGui.Extensions;
|
||||
using Penumbra.GameData.Data;
|
||||
|
|
@ -12,6 +11,16 @@ using Penumbra.String.Classes;
|
|||
|
||||
namespace Penumbra.Mods;
|
||||
|
||||
[Flags]
|
||||
public enum FeatureFlags : ulong
|
||||
{
|
||||
None = 0,
|
||||
Atch = 1ul << 0,
|
||||
Shp = 1ul << 1,
|
||||
Atr = 1ul << 2,
|
||||
Invalid = 1ul << 62,
|
||||
}
|
||||
|
||||
public sealed class Mod : IMod
|
||||
{
|
||||
public static readonly TemporaryMod ForcedFiles = new()
|
||||
|
|
@ -57,6 +66,7 @@ public sealed class Mod : IMod
|
|||
public string Image { get; internal set; } = string.Empty;
|
||||
public IReadOnlyList<string> ModTags { get; internal set; } = [];
|
||||
public HashSet<CustomItemId> DefaultPreferredItems { get; internal set; } = [];
|
||||
public FeatureFlags RequiredFeatures { get; internal set; } = 0;
|
||||
|
||||
|
||||
// Local Data
|
||||
|
|
@ -70,6 +80,23 @@ public sealed class Mod : IMod
|
|||
public readonly DefaultSubMod Default;
|
||||
public readonly List<IModGroup> Groups = [];
|
||||
|
||||
/// <summary> Compute the required feature flags for this mod. </summary>
|
||||
public FeatureFlags ComputeRequiredFeatures()
|
||||
{
|
||||
var flags = FeatureFlags.None;
|
||||
foreach (var option in AllDataContainers)
|
||||
{
|
||||
if (option.Manipulations.Atch.Count > 0)
|
||||
flags |= FeatureFlags.Atch;
|
||||
if (option.Manipulations.Atr.Count > 0)
|
||||
flags |= FeatureFlags.Atr;
|
||||
if (option.Manipulations.Shp.Count > 0)
|
||||
flags |= FeatureFlags.Shp;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public AppliedModData GetData(ModSettings? settings = null)
|
||||
{
|
||||
if (settings is not { Enabled: true })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue