diff --git a/Injector/Injector.csproj b/Injector/Injector.csproj index 344b908..d421ef3 100644 --- a/Injector/Injector.csproj +++ b/Injector/Injector.csproj @@ -78,7 +78,7 @@ - start cmd.exe /C ""$(ReferencePath)\LoadArms.exe" --author=Rynchodon --repo=Load-ARMS LoadARMS.exe LoadArms.dll "..\..\..\..\Load-ARMS Readme.txt"" + start cmd.exe /C ""$(ReferencePath)\LoadArms.exe" --author=Rynchodon --repo=Load-ARMS --allBuilds LoadARMS.exe LoadArms.dll "..\..\..\..\Load-ARMS Readme.txt"" diff --git a/Load-ARMS Readme.txt b/Load-ARMS Readme.txt index c452b73..788966d 100644 --- a/Load-ARMS Readme.txt +++ b/Load-ARMS Readme.txt @@ -31,7 +31,7 @@ Modders ======= Load-ARMS has command line options for adding locally compiled mods and publishing them to GitHub, this is the easiest way to make sure Load-ARMS can download them and load them into Space Engineers. -Load-ARMS loads mods as plugins, so make sure you have at least one class that implements VRage.Plugins.IPlugin. +Load-ARMS will call Init and Update on every class that implements VRage.Plugins.IPlugin in loaded mods. Any other registrations need to be handled by the loaded mod. To publish a mod, you will need a public repository on GitHub and a personal access token with the scope public_repo. See https://help.github.com/articles/creating-an-access-token-for-command-line-use/ diff --git a/Loader/LoadArms.cs b/Loader/LoadArms.cs index aad0767..32a5515 100644 --- a/Loader/LoadArms.cs +++ b/Loader/LoadArms.cs @@ -154,7 +154,8 @@ private struct Data private Data _data; private ParallelTasks.Task _task; private DownloadProgress.Stats _downProgress = new DownloadProgress.Stats(); - private bool _startedRobocopy, _loadedPlugins; + private List _plugins; + private bool _startedRobocopy; /// /// Creates an instance of LoadArms and starts the updating process. @@ -245,11 +246,16 @@ void IPlugin.Update() if (_instance != this) return; - if (!_loadedPlugins && _task.IsComplete) + if (_plugins != null) + { + foreach (IPlugin plugin in _plugins) + plugin.Update(); + } + else if (_task.IsComplete) { Logger.WriteLine("Finished task, loading plugins"); - _loadedPlugins = true; - foreach (IPlugin plugin in LoadPlugins()) + _plugins = LoadPlugins(); + foreach (IPlugin plugin in _plugins) plugin.Init(MySandboxGame.Static); _directory = null; @@ -386,14 +392,6 @@ private List LoadPlugins() foreach (ModVersion mod in _data.ModsCurrentVersions.Values) LoadPlugins(chainedPlugins, mod, loadedMods); - Logger.WriteLine("Adding plugins to MyPlugins"); - - FieldInfo MyPlugins__m_plugins = typeof(MyPlugins).GetField("m_plugins", BindingFlags.Static | BindingFlags.NonPublic); - List allPlugins = (List)MyPlugins__m_plugins.GetValue(null); - allPlugins = new List(allPlugins); - allPlugins.AddList(chainedPlugins); - MyPlugins__m_plugins.SetValue(null, allPlugins); - return chainedPlugins; } diff --git a/Loader/Loader.csproj b/Loader/Loader.csproj index 74b56f8..dc7a408 100644 --- a/Loader/Loader.csproj +++ b/Loader/Loader.csproj @@ -99,7 +99,8 @@ - start cmd.exe /C "$(SolutionDir)\ResolveDependencies.exe" + +