From 291820b1eaf5e844b2ef488c20756790c99b8782 Mon Sep 17 00:00:00 2001 From: cheese3660 Date: Sun, 31 Dec 2023 09:54:06 -0500 Subject: [PATCH 1/3] Update swinfo.json --- plugin_template/swinfo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin_template/swinfo.json b/plugin_template/swinfo.json index 571c99b..0fe152e 100644 --- a/plugin_template/swinfo.json +++ b/plugin_template/swinfo.json @@ -15,7 +15,7 @@ { "id": "com.github.x606.spacewarp", "version": { - "min": "1.6.0", + "min": "1.7.0", "max": "*" } } From d848fe6f170f4fb8eb17c38fa48413aee451e108 Mon Sep 17 00:00:00 2001 From: Lexi Date: Wed, 3 Jan 2024 19:22:31 -0500 Subject: [PATCH 2/3] Add a toggleable control range module --- .../Patches/PartComponentModule_CommandPatch.cs | 13 +++++++------ src/WMCCModules/WMCCModulesPlugin.cs | 8 ++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/WMCCModules/Patches/PartComponentModule_CommandPatch.cs b/src/WMCCModules/Patches/PartComponentModule_CommandPatch.cs index 818b187..cce1c79 100644 --- a/src/WMCCModules/Patches/PartComponentModule_CommandPatch.cs +++ b/src/WMCCModules/Patches/PartComponentModule_CommandPatch.cs @@ -10,13 +10,14 @@ namespace WMCCModules.Patches; public class PartComponentModule_CommandPatch { [HarmonyPatch(nameof(PartComponentModule_Command.UpdateControlStatus))] - [HarmonyPrefix] - public static bool UpdateControlStatus(PartComponentModule_Command __instance) + [HarmonyPostfix] + public static void UpdateControlStatus(PartComponentModule_Command __instance) { - if (!__instance.Part.Modules.TryGetValue(typeof(PartComponentModule_ControlRange), out var comp)) return true; + if (!WMCCModulesPlugin.Instance.EnableControlRange.Value) return; + if (!__instance.Part.Modules.TryGetValue(typeof(PartComponentModule_ControlRange), out var comp)) return; var mcr = comp as PartComponentModule_ControlRange; - if (mcr!.DataControlRange == null || mcr.DataControlRange.Controllable) return true; - __instance.dataCommand.controlStatus.SetValue(CommandControlState.NoCommNetConnection); - return false; + if (mcr!.DataControlRange == null || mcr.DataControlRange.Controllable) return; + if (__instance.dataCommand.controlStatus.GetValue() == CommandControlState.FullyFunctional) + __instance.dataCommand.controlStatus.SetValue(CommandControlState.Hibernating); } } \ No newline at end of file diff --git a/src/WMCCModules/WMCCModulesPlugin.cs b/src/WMCCModules/WMCCModulesPlugin.cs index 64ddcdc..bffa327 100644 --- a/src/WMCCModules/WMCCModulesPlugin.cs +++ b/src/WMCCModules/WMCCModulesPlugin.cs @@ -1,7 +1,9 @@ using BepInEx; +using BepInEx.Configuration; using HarmonyLib; using JetBrains.Annotations; using SpaceWarp; +using SpaceWarp.API.Configuration; using SpaceWarp.API.Mods; using WMCCModules.Patches; @@ -18,6 +20,12 @@ public class WMCCModulesPlugin : BaseSpaceWarpPlugin // Singleton instance of the plugin class [PublicAPI] public static WMCCModulesPlugin Instance { get; set; } + public ConfigValue EnableControlRange; + private void Start() + { + EnableControlRange = new ConfigValue(SWConfiguration.Bind("Module Settings", "Enable Control Range", true, + "Enable the control range module (what forces you to lose control in certain situations until you unlock a certain tech node)")); + } /// /// Runs when the mod is first initialized. From 5a73de78a17d01aa0652a0e69c7f999289944022 Mon Sep 17 00:00:00 2001 From: Lexi Date: Wed, 3 Jan 2024 19:23:09 -0500 Subject: [PATCH 3/3] v0.2.0 --- plugin_template/swinfo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin_template/swinfo.json b/plugin_template/swinfo.json index 22b6556..0fe152e 100644 --- a/plugin_template/swinfo.json +++ b/plugin_template/swinfo.json @@ -5,7 +5,7 @@ "name": "Where's My Crew Capsule (Modules)", "description": "The modules used for Where's My Crew Capsule", "source": "https://github.com/cheese3660/WMCCModules", - "version": "0.1.0", + "version": "0.2.0", "version_check": "https://raw.githubusercontent.com/cheese3660/WMCCModules/main/plugin_template/swinfo.json", "ksp2_version": { "min": "0.1.5",