mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using SPT.Reflection.Patching;
|
|
using EFT;
|
|
using System.Reflection;
|
|
using SPT.SinglePlayer.Utils.Insurance;
|
|
using Comfort.Common;
|
|
using HarmonyLib;
|
|
|
|
namespace SPT.SinglePlayer.Patches.RaidFix
|
|
{
|
|
public class InsuredItemManagerStartPatch : ModulePatch
|
|
{
|
|
protected override MethodBase GetTargetMethod()
|
|
{
|
|
return AccessTools.Method(typeof(GameWorld), nameof(GameWorld.OnGameStarted));
|
|
}
|
|
|
|
[PatchPostfix]
|
|
public static void PatchPostFix()
|
|
{
|
|
var gameWorld = Singleton<GameWorld>.Instance;
|
|
|
|
// Starts tracking of insured items manager
|
|
InsuredItemManager.Instance.Init();
|
|
|
|
// Sets PlayerScavs items to FoundInRaid
|
|
ConfigurePlayerScavFindInRaidStatus(gameWorld.MainPlayer);
|
|
}
|
|
|
|
private static void ConfigurePlayerScavFindInRaidStatus(Player player)
|
|
{
|
|
if (player == null || player.Profile.Side != EPlayerSide.Savage)
|
|
{
|
|
return;
|
|
}
|
|
|
|
foreach (var item in player.Profile.Inventory.AllRealPlayerItems)
|
|
{
|
|
item.SpawnedInSession = true;
|
|
}
|
|
}
|
|
}
|
|
}
|