Conversation
…'s at least tiny for a binary.
…mit multiple work loads to the panel.
…e Unity convention
…hese changes make the progress bar load the mods, cache the manifest and start the game.. possibly correctly.
| { | ||
| ModTek.LoadMods(); | ||
| Traverse trav = Traverse.Create(__instance); | ||
| if (ActivateAfterInit.ActivateAfter.Start.Equals(trav.Field("activateAfter").GetValue<ActivateAfterInit.ActivateAfter>())) |
There was a problem hiding this comment.
If this code gets called more than once per time the game is started (via save game loads or whatever), should cached the field infos potentially.
There was a problem hiding this comment.
I think this is OK -- the Main object activates BattleTechGame once during the initial startup, this is here just to 'pause' the loading so we can animate. I don't believe that BattleTechGame gets activated another time through this mechanism (it can be activated in other ways though)
ModTek/ProgressPanel.cs
Outdated
| ProgressBarAssetBundle = LoadAssets(assetDirectory, ASSET_BUNDLE_NAME); | ||
| if (ProgressBarAssetBundle == null) | ||
| { | ||
| Logger.LogWithDate("Error loading assets"); |
There was a problem hiding this comment.
have you tested this failure state?
should this throw an exception?
There was a problem hiding this comment.
I just updated the branch to handle this more gracefully -- and tested it. It now throws an exception, which will propagate up to the Initialize method -- which, if false -- will stop ModTek from loading completely. (it used to hang kinda ugly instead)
|
The panel appearing twice is not normal. Were there two ModTek.dlls in the folder? Or was the new BTML injector run against an already injected file? Haven't seen that one on my end (and neither did LadyAlekto when she runs it) |
…mode handling. If the asset bundle doesn't load, the mods will not be loaded.
| } | ||
| else | ||
| { | ||
| Log("Failed to load progress bar. Skipping mod loading completely."); |
There was a problem hiding this comment.
Given we will control the filename, I would be more explicit about like "you need modtekassetbundle in your Mods directory"
There was a problem hiding this comment.
This is the result after the change I made:
Attempting to load asset bundle: C:\Program Files (x86)\Steam\steamapps\common\BATTLETECH\Mods\modtekassetbundle
8:09:55 PM - Error loading asset bundle modtekassetbundle
Exception caught: System.IO.IOException: Error loading asset bundle modtekassetbundle
at ModTek.ProgressPanel.InitializeAssets (System.String assetDirectory) [0x00000] in :0
at ModTek.ProgressPanel.Initialize (System.String directory, System.String panelTitle) [0x00000] in :0
Failed to load progress bar. Skipping mod loading completely.
|
As stated on janxious/BattleTechModLoader#1, the weirdness I reported was all PEBKAC. |


Significant refactor of ModTek to have it disable the normal BattleTech loading, load all the modtek enabled mods using a progress bar and then resume the normal initialization sequence.
Includes an outside asset bundle from Unity to create the progress bar panel