88namespace TABGVR . Patches ;
99
1010[ HarmonyPatch ( typeof ( Holding ) ) ]
11- class KinematicsPatch
11+ internal class KinematicsPatch
1212{
1313 internal static bool _gripAvailable ;
1414 internal static bool _gripping ;
1515
1616 /// <summary>
17- /// Sets up hand connection for joint by removing properties that cause issues.
17+ /// Sets up hand connection for joint by removing properties that cause issues.
1818 /// </summary>
1919 /// <param name="joint">Hand Joint</param>
20- static void SetupConnection ( Rigidbody joint )
20+ private static void SetupConnection ( Rigidbody joint )
2121 {
2222 // joint.GetComponentInChildren<Collider>().enabled = false;
2323
@@ -38,11 +38,11 @@ static void SetupConnection(Rigidbody joint)
3838 }
3939
4040 /// <summary>
41- /// Updates <paramref name="joint"/>'s position to <paramref name="controller"/>.
41+ /// Updates <paramref name="joint" />'s position to <paramref name="controller" />.
4242 /// </summary>
4343 /// <param name="joint">Hand Joint</param>
44- /// <param name="controller">VR Controller made by <see cref="Controllers"/></param>
45- static void UpdateConnection ( Rigidbody joint , GameObject controller )
44+ /// <param name="controller">VR Controller made by <see cref="Controllers" /></param>
45+ private static void UpdateConnection ( Rigidbody joint , GameObject controller )
4646 {
4747 var controllerRelativeToGameCamera = controller . transform . position - Controllers . Head . transform . position +
4848 Camera . current . transform . position ;
@@ -54,34 +54,35 @@ static void UpdateConnection(Rigidbody joint, GameObject controller)
5454 }
5555
5656 /// <summary>
57- /// Position left hand to left hand attachment point on gun (handguard) instead of the VR controller to avoid visual weirdness.
57+ /// Position left hand to left hand attachment point on gun (handguard) instead of the VR controller to avoid visual
58+ /// weirdness.
5859 /// </summary>
5960 /// <param name="holding">Holding Script</param>
60- static void PositionLeftHandToHandguard ( Holding holding )
61+ private static void PositionLeftHandToHandguard ( Holding holding )
6162 {
6263 holding . leftHand . MovePosition ( holding . leftHand . position + holding . heldObject . leftHandPos . position -
6364 holding . leftHand . transform . GetChild ( 0 ) . position ) ;
6465 }
6566
6667 /// <summary>
67- /// Sets up hands for VR IK after Holding.Start.
68+ /// Sets up hands for VR IK after Holding.Start.
6869 /// </summary>
6970 /// <param name="__instance">Holding Script</param>
7071 [ HarmonyPatch ( nameof ( Holding . Start ) ) ]
7172 [ HarmonyPostfix ]
72- static void StartPostfix ( Holding __instance )
73+ private static void StartPostfix ( Holding __instance )
7374 {
7475 SetupConnection ( __instance . rightHand ) ;
7576 SetupConnection ( __instance . leftHand ) ;
7677 }
7778
7879 /// <summary>
79- /// Runs aiming and positioning for arms and guns after Holding.Update.
80+ /// Runs aiming and positioning for arms and guns after Holding.Update.
8081 /// </summary>
8182 /// <param name="__instance">Holding Script</param>
8283 [ HarmonyPatch ( nameof ( Holding . Update ) ) ]
8384 [ HarmonyPostfix ]
84- static void UpdatePostfix ( Holding __instance )
85+ private static void UpdatePostfix ( Holding __instance )
8586 {
8687 if ( ! Controllers . LeftHand || ! Controllers . RightHand || ! Controllers . Head ) return ;
8788 if ( __instance . player != global ::Player . localPlayer ) return ;
@@ -107,7 +108,10 @@ static void UpdatePostfix(Holding __instance)
107108 {
108109 if ( _gripAvailable ) _gripping = true ;
109110 }
110- else _gripping = false ;
111+ else
112+ {
113+ _gripping = false ;
114+ }
111115
112116 // look at left controller if gripping, or else just use the right controller rotation
113117 heldObject . gameObject . transform . rotation = _gripping
@@ -116,8 +120,8 @@ static void UpdatePostfix(Holding __instance)
116120 : Controllers . RightHand . transform . rotation *
117121 Quaternion . Euler ( 90f + rightHold . localRotation . x , rightHold . localRotation . y , 0f ) ;
118122
119- var toMove = ( Controllers . RightHandFromGameCamera +
120- heldObject . gameObject . transform . position - rightHold . position ) ;
123+ var toMove = Controllers . RightHandFromGameCamera +
124+ heldObject . gameObject . transform . position - rightHold . position ;
121125
122126 var rigidBody = heldObject . GetComponent < Rigidbody > ( ) ;
123127
@@ -128,21 +132,27 @@ static void UpdatePostfix(Holding __instance)
128132
129133 heldObject . transform . position = toMove ;
130134 }
131- else _gripping = false ;
135+ else
136+ {
137+ _gripping = false ;
138+ }
132139
133140 if ( _gripping ) PositionLeftHandToHandguard ( __instance ) ;
134141 else UpdateConnection ( __instance . leftHand , Controllers . LeftHand ) ;
135142 }
136143
137144 /// <summary>
138- /// Cancels Holding.ReachForPoint from running.
145+ /// Cancels Holding.ReachForPoint from running.
139146 /// </summary>
140147 [ HarmonyPatch ( nameof ( Holding . ReachForPoint ) ) ]
141148 [ HarmonyPrefix ]
142- static bool ReachForPointCanceller ( ) => false ;
149+ private static bool ReachForPointCanceller ( )
150+ {
151+ return false ;
152+ }
143153
144154 /// <summary>
145- /// Method that does nothing.
155+ /// Method that does nothing.
146156 /// </summary>
147157 /// <returns>IEnumerator that breaks on start</returns>
148158 private static IEnumerator DoNothing ( )
@@ -151,9 +161,11 @@ private static IEnumerator DoNothing()
151161 }
152162
153163 /// <summary>
154- /// Cancels Holding.HoldWeaponStill from running.
164+ /// Cancels Holding.HoldWeaponStill from running.
155165 /// </summary>
156- /// <param name="__result"><see cref="DoNothing"/></param>
166+ /// <param name="__result">
167+ /// <see cref="DoNothing" />
168+ /// </param>
157169 [ HarmonyPatch ( nameof ( Holding . HoldweaponStill ) ) ]
158170 [ HarmonyPrefix ]
159171 private static bool HoldWeaponStillCanceller ( ref IEnumerator __result )
@@ -163,9 +175,12 @@ private static bool HoldWeaponStillCanceller(ref IEnumerator __result)
163175 }
164176
165177 /// <summary>
166- /// Cancels PlayerIKHandler.LateUpdate from running.
178+ /// Cancels PlayerIKHandler.LateUpdate from running.
167179 /// </summary>
168180 [ HarmonyPatch ( typeof ( PlayerIKHandler ) , nameof ( PlayerIKHandler . LateUpdate ) ) ]
169181 [ HarmonyPrefix ]
170- static bool IKCanceller ( ) => false ;
182+ private static bool IKCanceller ( )
183+ {
184+ return false ;
185+ }
171186}
0 commit comments