embed plugin loader directly into the launcher

This commit is contained in:
zznty
2022-10-29 01:50:14 +07:00
parent 7204815c0c
commit 66d3dc2ead
53 changed files with 5689 additions and 10 deletions

View 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();
}
}