From 4ae4e8af5f2351689bae65d8eaea15968c4c5a02 Mon Sep 17 00:00:00 2001 From: Kaeno Date: Sun, 7 Jul 2024 09:24:33 +0000 Subject: [PATCH] Add patch --- .../Patches/FixBotgroupMarkofTheUnknown.cs | 31 +++++++++++++++++++ project/SPT.Custom/SPTCustomPlugin.cs | 1 + 2 files changed, 32 insertions(+) create mode 100644 project/SPT.Custom/Patches/FixBotgroupMarkofTheUnknown.cs diff --git a/project/SPT.Custom/Patches/FixBotgroupMarkofTheUnknown.cs b/project/SPT.Custom/Patches/FixBotgroupMarkofTheUnknown.cs new file mode 100644 index 0000000..501f656 --- /dev/null +++ b/project/SPT.Custom/Patches/FixBotgroupMarkofTheUnknown.cs @@ -0,0 +1,31 @@ +using HarmonyLib; +using SPT.Reflection.Patching; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace SPT.Custom.Patches +{ + /// + /// If Scav war is turned on Botsgroup can be null for some reason if null return early to not softlock player. + /// + public class FixBotgroupMarkofTheUnknown : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + return AccessTools.Method(typeof(BotsGroupMarkOfUnknown), nameof(BotsGroupMarkOfUnknown.Dispose)); + } + [PatchPrefix] + private static bool PatchPrefix(BotsGroup ____groups) + { + if (____groups == null) + { + return false; + } + return true; + } + } +} diff --git a/project/SPT.Custom/SPTCustomPlugin.cs b/project/SPT.Custom/SPTCustomPlugin.cs index dca70ec..caa7d67 100644 --- a/project/SPT.Custom/SPTCustomPlugin.cs +++ b/project/SPT.Custom/SPTCustomPlugin.cs @@ -57,6 +57,7 @@ namespace SPT.Custom new BossSpawnChancePatch().Enable(); new LocationLootCacheBustingPatch().Enable(); new VersionLabelPatch().Enable(); + new FixBotgroupMarkofTheUnknown().Enable(); HookObject.AddOrGetComponent(); }