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

CheckandaddEnemypatch now returns a bool. Set result to not include isAI Checks. Needs testing (!85)

Co-authored-by: Kaeno <e>
Reviewed-on: SPT-AKI/Modules#85
This commit is contained in:
Kaeno 2024-02-22 16:57:57 +00:00
parent e1caef80dc
commit a43ea41a75

View File

@ -15,28 +15,15 @@ namespace Aki.Custom.Patches
/// <summary>
/// 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
/// </summary>
[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
}
}
}