[ThirdPerson] Prevent scrolling when holding CTRL

This commit is contained in:
NotAKidoS 2023-05-30 12:43:43 -05:00
parent 84a096bc8e
commit 1025c5667c
3 changed files with 13 additions and 10 deletions

View file

@ -18,14 +18,17 @@ public class ThirdPerson : MelonMod
public override void OnUpdate()
{
// Prevents scrolling while in Menus or UnityExplorer
if (State && Cursor.lockState == CursorLockMode.Locked)
// Prevents scrolling while using Effector/BetterInteractDesktop
if (!Input.GetKey(KeyCode.LeftControl))
{
float scroll = Input.GetAxis("Mouse ScrollWheel");
if (scroll != 0f) ScrollDist(Mathf.Sign(scroll));
// Prevents scrolling while in Menus or UnityExplorer
if (State && Cursor.lockState == CursorLockMode.Locked)
{
float scroll = Input.GetAxis("Mouse ScrollWheel");
if (scroll != 0f) ScrollDist(Mathf.Sign(scroll));
}
return;
}
if (!Input.GetKey(KeyCode.LeftControl)) return;
if (Input.GetKeyDown(KeyCode.T)) State = !State;
if (!State || !Input.GetKeyDown(KeyCode.Y)) return;
RelocateCam((CameraLocation)(((int)CurrentLocation + (Input.GetKey(KeyCode.LeftShift) ? -1 : 1) + Enum.GetValues(typeof(CameraLocation)).Length) % Enum.GetValues(typeof(CameraLocation)).Length), true);