diff --git a/SkillBasedInit/SkillBasedInit/ModConfig.cs b/SkillBasedInit/SkillBasedInit/ModConfig.cs index 747ae29..244d24b 100644 --- a/SkillBasedInit/SkillBasedInit/ModConfig.cs +++ b/SkillBasedInit/SkillBasedInit/ModConfig.cs @@ -3,10 +3,6 @@ namespace SkillBasedInit { - public static class ModIcons { - public const string Stopwatch = "@sbi_stopwatch"; - } - public static class ModStats { } @@ -18,6 +14,11 @@ public class ModConfig { // If true, all the logs will be printed public bool Trace = false; + public class IconOpts { + public string Stopwatch = "sbi_stopwatch"; + } + public IconOpts Icons = new IconOpts { }; + // The init malus when a unit starts the round prone (from a knockdown) public int ProneModifier = -9; diff --git a/SkillBasedInit/SkillBasedInit/Properties/AssemblyInfo.cs b/SkillBasedInit/SkillBasedInit/Properties/AssemblyInfo.cs index 8bbfcc7..600931a 100644 --- a/SkillBasedInit/SkillBasedInit/Properties/AssemblyInfo.cs +++ b/SkillBasedInit/SkillBasedInit/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.8.1.0")] -[assembly: AssemblyFileVersion("0.8.1.0")] +[assembly: AssemblyVersion("0.8.2.0")] +[assembly: AssemblyFileVersion("0.8.2.0")] diff --git a/SkillBasedInit/SkillBasedInit/SkillBasedInit.csproj b/SkillBasedInit/SkillBasedInit/SkillBasedInit.csproj index c7972de..30737c0 100644 --- a/SkillBasedInit/SkillBasedInit/SkillBasedInit.csproj +++ b/SkillBasedInit/SkillBasedInit/SkillBasedInit.csproj @@ -55,14 +55,14 @@ False - ..\..\..\..\..\..\..\..\Steam\steamapps\common\BATTLETECH\Mods\CustomComponents\CustomComponents.dll + E:\steam\SteamApps\common\BATTLETECH\Mods\CustomComponents\CustomComponents.dll ..\..\..\IRBTModUtils\IRBTModUtils\IRBTModUtils\bin\Debug\IRBTModUtils.dll False - ..\..\..\..\..\..\..\..\Steam\steamapps\common\BATTLETECH\Mods\MechEngineer\MechEngineer.dll + E:\steam\SteamApps\common\BATTLETECH\Mods\MechEngineer\MechEngineer.dll ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll diff --git a/SkillBasedInit/SkillBasedInit/patches/CombatGameStatePatches.cs b/SkillBasedInit/SkillBasedInit/patches/CombatGameStatePatches.cs index c64b58f..0f6a835 100644 --- a/SkillBasedInit/SkillBasedInit/patches/CombatGameStatePatches.cs +++ b/SkillBasedInit/SkillBasedInit/patches/CombatGameStatePatches.cs @@ -1,13 +1,26 @@ using BattleTech; +using BattleTech.Data; using Harmony; +using SVGImporter; namespace SkillBasedInit.patches { [HarmonyPatch(typeof(CombatGameState), "_Init")] public static class CombatGameState__Init { public static void Postfix(CombatGameState __instance) { + Mod.Log.Trace("CGS:_I entered."); Mod.Log.Debug("Caching CombatGameState"); ModState.Combat = __instance; + + // Pre-load our required icons, otherwise DM will unload them as they aren't necessary + DataManager dm = UnityGameInstance.BattleTechGame.DataManager; + LoadRequest loadRequest = dm.CreateLoadRequest(); + + // Need to load each unique icon + Mod.Log.Info("LOADING EFFECT ICONS..."); + loadRequest.AddLoadRequest(BattleTechResourceType.SVGAsset, Mod.Config.Icons.Stopwatch, null); + loadRequest.ProcessRequests(); + Mod.Log.Info(" ICON LOADING COMPLETE!"); } } diff --git a/SkillBasedInit/SkillBasedInit/patches/UI/CombatHUDStatusPanelPatches.cs b/SkillBasedInit/SkillBasedInit/patches/UI/CombatHUDStatusPanelPatches.cs index ef51c87..7f2efd9 100644 --- a/SkillBasedInit/SkillBasedInit/patches/UI/CombatHUDStatusPanelPatches.cs +++ b/SkillBasedInit/SkillBasedInit/patches/UI/CombatHUDStatusPanelPatches.cs @@ -1,4 +1,5 @@ using BattleTech; +using BattleTech.Data; using BattleTech.UI; using Harmony; using HBS; @@ -25,10 +26,8 @@ public static void Postfix(CombatHUDStatusPanel __instance) { Type[] iconMethodParams = new Type[] { typeof(SVGAsset), typeof(Text), typeof(Text), typeof(Vector3), typeof(bool) }; Traverse showBuffIconMethod = Traverse.Create(__instance).Method("ShowBuff", iconMethodParams); - Traverse svgAssetT = Traverse.Create(__instance.DisplayedCombatant.Combat.DataManager).Property("SVGCache"); - object svgCache = svgAssetT.GetValue(); - Traverse svgCacheT = Traverse.Create(svgCache).Method("GetAsset", new Type[] { typeof(string) }); - SVGAsset icon = svgCacheT.GetValue(new object[] { ModIcons.Stopwatch }); + DataManager dm = __instance.DisplayedCombatant.Combat.DataManager; + SVGAsset icon = dm.GetObjectOfType(Mod.Config.Icons.Stopwatch, BattleTechResourceType.SVGAsset); showBuffIconMethod.GetValue(new object[] { icon, new Text(Mod.Config.LocalizedText[ModConfig.LT_TT_TITLE]), new Text(BuildTooltipText(actor)), __instance.effectIconScale, false } ); diff --git a/mod.json b/mod.json index b0e7837..70c4eec 100644 --- a/mod.json +++ b/mod.json @@ -1,24 +1,20 @@ { "Name": "SkillBasedInit", "Enabled": true, - "Version": "0.8.1", + "Version": "0.8.2", "Description": "Changes the initiative system to be pilot-skill focused.", "Author": "IceRaptor", "Website": "https://github.com/IceRaptor/SkillBasedInit", "Contact": "", "DLL": "SkillBasedInit.dll", "DependsOn" : [ "IRBTModUtils", "CustomComponents", "MechEngineer" ], - "CustomResourceTypes": [ "CustomSVGIcon" ], - "Manifest": [ - { - "Type": "CustomSVGIcon", - "Path": "icons/", - "ShouldMergeJSON": false - } - ], + "Manifest": [ { "Type": "SVGAsset", "Path": "icons/",} ], "Settings": { - "Debug" : true, + "Debug" : false, "Trace" : false, + "Icons" : { + "Stopwatch" : "sbi_stopwatch" + }, "ProneModifier" : -9, "ShutdownModifier" : -6, "CrippledMovementModifier" : -13,