mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 01:50:45 -05:00
310-dev (!168)
This adds a patch that enforces PMC AI to be hostile towards scavs. From my testing they were not attacking random scavs and the player because the boolean failed at the attached screenshot due to PMCs being bosses and the loyalty check. Now it checks if the initial bot type of the group was a PMC Bear or USEC and then if the player it checks for is a scav, they will be forced to be an enemy (which to me seemed natural). ![image](/attachments/4a73df0f-7030-4c61-869f-0a20ba804d8b) I've tested this on 3 raids on customs and it seems to work fine. Feel free to edit the PR if the logic is flawed, and please test the patch thoroughly to ensure my tests were not just lucky. Thanks! Co-authored-by: Lacyway <20912169+Lacyway@users.noreply.github.com> Reviewed-on: SPT/Modules#168 Co-authored-by: Lacyway <lacyway@noreply.dev.sp-tarkov.com> Co-committed-by: Lacyway <lacyway@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
6ea4ac6fed
commit
e76ee6f2cc
@ -0,0 +1,29 @@
|
||||
using EFT;
|
||||
using HarmonyLib;
|
||||
using SPT.Reflection.Patching;
|
||||
using System.Reflection;
|
||||
|
||||
namespace SPT.SinglePlayer.Patches.ScavMode
|
||||
{
|
||||
/// <summary>
|
||||
/// This patch ensures that PMC AI is always hostile towards the player and scavs if the player it checks is a <see cref="EPlayerSide.Savage"/> (scav)
|
||||
/// </summary>
|
||||
public class ScavIsPlayerEnemyPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return AccessTools.Method(typeof(BotsGroup), nameof(BotsGroup.IsPlayerEnemy));
|
||||
}
|
||||
|
||||
[PatchPrefix]
|
||||
public static bool Prefix(BotsGroup __instance, IPlayer player, ref bool __result)
|
||||
{
|
||||
if (player.Side is EPlayerSide.Savage && __instance.InitialBotType is WildSpawnType.pmcBEAR or WildSpawnType.pmcUSEC)
|
||||
{
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -60,6 +60,7 @@ namespace SPT.SinglePlayer
|
||||
new RemoveStashUpgradeLabelPatch().Enable();
|
||||
new RemoveClothingItemExternalObtainLabelPatch().Enable();
|
||||
new FixLocalRaidPatch().Enable();
|
||||
new ScavIsPlayerEnemyPatch().Enable();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user