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 SnapTurnMod v1.0.1
BepInEx/plugins/SnapTurnMod.dll
Decompiled 4 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using RepoXR.Input; using RepoXR.Player; using RepoXR.Player.Camera; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("SnapTurnMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SnapTurnMod")] [assembly: AssemblyTitle("SnapTurnMod")] [assembly: AssemblyVersion("1.0.0.0")] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class VRPlayerSnapTurnPatch { private static readonly FieldRef<PlayerController, float> InputDisableTimerRef = AccessTools.FieldRefAccess<PlayerController, float>("InputDisableTimer"); private static readonly FieldRef<PlayerController, float> overrideTimeScaleTimerRef = AccessTools.FieldRefAccess<PlayerController, float>("overrideTimeScaleTimer"); private static readonly FieldRef<PlayerController, float> overrideTimeScaleMultiplierRef = AccessTools.FieldRefAccess<PlayerController, float>("overrideTimeScaleMultiplier"); private static readonly FieldRef<VRPlayer, bool> turnedLastInputRef = AccessTools.FieldRefAccess<VRPlayer, bool>("turnedLastInput"); private static readonly FieldRef<VRPlayer, VRCameraAim> cameraAimRef = AccessTools.FieldRefAccess<VRPlayer, VRCameraAim>("cameraAim"); private const float CustomSnapAngle = 30f; public static bool Prefix(VRPlayer __instance) { PlayerController instance = PlayerController.instance; if (PlayerAvatar.instance.physGrabber.isRotating || InputDisableTimerRef.Invoke(instance) > 0f) { return true; } float num = Actions.Instance["Turn"].ReadValue<float>(); bool flag = Mathf.Abs(num) > 0.75f; float num2 = 30f; if (overrideTimeScaleTimerRef.Invoke(instance) > 0f) { num2 *= overrideTimeScaleMultiplierRef.Invoke(instance); } if (!turnedLastInputRef.Invoke(__instance) && flag) { VRCameraAim val = cameraAimRef.Invoke(__instance); if (num > 0f) { val.TurnAimNow(num2); } else { val.TurnAimNow(0f - num2); } } turnedLastInputRef.Invoke(__instance) = flag; return false; } } [BepInPlugin("com.orcatia.snaprotationmod", "SnapTurnMod", "1.0.1")] [BepInProcess("REPO.exe")] public class SnapRotationPlugin : BaseUnityPlugin { private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Snap Turn Mod is loaded and patching applied."); } }