From f6e80a7a895619ce3d28de3c2ce3d0f892de3e5b Mon Sep 17 00:00:00 2001 From: DaXcess Date: Tue, 6 Aug 2024 22:11:14 +0200 Subject: [PATCH] Fix positioning bug, nerfed muffling, increased turning speed --- CHANGELOG.md | 1 + Source/Input/SmoothTurningProvider.cs | 2 +- Source/Physics/Interactions/Face.cs | 4 ++-- Source/Physics/Interactions/Muffler.cs | 17 +++++++++++------ Source/Player/VRPlayer.cs | 9 +++------ 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5bc85cd..3be0fd28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,7 @@ Some bindings are blacklisted from being used, mostly the "touched" bindings on - XR Origin now has the same parent as the local player - Reworked a small portion of the 6DOF system to allow 6DOF when parented to other objects - Resetting height now also resets your rotation if you are in a special interact animation (i.e. terminal, car, enemy kill animation) +- Doubled the base rotation speed on the Smooth Rotation setting **Removals**: diff --git a/Source/Input/SmoothTurningProvider.cs b/Source/Input/SmoothTurningProvider.cs index 953afdd2..a1128a70 100644 --- a/Source/Input/SmoothTurningProvider.cs +++ b/Source/Input/SmoothTurningProvider.cs @@ -15,7 +15,7 @@ public void Update() if (!shouldExecute) return; - var totalRotation = (value > 0 ? 90 : -90) * Time.deltaTime * Plugin.Config.SmoothTurnSpeedModifier.Value; + var totalRotation = (value > 0 ? 180 : -180) * Time.deltaTime * Plugin.Config.SmoothTurnSpeedModifier.Value; offset += totalRotation; } diff --git a/Source/Physics/Interactions/Face.cs b/Source/Physics/Interactions/Face.cs index 8e8016d2..b3adc211 100644 --- a/Source/Physics/Interactions/Face.cs +++ b/Source/Physics/Interactions/Face.cs @@ -19,7 +19,7 @@ public class Face : MonoBehaviour, VRInteractable ]; private GrabbableObject heldItem; - private bool isInteracting = false; + private bool isInteracting; private Coroutine stopInteractingCoroutine; @@ -59,7 +59,7 @@ public void OnColliderEnter(VRInteractor _) isInteracting = true; heldItem = item; - heldItem.UseItemOnClient(true); + heldItem.UseItemOnClient(); } public void OnColliderExit(VRInteractor _) diff --git a/Source/Physics/Interactions/Muffler.cs b/Source/Physics/Interactions/Muffler.cs index 4f2a8128..e9bfbfee 100644 --- a/Source/Physics/Interactions/Muffler.cs +++ b/Source/Physics/Interactions/Muffler.cs @@ -27,13 +27,17 @@ public class Muffler : MonoBehaviour, VRInteractable public InteractableFlags Flags => InteractableFlags.BothHands; public bool Muffled { get; private set; } - + private void Update() { - if (Muffled) - counter = Mathf.Min(counter + Time.deltaTime * 2, MAX_COUNTER); - else - counter = Mathf.Max(counter - Time.deltaTime, 0); + counter = Muffled + ? Mathf.Min(counter + Time.deltaTime * 2, MAX_COUNTER) + : Mathf.Max(counter - Time.deltaTime, 0); + + // Disable muffle if we picked up a two-handed item while muffled + if (Muffled && VRSession.Instance.LocalPlayer.PlayerController.currentlyHeldObjectServer is { } heldObject && + heldObject.itemProperties.twoHanded) + Muffled = false; VRSession.Instance.VolumeManager.Muffle(counter); } @@ -79,7 +83,8 @@ private IEnumerator delayedStopMuffle(VRInteractor interactor) { yield return new WaitForSeconds(0.5f); - interactor.Vibrate(0.2f, 0.1f); + if (Muffled) + interactor.Vibrate(0.2f, 0.1f); Muffled = false; DNet.SetMuffled(false); diff --git a/Source/Player/VRPlayer.cs b/Source/Player/VRPlayer.cs index a5cc81b4..8437197a 100644 --- a/Source/Player/VRPlayer.cs +++ b/Source/Player/VRPlayer.cs @@ -389,10 +389,10 @@ PlayerController.currentTriggerInAnimationWith is not null && TurningProvider.SetOffset(offset); specialAnimationPositionOffset = Quaternion.Euler(0, offset, 0) * - ( - new Vector3(mainCamera.transform.localPosition.x, 0, - mainCamera.transform.localPosition.z) * -SCALE_FACTOR) + (new Vector3(mainCamera.transform.localPosition.x, 0, + mainCamera.transform.localPosition.z) * -SCALE_FACTOR) .Divide(transform.parent.localScale); + isSprinting = false; } @@ -414,9 +414,6 @@ PlayerController.currentTriggerInAnimationWith is not null && var movementAccounted = rotationOffset * movement; var cameraPosAccounted = rotationOffset * new Vector3(mainCamera.transform.localPosition.x, 0, mainCamera.transform.localPosition.z); - if (!wasInSpecialAnimation && PlayerController.inSpecialInteractAnimation) - specialAnimationPositionOffset = new Vector3(-cameraPosAccounted.x * SCALE_FACTOR, 0, -cameraPosAccounted.z * SCALE_FACTOR); - wasInSpecialAnimation = PlayerController.inSpecialInteractAnimation; wasInEnemyAnimation = PlayerController.inAnimationWithEnemy is not null;