embed plugin loader directly into the launcher
This commit is contained in:
26
PluginLoader/Patch/Patch_DisableConfig.cs
Normal file
26
PluginLoader/Patch/Patch_DisableConfig.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using HarmonyLib;
|
||||
using Sandbox;
|
||||
using VRage.Input;
|
||||
|
||||
namespace PluginLoader.Patch;
|
||||
|
||||
[HarmonyPatch(typeof(MySandboxGame), "LoadData")]
|
||||
public static class Patch_DisableConfig
|
||||
{
|
||||
public static void Postfix()
|
||||
{
|
||||
// This is the earliest point in which I can use MyInput.Static
|
||||
if (Main.Instance == null)
|
||||
return;
|
||||
|
||||
var main = Main.Instance;
|
||||
var config = main.Config;
|
||||
if (config != null && config.Count > 0 && MyInput.Static is MyVRageInput &&
|
||||
MyInput.Static.IsKeyPress(MyKeys.Escape)
|
||||
&& LoaderTools.ShowMessageBox("Escape pressed. Start the game with all plugins disabled?",
|
||||
"Plugin Loader", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
main.DisablePlugins();
|
||||
else
|
||||
main.InstantiatePlugins();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user