mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
overcomplicate
This commit is contained in:
parent
b87047df2f
commit
c42e28f340
3 changed files with 11 additions and 3 deletions
|
@ -1,7 +1,9 @@
|
||||||
using ABI.CCK.Components;
|
using ABI.CCK.Components;
|
||||||
using ABI_RC.Core.Player;
|
using ABI_RC.Core.Player;
|
||||||
|
using ABI_RC.Core.Util.Object_Behaviour;
|
||||||
using MelonLoader;
|
using MelonLoader;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using UnityEngine;
|
||||||
using static NAK.ThirdPerson.CameraLogic;
|
using static NAK.ThirdPerson.CameraLogic;
|
||||||
|
|
||||||
namespace NAK.ThirdPerson;
|
namespace NAK.ThirdPerson;
|
||||||
|
@ -22,9 +24,16 @@ internal static class Patches
|
||||||
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.SetupIKScaling), BindingFlags.NonPublic | BindingFlags.Instance),
|
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.SetupIKScaling), BindingFlags.NonPublic | BindingFlags.Instance),
|
||||||
postfix: typeof(Patches).GetMethod(nameof(OnScaleAdjusted), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
|
postfix: typeof(Patches).GetMethod(nameof(OnScaleAdjusted), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
|
||||||
);
|
);
|
||||||
|
harmony.Patch(
|
||||||
|
typeof(CameraFacingObject).GetMethod(nameof(CameraFacingObject.Start), BindingFlags.NonPublic | BindingFlags.Instance),
|
||||||
|
postfix: typeof(Patches).GetMethod(nameof(OnCameraFacingObjectStart), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Copy camera settings & postprocessing components
|
//Copy camera settings & postprocessing components
|
||||||
private static void OnWorldStart() => CopyPlayerCamValues();
|
private static void OnWorldStart() => CopyPlayerCamValues();
|
||||||
|
//Adjust camera distance with height as modifier
|
||||||
private static void OnScaleAdjusted(float height) => AdjustScale(height);
|
private static void OnScaleAdjusted(float height) => AdjustScale(height);
|
||||||
|
//Fix bug when in thirdperson and desktop camera is disabled for performance
|
||||||
|
private static void OnCameraFacingObjectStart(ref Camera ___m_Camera) { if (___m_Camera == null) ___m_Camera = PlayerSetup.Instance.GetActiveCamera().GetComponent<Camera>(); }
|
||||||
}
|
}
|
|
@ -44,7 +44,6 @@ public class ThirdPerson : MelonMod
|
||||||
if (!Input.GetKey(KeyCode.LeftControl)) return;
|
if (!Input.GetKey(KeyCode.LeftControl)) return;
|
||||||
if (Input.GetKeyDown(KeyCode.T)) State = !State;
|
if (Input.GetKeyDown(KeyCode.T)) State = !State;
|
||||||
if (!State || !Input.GetKeyDown(KeyCode.Y)) return;
|
if (!State || !Input.GetKeyDown(KeyCode.Y)) return;
|
||||||
int cycle = Input.GetKeyDown(KeyCode.LeftShift) ? -1 : 1;
|
RelocateCam((CameraLocation)(((int)CurrentLocation + (Input.GetKey(KeyCode.LeftShift) ? -1 : 1) + Enum.GetValues(typeof(CameraLocation)).Length) % Enum.GetValues(typeof(CameraLocation)).Length), true);
|
||||||
RelocateCam((CameraLocation)(((int)CurrentLocation + cycle) % Enum.GetValues(typeof(CameraLocation)).Length), true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue