forked from RaiRaiTheRaichu/HiddenCaches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCachePatch.cs
34 lines (28 loc) · 1.08 KB
/
CachePatch.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Aki.Reflection.Patching;
using System.Linq;
using System.Reflection;
using UnityEngine;
namespace RaiRai.HiddenCaches
{
public class CachePatch : ModulePatch
{
internal static System.Collections.Generic.IEnumerable<EFT.Interactive.LootableContainer> hiddenCacheList;
protected override MethodBase GetTargetMethod()
{
return typeof(EFT.GameWorld).GetMethod("OnGameStarted", BindingFlags.Public | BindingFlags.Instance);
}
[PatchPostfix]
private static void AddComponentToCaches()
{
// scontainer_wood_CAP
// scontainer_Blue_Barrel_Base_Cap
hiddenCacheList = Object.FindObjectsOfType<EFT.Interactive.LootableContainer>().Where( x =>
x.name.StartsWith("scontainer_wood_CAP")
|| x.name.StartsWith("scontainer_Blue_Barrel_Base_Cap"));
foreach (var lootableContainer in hiddenCacheList)
{
lootableContainer.GetOrAddComponent<FlareComponent>();
}
}
}
}