2024-06-06 16:59:53 +00:00
|
|
|
|
using EFT;
|
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using SPT.Reflection.Patching;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
|
|
namespace SPT.Custom.Patches
|
|
|
|
|
{
|
|
|
|
|
public class PMCSpawnParamPatch : ModulePatch
|
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
|
|
|
|
return AccessTools.Method(typeof(BotSpawner), nameof(BotSpawner.GetGroupAndSetEnemies));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPrefix]
|
|
|
|
|
private static void PatchPrefix(BotOwner bot)
|
|
|
|
|
{
|
2024-06-27 14:09:36 +00:00
|
|
|
|
// is a boss and not a follower and not a PMC
|
|
|
|
|
if (!bot.Profile.Info.Settings.IsBoss() && !CustomAI.AiHelpers.BotIsSptPmc(bot.Profile.Info.Settings.Role, bot))
|
2024-06-06 16:59:53 +00:00
|
|
|
|
{
|
2024-06-27 14:09:36 +00:00
|
|
|
|
return;
|
2024-07-06 10:23:41 +01:00
|
|
|
|
}
|
|
|
|
|
|
2024-06-27 14:09:36 +00:00
|
|
|
|
// is a boss and follower and a pmc
|
|
|
|
|
if (bot.SpawnProfileData.SpawnParams == null)
|
|
|
|
|
{
|
|
|
|
|
bot.SpawnProfileData.SpawnParams = new BotSpawnParams();
|
|
|
|
|
}
|
2024-07-06 10:23:41 +01:00
|
|
|
|
|
2024-06-27 14:09:36 +00:00
|
|
|
|
if (bot.SpawnProfileData.SpawnParams.ShallBeGroup == null)
|
|
|
|
|
{
|
|
|
|
|
bot.SpawnProfileData.SpawnParams.ShallBeGroup = new ShallBeGroupParams(false, false);
|
2024-06-06 16:59:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|