[ThirdPerson] Fix for game issue, reset player camera culling mask to default on world load.

This commit is contained in:
NotAKidoS 2023-09-25 14:08:05 -05:00
parent afb44fc3a7
commit 53c369b950
4 changed files with 66 additions and 47 deletions

View file

@ -13,11 +13,12 @@ internal static class Patches
{
harmony.Patch(
typeof(CVRWorld).GetMethod(nameof(CVRWorld.SetDefaultCamValues), BindingFlags.NonPublic | BindingFlags.Instance),
postfix: typeof(Patches).GetMethod(nameof(OnWorldStart), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
postfix: typeof(Patches).GetMethod(nameof(OnPostWorldStart), 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()
prefix: typeof(Patches).GetMethod(nameof(OnPreWorldStart), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod(),
postfix: typeof(Patches).GetMethod(nameof(OnPostWorldStart), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
);
harmony.Patch(
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.SetupIKScaling), BindingFlags.NonPublic | BindingFlags.Instance),
@ -30,7 +31,8 @@ internal static class Patches
}
//Copy camera settings & postprocessing components
private static void OnWorldStart() => CopyPlayerCamValues();
private static void OnPreWorldStart() => ResetPlayerCamValues();
private static void OnPostWorldStart() => CopyPlayerCamValues();
//Adjust camera distance with height as modifier
private static void OnScaleAdjusted(float height) => AdjustScale(height);
private static void OnConfigureHudAffinity() => CheckVRMode();