0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00

38 lines
1.6 KiB
C#
Raw Normal View History

2023-03-03 18:52:31 +00:00
using System.Reflection;
2024-05-21 19:10:17 +01:00
using SPT.Reflection.Patching;
2023-03-03 18:52:31 +00:00
using Comfort.Common;
using EFT;
using EFT.Interactive;
using HarmonyLib;
2023-03-03 18:52:31 +00:00
2024-05-21 19:10:17 +01:00
namespace SPT.SinglePlayer.Patches.ScavMode
2023-03-03 18:52:31 +00:00
{
/// <summary>
/// This patch return scav exfils if the player is playing as a scav by adding the player as eligible for the scav specific exfils
/// </summary>
2023-03-03 18:52:31 +00:00
public class ScavExfilPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(ExfiltrationControllerClass), nameof(ExfiltrationControllerClass.EligiblePoints), [typeof(Profile)]);
2023-03-03 18:52:31 +00:00
}
[PatchPrefix]
public static bool PatchPrefix(Profile profile, ExfiltrationControllerClass __instance, ref ExfiltrationPoint[] __result)
2023-03-03 18:52:31 +00:00
{
if (profile.Info.Side != EPlayerSide.Savage)
{
return true; // Not a scav - don't do anything and run original method
}
2023-03-03 18:52:31 +00:00
// Running this prepares all the data for getting scav exfil points
__instance.ScavExfiltrationClaim(((IPlayer)Singleton<GameWorld>.Instance.MainPlayer).Position, profile.Id, profile.FenceInfo.AvailableExitsCount);
2023-03-03 18:52:31 +00:00
// Get the required mask value and retrieve a list of exfil points, setting it as the result
var mask = __instance.GetScavExfiltrationMask(profile.Id);
__result = __instance.ScavExfiltrationClaim(mask, profile.Id);
2023-03-03 18:52:31 +00:00
return false; // Don't run the original method anymore, as that will overwrite our new exfil points with ones meant for a PMC
}
}
}