0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
modules/project/Aki.SinglePlayer/Patches/RaidFix/InsuredItemManagerStartPatch.cs
chomp 1e238c426e 0.13.5.0 (!33)
Co-authored-by: Dev <dev@dev.sp-tarkov.com>
Co-authored-by: CWX <CWX@noreply.dev.sp-tarkov.com>
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-authored-by: RaiRaiTheRaichu <rairaitheraichu@noreply.dev.sp-tarkov.com>
Co-authored-by: CWX <cwx@noreply.dev.sp-tarkov.com>
Co-authored-by: Kaeno <e>
Reviewed-on: SPT-AKI/Modules#33
2023-10-10 10:58:33 +00:00

42 lines
1.2 KiB
C#

using Aki.Reflection.Patching;
using EFT;
using System.Reflection;
using Aki.SinglePlayer.Utils.Insurance;
using Comfort.Common;
namespace Aki.SinglePlayer.Patches.RaidFix
{
public class InsuredItemManagerStartPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(GameWorld).GetMethod(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;
}
}
}
}