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;
|
2024-01-13 22:08:29 +00:00
|
|
|
|
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
|
|
|
|
{
|
2024-09-20 10:02:44 +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()
|
|
|
|
|
{
|
2024-09-20 10:02:44 +00:00
|
|
|
|
return AccessTools.Method(typeof(ExfiltrationControllerClass), nameof(ExfiltrationControllerClass.EligiblePoints), [typeof(Profile)]);
|
2023-03-03 18:52:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPrefix]
|
2024-08-02 16:57:59 +01:00
|
|
|
|
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-05 15:02:01 -05:00
|
|
|
|
|
2023-03-03 18:52:31 +00:00
|
|
|
|
// Running this prepares all the data for getting scav exfil points
|
2024-01-13 22:08:29 +00:00
|
|
|
|
__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);
|
2024-07-12 15:59:37 +01:00
|
|
|
|
__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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|