NAK_CVR_Mods/ThirdPerson/Patches.cs
NotAKidoS 82eeced7cc [ThirdPerson] Set camera cull mask instead of disabling
Least hacky fix to correct nameplate issue.
2023-05-07 22:19:15 -05:00

31 lines
No EOL
1.4 KiB
C#

using ABI.CCK.Components;
using ABI_RC.Core.Player;
using MelonLoader;
using System.Reflection;
using static NAK.ThirdPerson.CameraLogic;
namespace NAK.ThirdPerson;
internal static class Patches
{
internal static void Apply(HarmonyLib.Harmony harmony)
{
harmony.Patch(
typeof(CVRWorld).GetMethod(nameof(CVRWorld.SetDefaultCamValues), BindingFlags.NonPublic | BindingFlags.Instance),
postfix: typeof(Patches).GetMethod(nameof(OnWorldStart), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
);
harmony.Patch(
typeof(CVRWorld).GetMethod(nameof(CVRWorld.CopyRefCamValues), BindingFlags.NonPublic | BindingFlags.Instance),
postfix: typeof(Patches).GetMethod(nameof(OnWorldStart), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
);
harmony.Patch(
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.SetupIKScaling), BindingFlags.NonPublic | BindingFlags.Instance),
postfix: typeof(Patches).GetMethod(nameof(OnScaleAdjusted), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
);
}
//Copy camera settings & postprocessing components
private static void OnWorldStart() => CopyPlayerCamValues();
//Adjust camera distance with height as modifier
private static void OnScaleAdjusted(float height) => AdjustScale(height);
}