Skip to content

Commit

Permalink
Merge pull request #622 from nhruo123/enable_disable_menu_favorites
Browse files Browse the repository at this point in the history
Add favorites support in enable or disable mods menu
  • Loading branch information
maddie480 authored Nov 6, 2023
2 parents 782879a + 61274f3 commit 20ea2eb
Show file tree
Hide file tree
Showing 4 changed files with 350 additions and 55 deletions.
32 changes: 17 additions & 15 deletions Celeste.Mod.mm/Content/Dialog/English.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,21 +266,23 @@
OOBE_SETTINGS_OK= OK

# Mod Toggle Menu
MODOPTIONS_MODTOGGLE= TOGGLE MODS
MODOPTIONS_MODTOGGLE_LOADING= Loading mod information...
MODOPTIONS_MODTOGGLE_TOGGLEDEPS= Toggle Dependencies Automatically
MODOPTIONS_MODTOGGLE_TOGGLEDEPS_MESSAGE1= When you enable a mod, all its dependencies will be enabled.
MODOPTIONS_MODTOGGLE_TOGGLEDEPS_MESSAGE2= When you disable a mod, all mods that depend on it will be disabled.
MODOPTIONS_MODTOGGLE_MESSAGE_1= If you enable or disable mods, your blacklist.txt will be replaced,
MODOPTIONS_MODTOGGLE_MESSAGE_2= and Celeste will restart to apply changes.
MODOPTIONS_MODTOGGLE_MESSAGE_3= Highlighted mods are used by other enabled mods as a dependency.
MODOPTIONS_MODTOGGLE_WHITELISTWARN= Disable your whitelist for these settings to be applied properly.
MODOPTIONS_MODTOGGLE_ENABLEALL= Enable All
MODOPTIONS_MODTOGGLE_DISABLEALL= Disable All
MODOPTIONS_MODTOGGLE_CANCEL= Cancel
MODOPTIONS_MODTOGGLE_ZIPS= Zip Files
MODOPTIONS_MODTOGGLE_DIRECTORIES= Directories
MODOPTIONS_MODTOGGLE_BINS= Map Bin Files
MODOPTIONS_MODTOGGLE= TOGGLE MODS
MODOPTIONS_MODTOGGLE_LOADING= Loading mod information...
MODOPTIONS_MODTOGGLE_TOGGLEDEPS= Toggle Dependencies Automatically
MODOPTIONS_MODTOGGLE_TOGGLEDEPS_MESSAGE1= When you enable a mod, all its dependencies will be enabled.
MODOPTIONS_MODTOGGLE_TOGGLEDEPS_MESSAGE2= When you disable a mod, all mods that depend on it will be disabled.
MODOPTIONS_MODTOGGLE_PROTECTFAVORITES= Protect Favorites
MODOPTIONS_MODTOGGLE_PROTECTFAVORITES_MESSAGE= Press {0} to add or remove mods from your favorite list.
MODOPTIONS_MODTOGGLE_MESSAGE_1= If you enable or disable mods, your blacklist.txt will be replaced,
MODOPTIONS_MODTOGGLE_MESSAGE_2= and Celeste will restart to apply changes.
MODOPTIONS_MODTOGGLE_MESSAGE_3= Highlighted mods are used by other enabled mods as a dependency.
MODOPTIONS_MODTOGGLE_WHITELISTWARN= Disable your whitelist for these settings to be applied properly.
MODOPTIONS_MODTOGGLE_ENABLEALL= Enable All
MODOPTIONS_MODTOGGLE_DISABLEALL= Disable All
MODOPTIONS_MODTOGGLE_CANCEL= Cancel
MODOPTIONS_MODTOGGLE_ZIPS= Zip Files
MODOPTIONS_MODTOGGLE_DIRECTORIES= Directories
MODOPTIONS_MODTOGGLE_BINS= Map Bin Files

# Asset Reload Helper
ASSETRELOADHELPER_RELOADINGMAP= Reloading map
Expand Down
15 changes: 15 additions & 0 deletions Celeste.Mod.mm/Mod/Everest/Everest.Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public static class Loader {
/// </summary>
public static ReadOnlyCollection<string> Blacklist => _Blacklist?.AsReadOnly();

/// <summary>
/// The path to the Everest /Mods/favorites.txt file.
/// </summary>
public static string PathFavorites { get; internal set; }
internal static HashSet<string> Favorites = new HashSet<string>();

/// <summary>
/// The path to the Everest /Mods/temporaryblacklist.txt file.
/// </summary>
Expand Down Expand Up @@ -156,6 +162,15 @@ internal static void LoadAuto() {
}
}

PathFavorites = Path.Combine(PathMods, "favorites.txt");
if (File.Exists(PathFavorites)) {
Favorites = new HashSet<string>(File.ReadAllLines(PathFavorites).Select(l => (l.StartsWith("#") ? "" : l).Trim()));
} else {
using (StreamWriter writer = File.CreateText(PathFavorites)) {
writer.WriteLine("# This is the favorites list. Lines starting with # are ignored.");
}
}

Stopwatch watch = Stopwatch.StartNew();

enforceOptionalDependencies = true;
Expand Down
Loading

0 comments on commit 20ea2eb

Please sign in to comment.