From a43ea41a75d9f4e8935868bc5fec4574249e2069 Mon Sep 17 00:00:00 2001 From: Kaeno Date: Thu, 22 Feb 2024 16:57:57 +0000 Subject: [PATCH] CheckandaddEnemypatch now returns a bool. Set result to not include isAI Checks. Needs testing (!85) Co-authored-by: Kaeno Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Modules/pulls/85 --- .../Patches/CheckAndAddEnemyPatch.cs | 27 +++++-------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/project/Aki.Custom/Patches/CheckAndAddEnemyPatch.cs b/project/Aki.Custom/Patches/CheckAndAddEnemyPatch.cs index f1ae50d..d53f1c3 100644 --- a/project/Aki.Custom/Patches/CheckAndAddEnemyPatch.cs +++ b/project/Aki.Custom/Patches/CheckAndAddEnemyPatch.cs @@ -15,28 +15,15 @@ namespace Aki.Custom.Patches /// /// CheckAndAddEnemy() /// Goal: This patch lets bosses shoot back once a PMC has shot them - /// removes the !player.AIData.IsAI check + /// Removes the !player.AIData.IsAI check + /// BSG changed the way CheckAndAddEnemy Works in 14.0 Returns a bool now /// [PatchPrefix] - private static bool PatchPrefix(BotsGroup __instance, IPlayer player, ref bool ignoreAI) - { - // Z already has player as enemy BUT Enemies dict is empty, adding them again causes 'existing key' errors - if (__instance.InitialBotType == WildSpawnType.bossZryachiy || __instance.InitialBotType == WildSpawnType.followerZryachiy) - { - return false; - } - - if (!player.HealthController.IsAlive) - { - return false; // Skip original - } - - if (!__instance.Enemies.ContainsKey(player)) - { - __instance.AddEnemy(player, EBotEnemyCause.checkAddTODO); - } - - return false; // Skip original + private static bool PatchPrefix(BotsGroup __instance, IPlayer player, ref bool __result) + { + // Set result to not include !player.AIData.IsAI checks + __result = player.HealthController.IsAlive && !__instance.Enemies.ContainsKey(player) && __instance.AddEnemy(player, EBotEnemyCause.checkAddTODO); + return false; // Skip Original } } }