Skip to content

Commit

Permalink
chore: Improved mod enabling logic during install (#167)
Browse files Browse the repository at this point in the history
Disable the mod if the "Enable only this mod" option is unchecked and other mods are enabled; otherwise, leave the mod active.

---------

Signed-off-by: Davoleo <[email protected]>
Co-authored-by: Jorixon <[email protected]>
  • Loading branch information
Davoleo and Jorixon authored Apr 1, 2024
1 parent 37d31a9 commit 7498afb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/GIMI-ModManager.WinUI/ViewModels/ModInstallerVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,21 @@ private void SuccessfulInstall(ISkinMod newMod)

if (EnableThisMod)
Task.Run(() => EnableOnlyMod(newMod));
else
{
Task.Run(() =>
{
if (_characterModList.Mods.Count == 0) return;

// False if all the mods are disabled or there are no mods other than the new one
var anyEnabled = _characterModList.Mods
.Where(entry => entry.Mod.Id != newMod.Id)
.Any(entry => entry.IsEnabled);

if (anyEnabled)
DisableMod(newMod);
});
}

_dispatcherQueue?.TryEnqueue(() => { _windowManagerService.GetWindow(_characterModList)?.Close(); });

Expand Down

0 comments on commit 7498afb

Please sign in to comment.