0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-12 22:10:45 -05:00

Only add Z and follower to list if they dont exist already

Call `CheckAndAddEnemy` instead of `AddEnemy` - use additional checks
This commit is contained in:
Dev 2023-07-30 13:47:51 +01:00
parent 584215e2b4
commit 37e356c430
2 changed files with 8 additions and 2 deletions

View File

@ -7,6 +7,9 @@ namespace Aki.Custom.Patches
{
public class OfflineRaidSettingsMenuPatch : ModulePatch
{
/// <summary>
/// RaidSettingsWindow.Show()
/// </summary>
protected override MethodBase GetTargetMethod()
{
var desiredType = typeof(RaidSettingsWindow);

View File

@ -163,7 +163,10 @@ namespace Aki.SinglePlayer.Models.Progression
};
// Save bot to list for later access
_zryachiyAndFollowers.Add(aiBot);
if (!_zryachiyAndFollowers.Contains(aiBot))
{
_zryachiyAndFollowers.Add(aiBot);
}
}
}
}
@ -176,7 +179,7 @@ namespace Aki.SinglePlayer.Models.Progression
// If player is a scav, they must be added to the bosses enemy list otherwise they wont kill them
foreach (var bot in _zryachiyAndFollowers)
{
bot.AIData.BotOwner.BotsGroup.AddEnemy(_player);
bot.AIData.BotOwner.BotsGroup.CheckAndAddEnemy(_player);
}
// Flag player was added to enemy list