mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-04 23:39:22 +00:00
[RCCVirtualSteeringWheel] Fixed error spam when sitting in a CVRSeat with lockControls, but no RCC component in parent
This commit is contained in:
parent
138c9a9856
commit
018112d6b9
1 changed files with 16 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
||||||
using ABI_RC.Systems.InputManagement;
|
using ABI_RC.Core.InteractionSystem;
|
||||||
|
using ABI_RC.Systems.InputManagement;
|
||||||
using ABI_RC.Systems.Movement;
|
using ABI_RC.Systems.Movement;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NAK.RCCVirtualSteeringWheel.Util;
|
using NAK.RCCVirtualSteeringWheel.Util;
|
||||||
|
@ -39,12 +40,20 @@ internal static class CVRInputManager_Patches
|
||||||
[HarmonyPatch(typeof(CVRInputManager), nameof(CVRInputManager.UpdateInput))]
|
[HarmonyPatch(typeof(CVRInputManager), nameof(CVRInputManager.UpdateInput))]
|
||||||
private static void Postfix_CVRInputManager_UpdateInput(ref CVRInputManager __instance)
|
private static void Postfix_CVRInputManager_UpdateInput(ref CVRInputManager __instance)
|
||||||
{
|
{
|
||||||
// Steering input is clamped in RCC component
|
BetterBetterCharacterController characterController = BetterBetterCharacterController.Instance;
|
||||||
if (BetterBetterCharacterController.Instance.IsSittingOnControlSeat()
|
if (!characterController._isSitting)
|
||||||
&& SteeringWheelRoot.TryGetWheelInput(
|
return; // Must be sitting
|
||||||
BetterBetterCharacterController.Instance._lastCvrSeat._carController, out float steeringValue))
|
|
||||||
{
|
CVRSeat cvrSeat = characterController._lastCvrSeat;
|
||||||
|
if (!cvrSeat
|
||||||
|
|| !cvrSeat.lockControls)
|
||||||
|
return; // Must be a driver seat
|
||||||
|
|
||||||
|
RCC_CarControllerV3 carController = characterController._lastCvrSeat._carController;
|
||||||
|
if (!carController)
|
||||||
|
return; // Specific to RCC
|
||||||
|
|
||||||
|
if (SteeringWheelRoot.TryGetWheelInput(carController, out float steeringValue))
|
||||||
__instance.steering = steeringValue;
|
__instance.steering = steeringValue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue