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

View file

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk"/> <Project Sdk="Microsoft.NET.Sdk" />

View file

@ -2,7 +2,7 @@
{ {
"_id": 16, "_id": 16,
"name": "ThirdPerson", "name": "ThirdPerson",
"modversion": "1.0.2", "modversion": "1.0.3",
"gameversion": "2022r170", "gameversion": "2022r170",
"loaderversion": "0.5.7", "loaderversion": "0.5.7",
"modtype": "Mod", "modtype": "Mod",
@ -14,9 +14,9 @@
"third person" "third person"
], ],
"requirements": [], "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", "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" "embedcolor": "F61961"
} }
] ]