2024-07-07 09:24:33 +00:00
|
|
|
|
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>
|
2024-08-25 09:24:10 +01:00
|
|
|
|
public class FixScavWarNullErrorWithMarkOfUnknownPatch : ModulePatch
|
2024-07-07 09:24:33 +00:00
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
|
|
|
|
return AccessTools.Method(typeof(BotsGroupMarkOfUnknown), nameof(BotsGroupMarkOfUnknown.Dispose));
|
|
|
|
|
}
|
|
|
|
|
[PatchPrefix]
|
2024-08-02 16:57:59 +01:00
|
|
|
|
public static bool PatchPrefix(BotsGroup ____groups)
|
2024-07-07 09:24:33 +00:00
|
|
|
|
{
|
|
|
|
|
if (____groups == null)
|
|
|
|
|
{
|
2024-10-03 10:28:48 +01:00
|
|
|
|
return false; // Skip original
|
2024-07-07 09:24:33 +00:00
|
|
|
|
}
|
2024-08-28 12:52:54 +01:00
|
|
|
|
return true; // Do original method
|
2024-07-07 09:24:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|