Skip to content

Commit fc2a6f2

Browse files
committed
Fix all variable naming styles in TABGVR
1 parent 125332f commit fc2a6f2

File tree

13 files changed

+134
-134
lines changed

13 files changed

+134
-134
lines changed

TABGVR/Patches/CameraPatches/CameraPatch.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@ public class CameraPatch
1515
/// <summary>
1616
/// Creates VR Camera after <see cref="PlayerCamera" /> starts.
1717
/// </summary>
18-
/// <param name="__instance">
18+
/// <param name="instance">
1919
/// <see cref="PlayerCamera" />
2020
/// </param>
2121
[HarmonyPatch(nameof(PlayerCamera.Start))]
2222
[HarmonyPostfix]
23-
public static void Start(PlayerCamera __instance)
23+
public static void Start(PlayerCamera instance)
2424
{
25-
Plugin.Logger.LogInfo($"Camera idle: {__instance.gameObject.name}");
25+
Plugin.Logger.LogInfo($"Camera idle: {instance.gameObject.name}");
2626

27-
var playerManager = PlayerManager.FromCamera(__instance.cam);
27+
var playerManager = PlayerManager.FromCamera(instance.cam);
2828

2929
var gameObject = new GameObject("VRCamera")
3030
{
3131
transform =
3232
{
33-
parent = playerManager.player.m_cameraMovement.transform,
34-
position = __instance.transform.position
33+
parent = playerManager.Player.m_cameraMovement.transform,
34+
position = instance.transform.position
3535
},
3636
tag = "MainCamera",
37-
layer = __instance.gameObject.layer
37+
layer = instance.gameObject.layer
3838
};
3939

40-
__instance.enabled = false;
40+
instance.enabled = false;
4141

4242
var camera = gameObject.AddComponent<UnityEngine.Camera>();
4343
camera.stereoTargetEye = StereoTargetEyeMask.Both;
@@ -55,10 +55,10 @@ public static void Start(PlayerCamera __instance)
5555
var postProcessing = gameObject.AddComponent<PostProcessLayer>();
5656
postProcessing.volumeTrigger = gameObject.transform;
5757
postProcessing.volumeLayer = LayerMask.NameToLayer("Post");
58-
postProcessing.m_Resources = __instance.GetComponent<PostProcessLayer>().m_Resources;
58+
postProcessing.m_Resources = instance.GetComponent<PostProcessLayer>().m_Resources;
5959

6060
var highlight = gameObject.AddComponent<HighlightingRenderer>();
61-
var highlightReference = __instance.GetComponent<HighlightingRenderer>();
61+
var highlightReference = instance.GetComponent<HighlightingRenderer>();
6262
highlight.downsampleFactor = highlightReference.downsampleFactor;
6363
highlight.iterations = highlightReference.iterations;
6464
highlight.blurMinSpread = highlightReference.blurMinSpread;
@@ -72,7 +72,7 @@ public static void Start(PlayerCamera __instance)
7272
weight = 1f
7373
};
7474

75-
var constraint = __instance.gameObject.AddComponent<RotationConstraint>();
75+
var constraint = instance.gameObject.AddComponent<RotationConstraint>();
7676
constraint.AddSource(source);
7777

7878
constraint.constraintActive = true;

TABGVR/Patches/Interactions/KinematicsPatch.cs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ namespace TABGVR.Patches.Interactions;
1313
[HarmonyPatch(typeof(Holding))]
1414
internal 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

TABGVR/Patches/Misc/AntiCheatBypass.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ internal static void Bypass()
1919
}
2020

2121
/// <summary>
22-
/// Patches <see cref="ACInterface" /> to disable AC.
22+
/// Patches <see cref="acInterface" /> to disable AC.
2323
/// </summary>
24-
/// <param name="ACInterface">
25-
/// <see cref="ACInterface" />
24+
/// <param name="acInterface">
25+
/// <see cref="acInterface" />
2626
/// </param>
2727
[HarmonyPatch(typeof(Easy_AC_Client), nameof(Easy_AC_Client.SetACInterface))]
2828
[HarmonyPrefix]
29-
private static bool SetACInterface(AntiCheatClientInterface ACInterface)
29+
private static bool SetAcInterface(AntiCheatClientInterface acInterface)
3030
{
31-
Easy_AC_Client.m_Interface = ACInterface;
31+
Easy_AC_Client.m_Interface = acInterface;
3232
return false;
3333
}
3434

TABGVR/Patches/PlayerPatch.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@ public class PlayerPatch
1717
/// <summary>
1818
/// Adds <see cref="VRControls" /> and <see cref="RotationTargetDriver" /> on local <see cref="Player" />.
1919
/// </summary>
20-
/// <param name="__instance"></param>
20+
/// <param name="instance"></param>
2121
[HarmonyPatch(nameof(global::Player.Start))]
2222
[HarmonyPostfix]
23-
public static void Start(global::Player __instance)
23+
public static void Start(global::Player instance)
2424
{
25-
_playerManager = new PlayerManager(__instance.gameObject);
25+
_playerManager = new PlayerManager(instance.gameObject);
2626

27-
if (!_playerManager.playerIsClient) return; // run the rest if we are the player
27+
if (!_playerManager.PlayerIsClient) return; // run the rest if we are the player
2828

2929
// run code on player load here
3030

31-
_rotationTarget = _playerManager.playerRoot.transform.Find("CameraMovement").Find("CameraRotationX");
31+
_rotationTarget = _playerManager.PlayerRoot.transform.Find("CameraMovement").Find("CameraRotationX");
3232
// .Find("RotationTarget");
3333

3434
var playerDriver = _rotationTarget.gameObject.AddComponent<RotationTargetDriver>();
3535

3636
playerDriver.trackingType = TrackedPoseDriver.TrackingType.RotationOnly;
3737
playerDriver.poseSource = TrackedPoseDriver.TrackedPose.Head;
3838

39-
CurrentVRControls = _playerManager.playerRoot.AddComponent<VRControls>();
39+
CurrentVRControls = _playerManager.PlayerRoot.AddComponent<VRControls>();
4040
}
4141
}

TABGVR/Patches/UI/InventoryUIManagerUpdatePatch.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructio
3030
/// <summary>
3131
/// Starts dragging an item if either controller is triggered.
3232
/// </summary>
33-
/// <param name="__instance"></param>
34-
public static void Postfix(InventoryUIManager __instance)
33+
/// <param name="instance"></param>
34+
public static void Postfix(InventoryUIManager instance)
3535
{
36-
if (__instance.isDragging || __instance.selectedSlot is null || __instance.selectedSlot.isEmpty) return;
36+
if (instance.isDragging || instance.selectedSlot is null || instance.selectedSlot.isEmpty) return;
3737
if (!VRControls.SomethingTriggered) return;
3838

39-
__instance.StartDragging();
39+
instance.StartDragging();
4040
}
4141
}

TABGVR/Patches/UI/InventoryUIPatch.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,31 @@ public static class InventoryUIPatch
1111
/// <summary>
1212
/// Patches the inventory to make it visible in world space.
1313
/// </summary>
14-
public static bool Prefix(InventoryUI __instance)
14+
public static bool Prefix(InventoryUI instance)
1515
{
16-
__instance.transform.SetParent(
16+
instance.transform.SetParent(
1717
global::Player.localPlayer.m_cameraMovement.transform.Find("CameraRotationX"));
1818

19-
__instance.transform.localPosition = Vector3.forward;
20-
__instance.transform.localRotation = Quaternion.identity;
19+
instance.transform.localPosition = Vector3.forward;
20+
instance.transform.localRotation = Quaternion.identity;
2121

2222
// *inventory*
2323

2424
// shebang it
25-
UIPorter.Shebang(__instance.transform.Find("Inventory").gameObject);
25+
UIPorter.Shebang(instance.transform.Find("Inventory").gameObject);
2626

2727
// fix header being weird af
28-
__instance.characterRT.transform.parent.Find("Header").GetComponent<RectTransform>().localPosition =
28+
instance.characterRT.transform.parent.Find("Header").GetComponent<RectTransform>().localPosition =
2929
new Vector3(0, 620, 0);
3030

3131
// *game ui*
32-
__instance.gameUI.Start();
33-
var gameUI = __instance.transform.Find("GameUI").gameObject;
32+
instance.gameUI.Start();
33+
var gameUI = instance.transform.Find("GameUI").gameObject;
3434
gameUI.AddComponent<RectMask2D>(); // hide stuff that's normally offscreen
3535
UIPorter.Shebang(gameUI);
3636

3737
// *screen space canvas*
38-
var ssc = __instance.transform.Find("ScreenSpaceCanvas").Find("Canvas").gameObject;
38+
var ssc = instance.transform.Find("ScreenSpaceCanvas").Find("Canvas").gameObject;
3939
ssc.AddComponent<RectMask2D>();
4040
UIPorter.Shebang(ssc);
4141

TABGVR/Patches/UI/MainMenuCameraPatch.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ namespace TABGVR.Patches.UI;
1010
[HarmonyPatch(typeof(CameraIdleMovement), nameof(CameraIdleMovement.Start))]
1111
public static class MainMenuCameraPatch
1212
{
13-
public static void Postfix(CameraIdleMovement __instance)
13+
public static void Postfix(CameraIdleMovement instance)
1414
{
1515
var gameObject = new GameObject("VRCameraRoot")
1616
{
1717
transform =
1818
{
19-
parent = __instance.transform.parent,
20-
position = Vector3.Scale(__instance.transform.position, Vector3.forward + Vector3.right)
19+
parent = instance.transform.parent,
20+
position = Vector3.Scale(instance.transform.position, Vector3.forward + Vector3.right)
2121
}
2222
};
2323

2424
var cameraObject = new GameObject("VRCamera")
2525
{
2626
transform = { parent = gameObject.transform },
2727
tag = "MainCamera",
28-
layer = __instance.gameObject.layer
28+
layer = instance.gameObject.layer
2929
};
3030

31-
var oldCamera = __instance.GetComponent<Camera>();
31+
var oldCamera = instance.GetComponent<Camera>();
3232
oldCamera.enabled = false;
33-
__instance.enabled = false;
33+
instance.enabled = false;
3434

3535
var camera = cameraObject.AddComponent<Camera>();
3636
camera.stereoTargetEye = StereoTargetEyeMask.Both;
@@ -47,7 +47,7 @@ public static void Postfix(CameraIdleMovement __instance)
4747
var postProcessing = cameraObject.AddComponent<PostProcessLayer>();
4848
postProcessing.volumeTrigger = cameraObject.transform;
4949
postProcessing.volumeLayer = LayerMask.NameToLayer("Post");
50-
postProcessing.m_Resources = __instance.GetComponent<PostProcessLayer>().m_Resources;
50+
postProcessing.m_Resources = instance.GetComponent<PostProcessLayer>().m_Resources;
5151

5252
camera.cullingMask = oldCamera.cullingMask;
5353
Controllers.VRFloor.transform.parent = gameObject.transform;

0 commit comments

Comments
 (0)