[ThirdPerson] Fixed VRSwitch issue, fixed Zoom check NRE

This commit is contained in:
NotAKidoS 2024-04-23 16:59:54 -05:00
parent e12da22513
commit 312ce65a28
3 changed files with 8 additions and 13 deletions

View file

@ -34,7 +34,9 @@ internal static class CameraLogic
get => _state; get => _state;
set set
{ {
if (_state == value) return;
_state = !CheckIsRestricted() && value; _state = !CheckIsRestricted() && value;
if (_state) _storedCamMask = _desktopCam.cullingMask; if (_state) _storedCamMask = _desktopCam.cullingMask;
_desktopCam.cullingMask = _state ? 0 : _storedCamMask; _desktopCam.cullingMask = _state ? 0 : _storedCamMask;
_uiCam.cullingMask = _state ? _uiCam.cullingMask & ~(1 << CVRLayers.PlayerClone) : _uiCam.cullingMask | (1 << CVRLayers.PlayerClone); _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 ScrollDist(float sign) { _dist += sign * 0.25f; RelocateCam(CurrentLocation); }
internal static void AdjustScale(float height) { _scale = height; RelocateCam(CurrentLocation); } internal static void AdjustScale(float height) { _scale = height; RelocateCam(CurrentLocation); }
internal static void CheckVRMode() { if (MetaPort.Instance.isUsingVr) State = false; } internal static void CheckVRMode() { if (MetaPort.Instance.isUsingVr) State = false; }
private static bool CheckIsRestricted() private static bool CheckIsRestricted()
=> !CVRWorld.Instance.enableZoom; => CVRWorld.Instance != null && !CVRWorld.Instance.enableZoom;
internal static bool ShouldNotHideHead_ThirdPerson(Camera cam)
{
if (cam != _desktopCam)
return true; // we dont care
return !State;
}
} }

View file

@ -27,6 +27,6 @@ using System.Reflection;
namespace NAK.ThirdPerson.Properties; namespace NAK.ThirdPerson.Properties;
internal static class AssemblyInfoParams internal static class AssemblyInfoParams
{ {
public const string Version = "1.0.8"; public const string Version = "1.0.9";
public const string Author = "Davi & NotAKidoS"; public const string Author = "Davi & NotAKidoS";
} }

View file

@ -2,7 +2,7 @@
{ {
"_id": 16, "_id": 16,
"name": "ThirdPerson", "name": "ThirdPerson",
"modversion": "1.0.8", "modversion": "1.0.9",
"gameversion": "2024r175", "gameversion": "2024r175",
"loaderversion": "0.6.1", "loaderversion": "0.6.1",
"modtype": "Mod", "modtype": "Mod",
@ -14,9 +14,9 @@
"third person" "third person"
], ],
"requirements": [], "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", "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" "embedcolor": "#F61961"
} }
] ]