Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LCVR BnS running v0.0.1
ArmSwingLocomotion.dll
Decompiled 14 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LCVR.Input; using LCVR.Managers; using LCVR.Player; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ArmSwingLocomotion")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ArmSwingLocomotion")] [assembly: AssemblyTitle("ArmSwingLocomotion")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace LCVRArmSwing { public class ArmSwingLocomotion : MonoBehaviour { private const float MOVE_THRESHOLD = 0.1f; private const float SWING_THRESHOLD = 1f; private const float SMOOTHING_SPEED = 6f; private VRPlayer player; private float smoothedIntensity; public bool IsSwinging { get; private set; } public bool IsMoving { get; private set; } private void Awake() { player = ((Component)this).GetComponent<VRPlayer>(); if ((Object)(object)player == (Object)null) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"[ArmSwing] Awake: GetComponent<VRPlayer>() gave null"); } } } private void LateUpdate() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null || (Object)(object)player.PlayerController == (Object)null || Actions.Instance == null) { return; } InputAction leftHandVelocity = Actions.Instance.LeftHandVelocity; InputAction rightHandVelocity = Actions.Instance.RightHandVelocity; if (leftHandVelocity == null || rightHandVelocity == null) { return; } Vector3 zero = Vector3.zero; Vector3 zero2 = Vector3.zero; try { zero = leftHandVelocity.ReadValue<Vector3>(); zero2 = rightHandVelocity.ReadValue<Vector3>(); } catch (Exception arg) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)$"[ArmSwing] LateUpdate: exception in ReadValue: {arg}"); } return; } float num = Mathf.Abs(zero.y) + Mathf.Abs(zero2.y); smoothedIntensity = Mathf.MoveTowards(smoothedIntensity, num, 6f * Time.deltaTime); IsMoving = ((Vector2)(ref player.PlayerController.moveInputVector)).sqrMagnitude > 0.1f; IsSwinging = smoothedIntensity >= 1f; } } [BepInPlugin("com.SagTag.LCVRBnSRunning", "LCVR Blades And Sorcery running", "0.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "com.SagTag.LCVRBnSRunning"; public const string PLUGIN_NAME = "LCVR Blades And Sorcery running"; public const string PLUGIN_VERSION = "0.0.1"; internal static ManualLogSource Log { get; private set; } private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; new Harmony("com.SagTag.LCVRBnSRunning").PatchAll(); Log.LogInfo((object)"LCVR Blades And Sorcery running v0.0.1 Loaded"); } } [HarmonyPatch(typeof(VRPlayer))] internal static class VRPlayerPatches { [HarmonyPatch("BuildVRRig")] [HarmonyPostfix] private static void AddArmSwingLocomotion(VRPlayer __instance) { ((Component)__instance).gameObject.AddComponent<ArmSwingLocomotion>(); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"Blades And Sorcery running enabled."); } } } [HarmonyPatch(typeof(PlayerControllerB))] internal static class InjectArmSwingPatch { [HarmonyPatch("Update")] [HarmonyPrefix] private static void ForceVRSprintInput(PlayerControllerB __instance) { if (!((NetworkBehaviour)__instance).IsOwner) { return; } VRSession instance = VRSession.Instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance.LocalPlayer == (Object)null)) { ArmSwingLocomotion component = ((Component)instance.LocalPlayer).GetComponent<ArmSwingLocomotion>(); if ((Object)(object)component != (Object)null && component.IsMoving && component.IsSwinging && !__instance.isExhausted) { instance.LocalPlayer.sprintValue = 1f; } } } } }