Repository navigation
Expand file tree
/
Copy pathPlugin.cs
More file actions
40 lines (33 loc) · 1.5 KB
/
Copy pathPlugin.cs
File metadata and controls
40 lines (33 loc) · 1.5 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
using BepInEx;
using HarmonyLib;
using static BepInEx.BepInDependency;
namespace LCVR_bugfixes
{
[BepInPlugin(modGUID, modName, modVersion)]
[BepInDependency("io.daxcess.lcvr", DependencyFlags.HardDependency)]
public class LCVR_bugfixes : BaseUnityPlugin
{
private const string modGUID = "CubeMath.LCVRBugfixes";
private const string modName = "LCVR Bugfixes";
private const string modVersion = "1.0.1";
private readonly Harmony harmony = new Harmony(modGUID);
// Using Start instead of Awake to make sure LCVR is fully loaded.
void Start()
{
var targetType = AccessTools.TypeByName("LCVR.UI.Spectating.SpectatingMenu");
if (targetType == null)
{
Logger.LogWarning("Failed to init LCVR Bugfixes.");
return;
}
var transpiler = AccessTools.Method(typeof(SpectatingMenuPatch), "Transpiler");
var transpilerMethod = new HarmonyMethod(transpiler);
// AccessTools automatically handles private/non-public methods
var handleGaze = AccessTools.Method(targetType, "HandleGaze");
var createRayReceiver = AccessTools.Method(targetType, "CreateRayReceiver");
harmony.Patch(handleGaze, transpiler: transpilerMethod);
harmony.Patch(createRayReceiver, transpiler: transpilerMethod);
Logger.LogInfo("Nutcrackers are no longer blind towards VR people.");
}
}
}