mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 05:50: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:
parent
e1caef80dc
commit
a43ea41a75
@ -15,28 +15,15 @@ namespace Aki.Custom.Patches
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// CheckAndAddEnemy()
|
/// CheckAndAddEnemy()
|
||||||
/// Goal: This patch lets bosses shoot back once a PMC has shot them
|
/// 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>
|
/// </summary>
|
||||||
[PatchPrefix]
|
[PatchPrefix]
|
||||||
private static bool PatchPrefix(BotsGroup __instance, IPlayer player, ref bool ignoreAI)
|
private static bool PatchPrefix(BotsGroup __instance, IPlayer player, ref bool __result)
|
||||||
{
|
{
|
||||||
// Z already has player as enemy BUT Enemies dict is empty, adding them again causes 'existing key' errors
|
// Set result to not include !player.AIData.IsAI checks
|
||||||
if (__instance.InitialBotType == WildSpawnType.bossZryachiy || __instance.InitialBotType == WildSpawnType.followerZryachiy)
|
__result = player.HealthController.IsAlive && !__instance.Enemies.ContainsKey(player) && __instance.AddEnemy(player, EBotEnemyCause.checkAddTODO);
|
||||||
{
|
return false; // Skip Original
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player.HealthController.IsAlive)
|
|
||||||
{
|
|
||||||
return false; // Skip original
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!__instance.Enemies.ContainsKey(player))
|
|
||||||
{
|
|
||||||
__instance.AddEnemy(player, EBotEnemyCause.checkAddTODO);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false; // Skip original
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user