@@ -13,8 +13,8 @@ namespace TABGVR.Patches.Interactions;
1313[ HarmonyPatch ( typeof ( Holding ) ) ]
1414internal class KinematicsPatch
1515{
16- internal static bool _gripAvailable ;
17- internal static bool _gripping ;
16+ internal static bool GripAvailable ;
17+ internal static bool Gripping ;
1818
1919 /// <summary>
2020 /// Sets up hand connection for joint by removing properties that cause issues.
@@ -71,40 +71,40 @@ private static void PositionLeftHandToHandguard(Holding holding)
7171 /// <summary>
7272 /// Sets up hands for VR IK after Holding.Start.
7373 /// </summary>
74- /// <param name="__instance ">Holding Script</param>
74+ /// <param name="instance ">Holding Script</param>
7575 [ HarmonyPatch ( nameof ( Holding . Start ) ) ]
7676 [ HarmonyPostfix ]
77- private static void StartPostfix ( Holding __instance )
77+ private static void StartPostfix ( Holding instance )
7878 {
79- if ( __instance . m_player == global ::Player . localPlayer )
79+ if ( instance . m_player == global ::Player . localPlayer )
8080 {
81- SetupConnection ( __instance . rightHand ) ;
82- SetupConnection ( __instance . leftHand ) ;
81+ SetupConnection ( instance . rightHand ) ;
82+ SetupConnection ( instance . leftHand ) ;
8383 }
8484 else if ( PhotonServerConnector . IsNetworkMatch )
85- __instance . gameObject . AddComponent < NetKinematics > ( ) ;
85+ instance . gameObject . AddComponent < NetKinematics > ( ) ;
8686 }
8787
8888 /// <summary>
8989 /// Runs aiming and positioning for arms and guns after Holding.Update.
9090 /// </summary>
91- /// <param name="__instance ">Holding Script</param>
91+ /// <param name="instance ">Holding Script</param>
9292 [ HarmonyPatch ( nameof ( Holding . Update ) ) ]
9393 [ HarmonyPostfix ]
94- private static void UpdatePostfix ( Holding __instance )
94+ private static void UpdatePostfix ( Holding instance )
9595 {
9696 if ( ! Controllers . LeftHand || ! Controllers . RightHand || ! Controllers . Head ) return ;
97- if ( __instance . player != global ::Player . localPlayer ) return ;
97+ if ( instance . player != global ::Player . localPlayer ) return ;
9898
9999 // Plugin.Logger.LogInfo(
100100 // $"KP {__instance.player} / Head: {Controllers.Head.transform.position} / Left: {Controllers.LeftHand.transform.position} / Right: {Controllers.RightHand.transform.position}");
101101
102102 // held will have hand positions which will be exploited here
103- var heldObject = Grenades . SelectedGrenade ? . GetComponent < HoldableObject > ( ) ?? __instance . heldObject ;
103+ var heldObject = Grenades . SelectedGrenade ? . GetComponent < HoldableObject > ( ) ?? instance . heldObject ;
104104
105- UpdateConnection ( __instance . rightHand , Controllers . RightHand ) ;
105+ UpdateConnection ( instance . rightHand , Controllers . RightHand ) ;
106106
107- if ( __instance . heldObject )
107+ if ( instance . heldObject )
108108 {
109109 var rightHold = heldObject . rightHandPos ;
110110 var leftHold = heldObject . leftHandPos ;
@@ -115,18 +115,18 @@ private static void UpdatePostfix(Holding __instance)
115115
116116 if ( leftGrip > VRControls . TriggerDeadZone )
117117 {
118- if ( _gripAvailable ) _gripping = true ;
118+ if ( GripAvailable ) Gripping = true ;
119119 }
120120 else
121121 {
122- _gripping = false ;
122+ Gripping = false ;
123123 }
124124
125- _gripAvailable =
126- ! _gripping && Vector3 . Distance ( otherHold . position , Controllers . LeftHandFromGameCamera ) < 0.1f ;
125+ GripAvailable =
126+ ! Gripping && Vector3 . Distance ( otherHold . position , Controllers . LeftHandFromGameCamera ) < 0.1f ;
127127
128128 // look at left controller if gripping, or else just use the right controller rotation
129- heldObject . gameObject . transform . rotation = _gripping && leftHold
129+ heldObject . gameObject . transform . rotation = Gripping && leftHold
130130 ? Quaternion . LookRotation (
131131 Controllers . LeftHand . transform . position - Controllers . RightHand . transform . position )
132132 : Controllers . RightHand . transform . rotation *
@@ -144,23 +144,23 @@ private static void UpdatePostfix(Holding __instance)
144144 }
145145 else
146146 {
147- _gripping = false ;
147+ Gripping = false ;
148148 }
149149
150- if ( _gripping ) PositionLeftHandToHandguard ( __instance ) ;
151- else UpdateConnection ( __instance . leftHand , Controllers . LeftHand ) ;
150+ if ( Gripping ) PositionLeftHandToHandguard ( instance ) ;
151+ else UpdateConnection ( instance . leftHand , Controllers . LeftHand ) ;
152152 }
153153
154- private static float updateCounter ;
154+ private static float _updateCounter ;
155155
156156 [ HarmonyPatch ( nameof ( Holding . FixedUpdate ) ) ]
157157 [ HarmonyPostfix ]
158- private static void FixedUpdatePostfix ( Holding __instance )
158+ private static void FixedUpdatePostfix ( Holding instance )
159159 {
160- updateCounter ++ ;
161- updateCounter %= 50f / 20f ;
160+ _updateCounter ++ ;
161+ _updateCounter %= 50f / 20f ;
162162
163- if ( updateCounter != 0 ) return ;
163+ if ( _updateCounter != 0 ) return ;
164164
165165 if ( ! PhotonServerConnector . IsNetworkMatch ) return ;
166166
@@ -177,13 +177,13 @@ void WriteVector(Vector3 vector)
177177 writer . Write ( ( double ) vector . z ) ;
178178 }
179179
180- var heldObject = Grenades . SelectedGrenade ? . GetComponent < HoldableObject > ( ) ?? __instance . heldObject ;
180+ var heldObject = Grenades . SelectedGrenade ? . GetComponent < HoldableObject > ( ) ?? instance . heldObject ;
181181
182182 WriteVector ( Controllers . Head . transform . position ) ;
183183
184184 WriteVector ( Controllers . Head . transform . rotation . eulerAngles ) ;
185185
186- WriteVector ( _gripping
186+ WriteVector ( Gripping
187187 ? ( heldObject . leftHandPos ?? heldObject . rightHandPos ) . position -
188188 Camera . current . transform . position + Controllers . Head . transform . position
189189 : Controllers . LeftHand . transform . position ) ;
@@ -193,7 +193,7 @@ void WriteVector(Vector3 vector)
193193 WriteVector ( Controllers . RightHand . transform . position ) ;
194194
195195 if ( heldObject )
196- WriteVector ( _gripping && heldObject . leftHandPos
196+ WriteVector ( Gripping && heldObject . leftHandPos
197197 ? Quaternion . LookRotation ( Controllers . LeftHand . transform . position -
198198 Controllers . RightHand . transform . position ) . eulerAngles
199199 : ( Controllers . RightHand . transform . rotation * Quaternion . Euler (
@@ -229,14 +229,14 @@ private static IEnumerator DoNothing()
229229 /// <summary>
230230 /// Cancels Holding.HoldWeaponStill from running.
231231 /// </summary>
232- /// <param name="__result ">
232+ /// <param name="result ">
233233 /// <see cref="DoNothing" />
234234 /// </param>
235235 [ HarmonyPatch ( nameof ( Holding . HoldweaponStill ) ) ]
236236 [ HarmonyPrefix ]
237- private static bool HoldWeaponStillCanceller ( ref IEnumerator __result )
237+ private static bool HoldWeaponStillCanceller ( ref IEnumerator result )
238238 {
239- __result = DoNothing ( ) ;
239+ result = DoNothing ( ) ;
240240 return false ;
241241 }
242242
0 commit comments