using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using DG.Tweening; using DG.Tweening.Core; using DG.Tweening.Plugins.Options; using HarmonyLib; using Microsoft.CodeAnalysis; 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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NoMoreRolling")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+4258485d82e47d29ecaaf21931d4235d89e092d6")] [assembly: AssemblyProduct("NoMoreRolling")] [assembly: AssemblyTitle("NoMoreRolling")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace NoMoreRolling { [BepInPlugin("nomorolling", "NoMoreRolling", "1.0.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; private readonly Harmony _harmony = new Harmony("nomorolling"); private void Awake() { Log = ((BaseUnityPlugin)this).Logger; _harmony.PatchAll(); Log.LogInfo((object)"NoMoreRolling v1.0.0 loaded."); } private void OnDestroy() { _harmony.UnpatchSelf(); } } internal static class MyPluginInfo { public const string PLUGIN_GUID = "nomorolling"; public const string PLUGIN_NAME = "NoMoreRolling"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace NoMoreRolling.Patches { [HarmonyPatch(typeof(SpawnBoxPlayerRagdollTrigger), "AssignPlayer")] public static class Debug_AssignPlayer { [HarmonyPrefix] private static void Prefix(SpawnBoxPlayerRagdollTrigger __instance, PlayerController player) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Plugin.Log.LogInfo((object)("[DBG] AssignPlayer | box=" + ((Object)__instance).name + $" | playerEuler={((Component)player).transform.eulerAngles}" + $" | boxEuler={((Component)__instance).transform.eulerAngles}")); } } [HarmonyPatch(typeof(PlayerController), "WakeUp")] public static class Debug_WakeUp { private static readonly FieldInfo _rbField = AccessTools.Field(typeof(PlayerController), "_rb"); private static readonly FieldInfo _headField = AccessTools.Field(typeof(PlayerController), "head"); private static readonly PropertyInfo _stateProp = AccessTools.Property(typeof(PlayerController), "State"); [HarmonyPrefix] private static void Prefix(PlayerController __instance) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) object? obj = _rbField?.GetValue(__instance); Rigidbody val = (Rigidbody)((obj is Rigidbody) ? obj : null); object? obj2 = _headField?.GetValue(__instance); Component val2 = (Component)((obj2 is Component) ? obj2 : null); Plugin.Log.LogInfo((object)("[DBG] WakeUp PRE" + $" | state={_stateProp?.GetValue(__instance)}" + $" | pos={((Component)__instance).transform.position}" + $" | bodyEuler={((Component)__instance).transform.eulerAngles}" + $" | headEuler={((val2 != null) ? new Vector3?(val2.transform.eulerAngles) : null)}" + $" | constraints={((val != null) ? new RigidbodyConstraints?(val.constraints) : null)}" + $" | linVel={((val != null) ? new Vector3?(val.linearVelocity) : null)}")); } [HarmonyPostfix] private static void Postfix(PlayerController __instance) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) object? obj = _rbField?.GetValue(__instance); Rigidbody val = (Rigidbody)((obj is Rigidbody) ? obj : null); object? obj2 = _headField?.GetValue(__instance); Component val2 = (Component)((obj2 is Component) ? obj2 : null); Plugin.Log.LogInfo((object)("[DBG] WakeUp POST" + $" | state={_stateProp?.GetValue(__instance)}" + $" | pos={((Component)__instance).transform.position}" + $" | bodyEuler={((Component)__instance).transform.eulerAngles}" + $" | constraints={((val != null) ? new RigidbodyConstraints?(val.constraints) : null)}" + $" | linVel={((val != null) ? new Vector3?(val.linearVelocity) : null)}")); } } [HarmonyPatch(typeof(PlayerController), "SetPlayerState")] public static class Debug_SetPlayerState { private static readonly FieldInfo _rbField = AccessTools.Field(typeof(PlayerController), "_rb"); [HarmonyPrefix] private static void Prefix(PlayerController __instance, PlayerState newState) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) object? obj = _rbField?.GetValue(__instance); Rigidbody val = (Rigidbody)((obj is Rigidbody) ? obj : null); Plugin.Log.LogInfo((object)($"[DBG] SetPlayerState → {newState}" + $" | bodyEuler={((Component)__instance).transform.eulerAngles}" + $" | constraints={((val != null) ? new RigidbodyConstraints?(val.constraints) : null)}")); } } [HarmonyPatch(typeof(PlayerController), "WakeUp")] public static class Debug_Sampler { [CompilerGenerated] private sealed class d__3 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerController player; private Rigidbody 5__1; private Component 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: { <>1__state = -1; ref Rigidbody reference = ref 5__1; object? obj2 = _rbField?.GetValue(player); reference = (Rigidbody)((obj2 is Rigidbody) ? obj2 : null); ref Component reference2 = ref 5__2; object? obj3 = _headField?.GetValue(player); reference2 = (Component)((obj3 is Component) ? obj3 : null); 5__3 = 0f; break; } case 1: { <>1__state = -1; 5__3 += 0.25f; ManualLogSource log = Plugin.Log; string text = $"[DBG] t+{5__3:F2}s"; string text2 = $" | pos={((Component)player).transform.position}"; string text3 = $" | bodyEuler={((Component)player).transform.eulerAngles}"; Rigidbody obj = 5__1; log.LogInfo((object)(text + text2 + text3 + $" | linVel={((obj != null) ? new Vector3?(obj.linearVelocity) : null)}")); break; } } if (5__3 < 1.5f) { <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 1; return true; } Plugin.Log.LogInfo((object)"[DBG] Sample complete."); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly FieldInfo _rbField = AccessTools.Field(typeof(PlayerController), "_rb"); private static readonly FieldInfo _headField = AccessTools.Field(typeof(PlayerController), "head"); [HarmonyPostfix] private static void Postfix(PlayerController __instance) { ((MonoBehaviour)__instance).StartCoroutine(Sample(__instance)); } [IteratorStateMachine(typeof(d__3))] private static IEnumerator Sample(PlayerController player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__3(0) { player = player }; } } [HarmonyPatch(typeof(SpawnBoxPlayerRagdollTrigger), "UserCode_TargetDisableLids__NetworkConnection")] public static class DisableAllBoxCollidersOnClientPatch { [HarmonyPostfix] private static void Postfix(SpawnBoxPlayerRagdollTrigger __instance) { int num = 0; Collider[] componentsInChildren = ((Component)__instance).GetComponentsInChildren(); foreach (Collider val in componentsInChildren) { val.isTrigger = true; num++; } Plugin.Log.LogInfo((object)$"[NoMoreRolling] Made {num} box colliders triggers"); } } [HarmonyPatch(typeof(PlayerController), "WakeUp")] public static class NoSpinWakeUpPatch { private const float ForwardSpeed = 5f; private const float UpwardSpeed = 1.5f; private static readonly FieldInfo _rbField = AccessTools.Field(typeof(PlayerController), "_rb"); private static readonly FieldInfo _headField = AccessTools.Field(typeof(PlayerController), "head"); private static readonly PropertyInfo _stateProp = AccessTools.Property(typeof(PlayerController), "State"); [HarmonyPostfix] private static void Postfix(PlayerController __instance) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) object? obj = _rbField?.GetValue(__instance); Rigidbody val = (Rigidbody)((obj is Rigidbody) ? obj : null); if (!((Object)(object)val == (Object)null)) { val.angularVelocity = Vector3.zero; val.linearVelocity = Vector3.zero; float y = ((Component)__instance).transform.eulerAngles.y; _stateProp?.SetValue(__instance, (object)(PlayerState)0); ShortcutExtensions.DOKill((Component)(object)((Component)__instance).transform, false); TweenSettingsExtensions.SetEase>(ShortcutExtensions.DORotate(((Component)__instance).transform, new Vector3(0f, y, 0f), 0.1f, (RotateMode)0), (Ease)9); object? obj2 = _headField?.GetValue(__instance); Component val2 = (Component)((obj2 is Component) ? obj2 : null); Vector3 val3; Vector3 normalized; if (!((Object)(object)val2 != (Object)null)) { val3 = Vector3.ProjectOnPlane(((Component)__instance).transform.forward, Vector3.up); normalized = ((Vector3)(ref val3)).normalized; } else { val3 = Vector3.ProjectOnPlane(val2.transform.forward, Vector3.up); normalized = ((Vector3)(ref val3)).normalized; } Vector3 val4 = normalized; val.AddForce(val4 * 5f + Vector3.up * 1.5f, (ForceMode)2); Plugin.Log.LogInfo((object)$"[NoMoreRolling] Wakeup: spawnY={y:F1} push={val4 * 5f + Vector3.up * 1.5f}"); } } } }