From 20b17acbed1523e1e4131036c3a8fad57840aa37 Mon Sep 17 00:00:00 2001 From: Kirill Danshin Date: Sun, 5 Apr 2026 23:11:12 +0400 Subject: [PATCH 1/2] feat: Add controller haptic feedback on weapon fire MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patches FirearmController.InitiateShot to trigger haptic feedback on each shot. Primary hand (dominant) always vibrates. Secondary hand vibrates only when supporting the weapon with two hands (isSupporting). Left-handed mode is respected — hand sources are swapped accordingly. --- Patches/Core/Player/WeaponPatches.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Patches/Core/Player/WeaponPatches.cs b/Patches/Core/Player/WeaponPatches.cs index 65e009c..cee841c 100644 --- a/Patches/Core/Player/WeaponPatches.cs +++ b/Patches/Core/Player/WeaponPatches.cs @@ -1345,7 +1345,31 @@ private static void FixCollimatorParallaxEffect(CollimatorSight __instance) } } + [HarmonyPostfix] + [HarmonyPatch(typeof(FirearmController), "InitiateShot")] + private static void ShotHapticFeedback() + { + if (VRGlobals.vrPlayer == null) + { + return; + } + + bool leftHanded = VRSettings.GetLeftHandedMode(); + (SteamVR_Input_Sources primaryHand, SteamVR_Input_Sources secondaryHand) = leftHanded + ? (SteamVR_Input_Sources.LeftHand, SteamVR_Input_Sources.RightHand) + : (SteamVR_Input_Sources.RightHand, SteamVR_Input_Sources.LeftHand); + const float frequency = 1; + const float duration = 0.3f; + const float amplitude = 1.0f; + + SteamVR_Actions._default.Haptic.Execute(0, duration, frequency, amplitude, primaryHand); + + if (VRGlobals.vrPlayer.isSupporting) + { + SteamVR_Actions._default.Haptic.Execute(0, duration, frequency, amplitude, secondaryHand); + } + } } } public static class GameObjectExtensions From d46966222d84cc24c7c97c7951000f6905f759db Mon Sep 17 00:00:00 2001 From: Kirill Danshin Date: Mon, 6 Apr 2026 04:12:13 +0400 Subject: [PATCH 2/2] fix vibration on other players --- Patches/Core/Player/WeaponPatches.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Patches/Core/Player/WeaponPatches.cs b/Patches/Core/Player/WeaponPatches.cs index cee841c..5a0480d 100644 --- a/Patches/Core/Player/WeaponPatches.cs +++ b/Patches/Core/Player/WeaponPatches.cs @@ -1347,9 +1347,9 @@ private static void FixCollimatorParallaxEffect(CollimatorSight __instance) [HarmonyPostfix] [HarmonyPatch(typeof(FirearmController), "InitiateShot")] - private static void ShotHapticFeedback() + private static void ShotHapticFeedback(FirearmController __instance) { - if (VRGlobals.vrPlayer == null) + if (VRGlobals.vrPlayer == null || __instance._player != VRGlobals.player) { return; }