Skip to content

Commit

Permalink
fix bug preventing loading of legacy skins
Browse files Browse the repository at this point in the history
  • Loading branch information
katycat5e committed Jul 27, 2023
1 parent 153a9ac commit 8155a6d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
5 changes: 5 additions & 0 deletions Repository.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"Releases": [
{
"Id": "SkinManagerMod",
"Version": "3.1.2",
"DownloadUrl": "https://github.com/derail-valley-modding/skin-manager/releases/download/v3.1.2/SkinManagerMod.zip"
},
{
"Id": "SkinManagerMod",
"Version": "3.1.1",
"DownloadUrl": "https://github.com/derail-valley-modding/skin-manager/releases/download/v3.1.1/SkinManagerMod.zip"
},
Expand Down
2 changes: 1 addition & 1 deletion SMShared/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public static class Constants
{
public const string MOD_ID = "SkinManagerMod";
public const string MOD_NAME = "Skin Manager";
public const string MOD_VERSION = "3.1.1";
public const string MOD_VERSION = "3.1.2";

public const string SKIN_FOLDER_NAME = "Skins";
public const string EXPORT_FOLDER_NAME = "Exported";
Expand Down
14 changes: 2 additions & 12 deletions SkinManagerMod/SkinConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace SkinManagerMod
{
public class SkinConfig : SkinConfigBase, IEquatable<SkinConfig>
public class SkinConfig : SkinConfigBase
{
[JsonIgnore]
public TrainCarLivery Livery;
Expand Down Expand Up @@ -59,14 +59,9 @@ public static SkinConfig LoadFromFile(string filePath)

return null;
}

public bool Equals(SkinConfig other)
{
return Name == other?.Name;
}
}

public class ModSkinCollection : IEnumerable<SkinConfig>, IEquatable<ModSkinCollection>
public class ModSkinCollection : IEnumerable<SkinConfig>
{
public UnityModManager.ModEntry modEntry;

Expand All @@ -82,10 +77,5 @@ public ModSkinCollection(UnityModManager.ModEntry modEntry)
public IEnumerator<SkinConfig> GetEnumerator() => Configs.GetEnumerator();

IEnumerator IEnumerable.GetEnumerator() => Configs.GetEnumerator();

public bool Equals(ModSkinCollection other)
{
return modEntry.Info == other?.modEntry.Info;
}
}
}
4 changes: 3 additions & 1 deletion SkinManagerMod/SkinProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static bool Initialize()

public static void ReloadAllSkins(bool forceSync = false)
{
foreach (var mod in UnityModManager.modEntries)
foreach (var mod in UnityModManager.modEntries.Where(m => m.Info.Id != Constants.MOD_ID))
{
ReloadSkinMod(mod, forceSync);
}
Expand All @@ -145,6 +145,8 @@ private static ModSkinCollection GetSkinConfigs(UnityModManager.ModEntry mod)

private static void HandleSkinModToggle(UnityModManager.ModEntry mod, bool nowActive)
{
if ((mod.Info.Id == Constants.MOD_ID) || !string.IsNullOrWhiteSpace(mod.Info.EntryMethod)) return;

if (nowActive)
{
ReloadSkinMod(mod, WorldStreamingInit.IsStreamingDone); // force synchronous if in-game
Expand Down

0 comments on commit 8155a6d

Please sign in to comment.