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
|
|
|
|
{
|
|
|
|
|
public class ScavExfilPatch : ModulePatch
|
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
2024-01-13 22:08:29 +00:00
|
|
|
|
return AccessTools.Method(typeof(ExfiltrationControllerClass), nameof(ExfiltrationControllerClass.EligiblePoints), new[] { 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
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-18 13:31:26 +01:00
|
|
|
|
if (__instance.ScavExfiltrationPoints.Length > 0)
|
2023-03-05 15:02:01 -05:00
|
|
|
|
{
|
2024-09-18 13:31:26 +01:00
|
|
|
|
Logger.LogError($"ScavExfiltrationPoints has content, Do original");
|
|
|
|
|
foreach (var scavExit in __instance.ScavExfiltrationPoints)
|
|
|
|
|
{
|
|
|
|
|
Logger.LogError($"{scavExit.name}, {scavExit.Id}, {scavExit.Description}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true; // do original
|
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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|