0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 01:50:45 -05:00
modules/project/SPT.Custom/Patches/FixScavWarNullErrorWithMarkOfUnknownPatch.cs
2024-10-03 10:28:48 +01:00

27 lines
797 B
C#

using HarmonyLib;
using SPT.Reflection.Patching;
using System.Reflection;
namespace SPT.Custom.Patches
{
/// <summary>
/// If Scav war is turned on Botsgroup can be null for some reason if null return early to not softlock player.
/// </summary>
public class FixScavWarNullErrorWithMarkOfUnknownPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(BotsGroupMarkOfUnknown), nameof(BotsGroupMarkOfUnknown.Dispose));
}
[PatchPrefix]
public static bool PatchPrefix(BotsGroup ____groups)
{
if (____groups == null)
{
return false; // Skip original
}
return true; // Do original method
}
}
}