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 ce307c7..10173ae 100644 --- a/project/SPT.Custom/SPTCustomPlugin.cs +++ b/project/SPT.Custom/SPTCustomPlugin.cs @@ -81,6 +81,7 @@ namespace SPT.Custom new InsurancePlaceItem().Enable(); new FileCachePatch().Enable(); new PMCSpawnParamPatch().Enable(); + new FixBotgroupMarkofTheUnknown().Enable(); HookObject.AddOrGetComponent(); }