diff --git a/BloonsTD6 Mod Helper/BloonsMod.cs b/BloonsTD6 Mod Helper/BloonsMod.cs index b74565ec2..81ab2e6ef 100644 --- a/BloonsTD6 Mod Helper/BloonsMod.cs +++ b/BloonsTD6 Mod Helper/BloonsMod.cs @@ -162,8 +162,12 @@ public void ApplyHarmonyPatches(Type type) } catch (Exception e) { + var message = e.InnerException?.Message ?? e.Message; + + if (ModHelper.IsEpic && message.Contains("Il2CppFacepunch.Steamworks")) return; + MelonLogger.Warning( - $"Failed to apply {Info.Name} patch(es) in {type.Name}: \"{e.InnerException?.Message ?? e.Message}\" " + + $"Failed to apply {Info.Name} patch(es) in {type.Name}: \"{message}\" " + $"The mod might not function correctly. This needs to be fixed by {Info.Author}"); loadErrors.Add($"Failed to apply patch(es) in {type.Name}"); diff --git a/BloonsTD6 Mod Helper/LATEST.md b/BloonsTD6 Mod Helper/LATEST.md index 287daf689..73e02ea70 100644 --- a/BloonsTD6 Mod Helper/LATEST.md +++ b/BloonsTD6 Mod Helper/LATEST.md @@ -1 +1,3 @@ -- Removed a no longer needed patch that had side effects with X/3+/X Mermonkey damage calculations \ No newline at end of file +- An error indicator will now show on the main menu Mods Button if any mods have load errors +- Added a new load error for not being on MelonLoader 0.6.1 +- Fixed unneeded errors on Epic about Il2CppFacepunch.Steamworks \ No newline at end of file diff --git a/BloonsTD6 Mod Helper/MelonMain.cs b/BloonsTD6 Mod Helper/MelonMain.cs index c8c1a9596..41b5fb2f1 100644 --- a/BloonsTD6 Mod Helper/MelonMain.cs +++ b/BloonsTD6 Mod Helper/MelonMain.cs @@ -12,14 +12,14 @@ using Il2CppAssets.Scripts.Data; using Il2CppAssets.Scripts.Unity; using Il2CppAssets.Scripts.Unity.UI_New.InGame; -using Il2CppAssets.Scripts.Unity.UI_New.InGame.TowerSelectionMenu; +using MelonLoader.Utils; using Newtonsoft.Json.Linq; using TaskScheduler = BTD_Mod_Helper.Api.TaskScheduler; [assembly: MelonInfo(typeof(MelonMain), ModHelper.Name, ModHelper.Version, ModHelper.Author)] [assembly: MelonGame("Ninja Kiwi", "BloonsTD6")] [assembly: MelonGame("Ninja Kiwi", "BloonsTD6-Epic")] [assembly: MelonPriority(-1000)] -[assembly: MelonOptionalDependencies("NAudio.WinMM", "NAudio.Wasapi")] // Avoids the warning about these not getting ILRepacked; they're not needed +[assembly: MelonOptionalDependencies("NAudio.WinMM", "NAudio.Wasapi", "Il2CppFacepunch.Steamworks")] namespace BTD_Mod_Helper; @@ -78,6 +78,12 @@ public override void OnInitialize() { HarmonyInstance.CreateClassProcessor(typeof(EmbeddedBrowser.SteamWebView_OnGUI), true).Patch(); } + + if (typeof(MelonEnvironment).Assembly.GetName().Version is {Minor: 6, Build: > 1}) + { + loadErrors.Add("MelonLoader versions higher than 0.6.1 are not yet considered stable for BloonsTD6. " + + "Please downgrade to MelonLoader 0.6.1 via its installer for best results."); + } } public override void OnUpdate() diff --git a/BloonsTD6 Mod Helper/ModHelper.cs b/BloonsTD6 Mod Helper/ModHelper.cs index 51325fa5a..b22ce3e3e 100644 --- a/BloonsTD6 Mod Helper/ModHelper.cs +++ b/BloonsTD6 Mod Helper/ModHelper.cs @@ -16,7 +16,7 @@ namespace BTD_Mod_Helper; public static class ModHelper { internal const string Name = "BloonsTD6 Mod Helper"; - internal const string Version = "3.1.24"; + internal const string Version = "3.1.25"; internal const string RepoOwner = "gurrenm3"; internal const string RepoName = "BTD-Mod-Helper"; internal const string Description = diff --git a/BloonsTD6 Mod Helper/UI/Modded/ModsButton.cs b/BloonsTD6 Mod Helper/UI/Modded/ModsButton.cs index c84c09d98..429be8e52 100644 --- a/BloonsTD6 Mod Helper/UI/Modded/ModsButton.cs +++ b/BloonsTD6 Mod Helper/UI/Modded/ModsButton.cs @@ -38,6 +38,13 @@ public static void Create(MainMenu mainMenu) indicator.Find("Glow").GetComponent().color = Color.green; indicator.Find("Icon").GetComponent().SetSprite(VanillaSprites.UpgradeBtn); + var error = indicator.gameObject.Duplicate(indicator.parent); + error.transform.localPosition = error.transform.localPosition with {x = error.transform.localPosition.x * -1}; + error.gameObject.SetActive(ModHelper.Mods.Any(mod => mod.loadErrors.Any())); + error.transform.Find("Glow").gameObject.SetActive(false); + error.transform.Find("Icon").GetComponent().SetSprite(VanillaSprites.NoticeBtn); + error.GetComponentInChildren().enabled = false; + var matchLocalPosition = modsButton.transform.GetChild(0).gameObject.AddComponent(); matchLocalPosition.transformToCopy = copyLocalFrom.transform.GetChild(0); diff --git a/Documentation/BTD_Mod_Helper.Extensions.StringExt.md b/Documentation/BTD_Mod_Helper.Extensions.StringExt.md index 64462cb43..1b46ed28b 100644 --- a/Documentation/BTD_Mod_Helper.Extensions.StringExt.md +++ b/Documentation/BTD_Mod_Helper.Extensions.StringExt.md @@ -12,6 +12,33 @@ public static class StringExt Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.Object 'System.Object') 🡒 StringExt ### Methods + + +## StringExt.GetBtd6Localization(this string, bool) Method + +Gets the localization from the current localization text table, or the default one if it's not present in the current one. +If the id is not present in any of these, returned as spaced or not spaced depending on parameters. + +```csharp +public static string GetBtd6Localization(this string id, bool returnAsSpacedIfNoEntry=true); +``` +#### Parameters + + + +`id` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String') + +The ID of the thing you're trying to get the localization of. + + + +`returnAsSpacedIfNoEntry` [System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean') + +Should this return the id with spaces if there's no localization present? + +#### Returns +[System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String') + ## StringExt.NullIfEmpty(this string) Method