From 1025c5667c846fae1099b68cfbcb1f8fdcba2575 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Tue, 30 May 2023 12:43:43 -0500 Subject: [PATCH] [ThirdPerson] Prevent scrolling when holding CTRL --- ThirdPerson/ThirdPerson.cs | 15 +++++++++------ ThirdPerson/ThirdPerson.csproj | 2 +- ThirdPerson/format.json | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ThirdPerson/ThirdPerson.cs b/ThirdPerson/ThirdPerson.cs index fb4a480..8c8917d 100644 --- a/ThirdPerson/ThirdPerson.cs +++ b/ThirdPerson/ThirdPerson.cs @@ -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); diff --git a/ThirdPerson/ThirdPerson.csproj b/ThirdPerson/ThirdPerson.csproj index 5949b0b..13a6b34 100644 --- a/ThirdPerson/ThirdPerson.csproj +++ b/ThirdPerson/ThirdPerson.csproj @@ -1,2 +1,2 @@  - + diff --git a/ThirdPerson/format.json b/ThirdPerson/format.json index 4caeef0..4ff93b4 100644 --- a/ThirdPerson/format.json +++ b/ThirdPerson/format.json @@ -2,7 +2,7 @@ { "_id": 16, "name": "ThirdPerson", - "modversion": "1.0.2", + "modversion": "1.0.3", "gameversion": "2022r170", "loaderversion": "0.5.7", "modtype": "Mod", @@ -14,9 +14,9 @@ "third person" ], "requirements": [], - "downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r3/ThirdPerson.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r8/ThirdPerson.dll", "sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/ThirdPerson", - "changelog": "- Disable desktop camera while in thirdperson for performance.\n- Add cycle backward modifier while holding Shift.\n- Fixed bug where loading into a world in thirdperson broke nameplates. (imagine using Camera.main)", + "changelog": "- Submit changes I made three weeks ago and forgot about... no longer disables desktop camera, so no more null ref errors with nameplates & camera indicator.", "embedcolor": "F61961" } ] \ No newline at end of file