Skip to content

Commit

Permalink
Add potential hidden priorities.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ottermandias committed Sep 19, 2024
1 parent 9b958a9 commit af2a148
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Penumbra/Mods/Settings/ModPriority.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,10 @@ public override ModPriority ReadJson(JsonReader reader, Type objectType, ModPrio

public int CompareTo(ModPriority other)
=> Value.CompareTo(other.Value);

public const int HiddenMin = -84037;
public const int HiddenMax = HiddenMin + 1000;

public bool IsHidden
=> Value is > HiddenMin and < HiddenMax;
}
5 changes: 3 additions & 2 deletions Penumbra/UI/ModsTab/ModPanelConflictsTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public ReadOnlySpan<byte> Label
=> "Conflicts"u8;

public bool IsVisible
=> collectionManager.Active.Current.Conflicts(selector.Selected!).Count > 0;
=> collectionManager.Active.Current.Conflicts(selector.Selected!).Any(c => !GetPriority(c).IsHidden);

private readonly ConditionalWeakTable<IMod, object> _expandedMods = [];

Expand Down Expand Up @@ -58,7 +58,8 @@ public void DrawContent()

// Can not be null because otherwise the tab bar is never drawn.
var mod = selector.Selected!;
foreach (var (conflict, index) in collectionManager.Active.Current.Conflicts(mod).OrderByDescending(GetPriority)
foreach (var (conflict, index) in collectionManager.Active.Current.Conflicts(mod).Where(c => !c.Mod2.Priority.IsHidden)
.OrderByDescending(GetPriority)
.ThenBy(c => c.Mod2.Name.Lower).WithIndex())
{
using var id = ImRaii.PushId(index);
Expand Down
4 changes: 4 additions & 0 deletions Penumbra/UI/ModsTab/ModPanelSettingsTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using OtterGui.Raii;
using OtterGui;
using OtterGui.Services;
using OtterGui.Text;
using OtterGui.Widgets;
using Penumbra.UI.Classes;
using Penumbra.Collections.Manager;
Expand Down Expand Up @@ -96,6 +97,9 @@ private void DrawPriorityInput()
ImGui.SetNextItemWidth(50 * UiHelpers.Scale);
if (ImGui.InputInt("##Priority", ref priority, 0, 0))
_currentPriority = priority;
if (new ModPriority(priority).IsHidden)
ImUtf8.HoverTooltip($"This priority is special-cased to hide this mod in conflict tabs ({ModPriority.HiddenMin}, {ModPriority.HiddenMax}).");


if (ImGui.IsItemDeactivatedAfterEdit() && _currentPriority.HasValue)
{
Expand Down

0 comments on commit af2a148

Please sign in to comment.