From 312ce65a285998d09b05638efcef66292e92a7a2 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Tue, 23 Apr 2024 16:59:54 -0500 Subject: [PATCH] [ThirdPerson] Fixed VRSwitch issue, fixed Zoom check NRE --- ThirdPerson/CameraLogic.cs | 13 ++++--------- ThirdPerson/Properties/AssemblyInfo.cs | 2 +- ThirdPerson/format.json | 6 +++--- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/ThirdPerson/CameraLogic.cs b/ThirdPerson/CameraLogic.cs index cad39b2..24d10c5 100644 --- a/ThirdPerson/CameraLogic.cs +++ b/ThirdPerson/CameraLogic.cs @@ -34,7 +34,9 @@ internal static class CameraLogic get => _state; set { + if (_state == value) return; _state = !CheckIsRestricted() && value; + if (_state) _storedCamMask = _desktopCam.cullingMask; _desktopCam.cullingMask = _state ? 0 : _storedCamMask; _uiCam.cullingMask = _state ? _uiCam.cullingMask & ~(1 << CVRLayers.PlayerClone) : _uiCam.cullingMask | (1 << CVRLayers.PlayerClone); @@ -114,14 +116,7 @@ internal static class CameraLogic internal static void ScrollDist(float sign) { _dist += sign * 0.25f; RelocateCam(CurrentLocation); } internal static void AdjustScale(float height) { _scale = height; RelocateCam(CurrentLocation); } internal static void CheckVRMode() { if (MetaPort.Instance.isUsingVr) State = false; } + private static bool CheckIsRestricted() - => !CVRWorld.Instance.enableZoom; - - internal static bool ShouldNotHideHead_ThirdPerson(Camera cam) - { - if (cam != _desktopCam) - return true; // we dont care - - return !State; - } + => CVRWorld.Instance != null && !CVRWorld.Instance.enableZoom; } \ No newline at end of file diff --git a/ThirdPerson/Properties/AssemblyInfo.cs b/ThirdPerson/Properties/AssemblyInfo.cs index ad57b1b..7c6190b 100644 --- a/ThirdPerson/Properties/AssemblyInfo.cs +++ b/ThirdPerson/Properties/AssemblyInfo.cs @@ -27,6 +27,6 @@ using System.Reflection; namespace NAK.ThirdPerson.Properties; internal static class AssemblyInfoParams { - public const string Version = "1.0.8"; + public const string Version = "1.0.9"; public const string Author = "Davi & NotAKidoS"; } \ No newline at end of file diff --git a/ThirdPerson/format.json b/ThirdPerson/format.json index 74f7a12..775fe9c 100644 --- a/ThirdPerson/format.json +++ b/ThirdPerson/format.json @@ -2,7 +2,7 @@ { "_id": 16, "name": "ThirdPerson", - "modversion": "1.0.8", + "modversion": "1.0.9", "gameversion": "2024r175", "loaderversion": "0.6.1", "modtype": "Mod", @@ -14,9 +14,9 @@ "third person" ], "requirements": [], - "downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r25/ThirdPerson.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r26/ThirdPerson.dll", "sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/ThirdPerson", - "changelog": "- Recompiled to work with 2024r175", + "changelog": "- Fixed an issue where VR Switching without using ThirdPerson prior would incorrectly set the Desktop camera culling mask to 0\n- Fixed an NRE when checking CVRWorld zoom rule when no CVRWorld instance was found", "embedcolor": "#F61961" } ] \ No newline at end of file