-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCachePatch.cs
More file actions
41 lines (34 loc) · 1.26 KB
/
Copy pathCachePatch.cs
File metadata and controls
41 lines (34 loc) · 1.26 KB
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
35
36
37
38
39
40
41
using SPT.Reflection.Patching;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
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
// clear old cache if it exists
if (hiddenCacheList != null)
{
hiddenCacheList = null;
}
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>();
}
}
}
}