using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using AtlyssCommandLib.API; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CodeTalker; using CodeTalker.Networking; using CodeTalker.Packets; using HarmonyLib; using Microsoft.CodeAnalysis; using Mirror; using Nessie.ATLYSS.EasySettings; using Nessie.ATLYSS.EasySettings.UIElements; using Newtonsoft.Json; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [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("AtlyssPlayerCollision")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AtlyssPlayerCollision")] [assembly: AssemblyTitle("AtlyssPlayerCollision")] [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 AtlyssPlayerCollision { internal sealed class CollisionBody { private readonly GameObject _bodyObject; private readonly Rigidbody _rigidbody; private readonly BoxCollider _debugBox; private readonly BoxCollider _solidBody; private readonly BoxCollider _standingPlatform; private readonly LineRenderer _bodyWireframe; private readonly LineRenderer _platformWireframe; private readonly CollisionConfig _config; private bool _hasAppliedShape; private Vector3 _lastLocalScale; private Vector3 _lastBodyCenter; private Vector3 _lastBodySize; private Vector3 _lastPlatformCenter; private Vector3 _lastPlatformSize; private bool _lastBodySolidEnabled; private bool _lastPlatformEnabled; private bool _lastBodyWireVisible; private bool _lastPlatformWireVisible; private static Material? _sharedLineMaterial; internal bool IsAlive => (Object)(object)_bodyObject != (Object)null; internal bool IsObjectActive => (Object)(object)_bodyObject != (Object)null && _bodyObject.activeInHierarchy; internal bool IsSolidBodyActive => (Object)(object)_solidBody != (Object)null && ((Collider)_solidBody).enabled && IsObjectActive; internal bool IsPlatformActive => (Object)(object)_standingPlatform != (Object)null && ((Collider)_standingPlatform).enabled && IsObjectActive; internal bool IsAnyWireVisible => (((Object)(object)_bodyWireframe != (Object)null && ((Renderer)_bodyWireframe).enabled) || ((Object)(object)_platformWireframe != (Object)null && ((Renderer)_platformWireframe).enabled)) && IsObjectActive; internal CollisionBody(CollisionPlayerState state, CollisionConfig config) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) _config = config; _bodyObject = new GameObject("PlayerCollisionBody"); _bodyObject.transform.SetParent(state.Root, false); _bodyObject.transform.localPosition = Vector3.zero; _bodyObject.transform.localRotation = Quaternion.identity; _bodyObject.transform.localScale = Vector3.one; _rigidbody = _bodyObject.AddComponent(); _rigidbody.isKinematic = true; _rigidbody.useGravity = false; _rigidbody.detectCollisions = true; _debugBox = _bodyObject.AddComponent(); ((Collider)_debugBox).isTrigger = true; ((Collider)_debugBox).enabled = false; _solidBody = _bodyObject.AddComponent(); ((Collider)_solidBody).isTrigger = false; ((Collider)_solidBody).enabled = false; _standingPlatform = _bodyObject.AddComponent(); ((Collider)_standingPlatform).isTrigger = false; ((Collider)_standingPlatform).enabled = false; _bodyWireframe = CreateWireframe("BodyWire", new Color(0.3f, 1f, 0.3f, 0.95f)); _platformWireframe = CreateWireframe("PlatformWire", new Color(1f, 0.85f, 0.2f, 0.95f)); } private LineRenderer CreateWireframe(string name, Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_00c0: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(_bodyObject.transform, false); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one; LineRenderer val2 = val.AddComponent(); val2.useWorldSpace = false; val2.positionCount = 16; val2.startWidth = 0.03f; val2.endWidth = 0.03f; val2.numCapVertices = 0; val2.numCornerVertices = 0; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; val2.alignment = (LineAlignment)0; ((Renderer)val2).sharedMaterial = GetLineMaterial(); val2.startColor = color; val2.endColor = color; ((Renderer)val2).enabled = false; return val2; } private static Material GetLineMaterial() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown if ((Object)(object)_sharedLineMaterial != (Object)null) { return _sharedLineMaterial; } Shader val = Shader.Find("Sprites/Default") ?? Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Standard"); _sharedLineMaterial = new Material(val); return _sharedLineMaterial; } internal bool UpdateShape(float width, float depth, float height, float centerY, float headWidth, float headDepth, float headThickness, float headCenterY, Vector3 platformLocalCenter, bool bodySolidEnabled, bool platformEnabled, bool debugVisible, bool chestBoxMode) { //IL_0114: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_021c: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_bodyObject == (Object)null || (Object)(object)_debugBox == (Object)null || (Object)(object)_solidBody == (Object)null || (Object)(object)_standingPlatform == (Object)null) { return false; } if (!_bodyObject.activeSelf) { _bodyObject.SetActive(true); } Transform parent = _bodyObject.transform.parent; Vector3 one = default(Vector3); if ((Object)(object)parent != (Object)null) { Vector3 lossyScale = parent.lossyScale; ((Vector3)(ref one))..ctor((Mathf.Abs(lossyScale.x) > 0.0001f) ? (1f / lossyScale.x) : 1f, (Mathf.Abs(lossyScale.y) > 0.0001f) ? (1f / lossyScale.y) : 1f, (Mathf.Abs(lossyScale.z) > 0.0001f) ? (1f / lossyScale.z) : 1f); } else { one = Vector3.one; } if (!_hasAppliedShape || !Approximately(_lastLocalScale, one)) { _bodyObject.transform.localScale = one; _lastLocalScale = one; } if (_bodyObject.transform.localPosition != Vector3.zero) { _bodyObject.transform.localPosition = Vector3.zero; } if (_bodyObject.transform.localRotation != Quaternion.identity) { _bodyObject.transform.localRotation = Quaternion.identity; } float num = Mathf.Max(0.01f, width); float num2 = Mathf.Max(0.01f, depth); float num3 = Mathf.Max(0.01f, height); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, centerY, 0f); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(num, num3, num2); float num4 = Mathf.Clamp(headThickness, 0.02f, 0.75f); Vector3 val3 = platformLocalCenter; val3.y = headCenterY; Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(Mathf.Max(0.01f, headWidth), num4, Mathf.Max(0.01f, headDepth)); bool flag = bodySolidEnabled && !chestBoxMode && _config.SolidRemoteBodyEnabled.Value; bool flag2 = platformEnabled && (chestBoxMode || _config.StandingPlatformEnabled.Value); bool flag3 = debugVisible && flag; bool flag4 = debugVisible && flag2; bool flag5 = !_hasAppliedShape || !Approximately(_lastBodyCenter, val) || !Approximately(_lastBodySize, val2) || _lastBodySolidEnabled != flag; bool flag6 = !_hasAppliedShape || !Approximately(_lastPlatformCenter, val3) || !Approximately(_lastPlatformSize, val4) || _lastPlatformEnabled != flag2; bool flag7 = flag5 || _lastBodyWireVisible != flag3 || ((Object)(object)_bodyWireframe != (Object)null && ((Renderer)_bodyWireframe).enabled != flag3); bool flag8 = flag6 || _lastPlatformWireVisible != flag4 || ((Object)(object)_platformWireframe != (Object)null && ((Renderer)_platformWireframe).enabled != flag4); bool flag9 = !_rigidbody.isKinematic || _rigidbody.useGravity || !_rigidbody.detectCollisions; if (!flag5 && !flag6 && !flag7 && !flag8 && !flag9) { return true; } if (flag5) { _debugBox.center = val; _debugBox.size = val2; ((Collider)_debugBox).enabled = false; _solidBody.center = val; _solidBody.size = val2; ((Collider)_solidBody).enabled = flag; } else if (((Collider)_solidBody).enabled != flag) { ((Collider)_solidBody).enabled = flag; } if (flag6) { _standingPlatform.center = val3; _standingPlatform.size = val4; ((Collider)_standingPlatform).enabled = flag2; } else if (((Collider)_standingPlatform).enabled != flag2) { ((Collider)_standingPlatform).enabled = flag2; } if (flag7) { UpdateWireframe(_bodyWireframe, val, val2, flag3); } if (flag8) { UpdateWireframe(_platformWireframe, val3, val4, flag4); } if (flag9) { _rigidbody.isKinematic = true; _rigidbody.useGravity = false; _rigidbody.detectCollisions = true; } _hasAppliedShape = true; _lastBodyCenter = val; _lastBodySize = val2; _lastPlatformCenter = val3; _lastPlatformSize = val4; _lastBodySolidEnabled = flag; _lastPlatformEnabled = flag2; _lastBodyWireVisible = flag3; _lastPlatformWireVisible = flag4; return true; } private static bool Approximately(Vector3 a, Vector3 b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) return Mathf.Abs(a.x - b.x) <= 0.0005f && Mathf.Abs(a.y - b.y) <= 0.0005f && Mathf.Abs(a.z - b.z) <= 0.0005f; } private static void UpdateWireframe(LineRenderer? lr, Vector3 center, Vector3 size, bool visible) { //IL_002b: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)lr == (Object)null)) { if (!visible) { ((Renderer)lr).enabled = false; return; } float num = size.x * 0.5f; float num2 = size.y * 0.5f; float num3 = size.z * 0.5f; lr.SetPosition(0, center + new Vector3(0f - num, 0f - num2, 0f - num3)); lr.SetPosition(1, center + new Vector3(num, 0f - num2, 0f - num3)); lr.SetPosition(2, center + new Vector3(num, 0f - num2, num3)); lr.SetPosition(3, center + new Vector3(0f - num, 0f - num2, num3)); lr.SetPosition(4, center + new Vector3(0f - num, 0f - num2, 0f - num3)); lr.SetPosition(5, center + new Vector3(0f - num, num2, 0f - num3)); lr.SetPosition(6, center + new Vector3(num, num2, 0f - num3)); lr.SetPosition(7, center + new Vector3(num, 0f - num2, 0f - num3)); lr.SetPosition(8, center + new Vector3(num, num2, 0f - num3)); lr.SetPosition(9, center + new Vector3(num, num2, num3)); lr.SetPosition(10, center + new Vector3(num, 0f - num2, num3)); lr.SetPosition(11, center + new Vector3(num, num2, num3)); lr.SetPosition(12, center + new Vector3(0f - num, num2, num3)); lr.SetPosition(13, center + new Vector3(0f - num, 0f - num2, num3)); lr.SetPosition(14, center + new Vector3(0f - num, num2, num3)); lr.SetPosition(15, center + new Vector3(0f - num, num2, 0f - num3)); ((Renderer)lr).enabled = true; } } internal void Hide() { if ((Object)(object)_solidBody != (Object)null) { ((Collider)_solidBody).enabled = false; } if ((Object)(object)_standingPlatform != (Object)null) { ((Collider)_standingPlatform).enabled = false; } if ((Object)(object)_bodyWireframe != (Object)null) { ((Renderer)_bodyWireframe).enabled = false; } if ((Object)(object)_platformWireframe != (Object)null) { ((Renderer)_platformWireframe).enabled = false; } } internal void Destroy() { if ((Object)(object)_bodyObject != (Object)null) { Object.Destroy((Object)(object)_bodyObject); } } } internal sealed class LocalCollisionResolver { private const float StackedDistance = 0.001f; private const float AnchorActiveDeadzone = 0.025f; private const float AnchorPoseDeadzone = 0.25f; private const float AnchorVerticalLiftTolerance = 0.1f; private const float AnchorVerticalCorrectionTolerance = 0.03f; private const float AnchorVerticalSlackHorizontalTolerance = 0.35f; private const float AnchorPlatformHorizontalSlack = 0.25f; private const float AnchorCarrierVerticalMoveTolerance = 0.05f; private const float AnchorRiderDownwardTolerance = 0.005f; private const float UnsafeAnchorPoseDeadzone = 0.45f; private const float UnsafeAnchorReleaseMargin = 1.25f; private const float UnsafeAnchorHardReleaseMargin = 2.5f; private const float UnsafeAnchorMaxHorizontalStep = 0.06f; private const float UnsafeAnchorPoseGraceSeconds = 2f; private static readonly FieldInfo? PlayerIsSittingField = typeof(Player).GetField("_isSitting", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo? MovementLockTypeField = typeof(PlayerMove).GetField("_movementLockType", BindingFlags.Instance | BindingFlags.NonPublic); private readonly CollisionPlayerRegistry _registry; private readonly CollisionConfig _config; internal LocalCollisionResolver(CollisionPlayerRegistry registry, CollisionConfig config) { _registry = registry; _config = config; } internal void Tick() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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) //IL_00eb: 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_00f4: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) if (!_config.ModEnabled.Value || !PlayerCollisionPlugin.Instance.LocalCollisionEnabled) { return; } CollisionPlayerState localPlayer = _registry.LocalPlayer; if (localPlayer == null || !CanUsePlayer(localPlayer) || !localPlayer.HasBounds) { return; } Vector3 val = Vector3.zero; Player player = localPlayer.Player; CollisionPlayerState collisionPlayerState = null; bool flag = localPlayer.IsStandingOnPlatform || localPlayer.AnchoredToInstanceId != 0; Vector3 val2 = default(Vector3); foreach (CollisionPlayerState player2 in _registry.Players) { if (player2 == localPlayer || !CanCollide(localPlayer, player2, player)) { continue; } Bounds bounds = localPlayer.Bounds; float x = ((Bounds)(ref bounds)).min.x; bounds = localPlayer.Bounds; float x2 = ((Bounds)(ref bounds)).max.x; bounds = localPlayer.Bounds; float y = ((Bounds)(ref bounds)).min.y; bounds = localPlayer.Bounds; float y2 = ((Bounds)(ref bounds)).max.y; bounds = localPlayer.Bounds; float z = ((Bounds)(ref bounds)).min.z; bounds = localPlayer.Bounds; float z2 = ((Bounds)(ref bounds)).max.z; bounds = player2.Bounds; float x3 = ((Bounds)(ref bounds)).min.x; bounds = player2.Bounds; float x4 = ((Bounds)(ref bounds)).max.x; bounds = player2.Bounds; float y3 = ((Bounds)(ref bounds)).min.y; bounds = player2.Bounds; float y4 = ((Bounds)(ref bounds)).max.y; bounds = player2.Bounds; float z3 = ((Bounds)(ref bounds)).min.z; bounds = player2.Bounds; float z4 = ((Bounds)(ref bounds)).max.z; float headBoxTopY = player2.HeadBoxTopY; bool flag2 = localPlayer.AnchoredToInstanceId == player2.InstanceId; bool feetNearPlatform; bool rootNearPlatform; bool flag3 = CollisionPlayerRegistry.TryGetHeadPlatformContact(player2, localPlayer, out feetNearPlatform, out rootNearPlatform); float num = y - headBoxTopY; bool flag4 = flag3 && (feetNearPlatform || rootNearPlatform); bool flag5 = flag2 || (flag3 && feetNearPlatform); if (flag4) { if (flag5) { localPlayer.StandingOnInstanceId = player2.InstanceId; localPlayer.StandingOnUntil = Time.time + 0.25f; flag = true; } if (collisionPlayerState == null || player2.HeadBoxTopY > collisionPlayerState.HeadBoxTopY) { collisionPlayerState = player2; } } else { if (!player2.ExpectsSolidBody || x2 <= x3 || x >= x4 || y2 <= y3 || y >= y4 || z2 <= z3 || z >= z4) { continue; } if (num > -0.45f || flag2 || localPlayer.StandingOnInstanceId == player2.InstanceId) { flag = true; continue; } float num2 = Mathf.Min(x2 - x3, x4 - x); float num3 = Mathf.Min(z2 - z3, z4 - z); if (num2 < num3) { bounds = localPlayer.Bounds; float x5 = ((Bounds)(ref bounds)).center.x; bounds = player2.Bounds; float num4 = ((x5 >= ((Bounds)(ref bounds)).center.x) ? 1f : (-1f)); ((Vector3)(ref val2))..ctor(num4 * num2, 0f, 0f); } else { bounds = localPlayer.Bounds; float z5 = ((Bounds)(ref bounds)).center.z; bounds = player2.Bounds; float num5 = ((z5 >= ((Bounds)(ref bounds)).center.z) ? 1f : (-1f)); ((Vector3)(ref val2))..ctor(0f, 0f, num5 * num3); } if (((Vector3)(ref val2)).sqrMagnitude < 1.0000001E-06f) { val2 = FallbackDirection(localPlayer, player2) * Mathf.Max(num2, num3); } val2 *= Mathf.Max(0f, _config.PushStrength.Value) * Time.deltaTime; val += val2; } } if (flag) { val = Vector3.zero; } val.y = 0f; val = Vector3.ClampMagnitude(val, Mathf.Max(0f, _config.MaxPushPerFrame.Value)); if (((Vector3)(ref val)).sqrMagnitude > 1E-06f) { MoveLocalPlayer(localPlayer, val); } ApplyAnchor(localPlayer, collisionPlayerState); } private void ApplyAnchor(CollisionPlayerState me, CollisionPlayerState? newCandidate) { //IL_0114: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) if (!_config.AnchorRiderToCarrier.Value) { ClearAnchor(me); return; } bool flag = me.AnchoredToInstanceId != 0; bool flag2 = false; CollisionPlayerState collisionPlayerState = null; if (flag) { collisionPlayerState = _registry.TryGetByInstanceId(me.AnchoredToInstanceId); if (collisionPlayerState == null || (Object)(object)collisionPlayerState.Player == (Object)null || (Object)(object)collisionPlayerState.Root == (Object)null || !collisionPlayerState.HasBounds) { ClearAnchor(me); collisionPlayerState = null; flag = false; } } if (collisionPlayerState == null) { if (newCandidate == null || (Object)(object)newCandidate.Player == (Object)null || (Object)(object)newCandidate.Root == (Object)null || !newCandidate.HasBounds) { return; } collisionPlayerState = newCandidate; AttachAnchor(me, collisionPlayerState); flag2 = true; } bool flag3 = !me.IsActivePlayer(); bool flag4 = _config.IsStrictStickMode(); bool flag5 = !flag4 && _config.IsUnsafeStickMode(); bool flag6 = flag || flag2; Vector3 val = collisionPlayerState.Root.TransformPoint(me.AnchorOffsetLocal); float headBoxTopY = collisionPlayerState.HeadBoxTopY; float num = (me.HasBounds ? me.BottomOffsetY : 0f); float num2 = me.Root.position.y + num; Vector2 val2 = new Vector2(val.x - me.Root.position.x, val.z - me.Root.position.z); float magnitude = ((Vector2)(ref val2)).magnitude; bool flag7 = me.HasAnchorSample && me.AnchoredToInstanceId == collisionPlayerState.InstanceId; float num3 = (flag7 ? (headBoxTopY - me.LastAnchorCarrierHeadTopY) : 0f); float num4 = (flag7 ? (me.Root.position.y - me.LastAnchorRiderRootY) : 0f); bool flag8 = !flag7 || Mathf.Abs(num3) <= 0.05f; bool flag9 = flag7 && num4 < -0.005f; bool flag10 = IsRiderSitting(me) || IsMovementLocked(me) || flag3 || flag9; if (flag10) { me.AnchorPoseSlackUntil = Time.time + 2f; } bool flag11 = flag10 || Time.time <= me.AnchorPoseSlackUntil; if (flag5 && flag11 && (flag6 || IsStaticHeadCarrier(collisionPlayerState))) { ApplyUnsafePoseAnchor(me, collisionPlayerState, val); return; } bool flag12 = !flag4 && flag6 && flag8 && magnitude <= 0.35f && IsWithinHeadPlatformHorizontalSlack(me, collisionPlayerState) && flag11; float num5 = me.Root.position.y; if (!flag12 && !flag3 && num2 < headBoxTopY - 0.1f) { num5 = Mathf.Max(num5, headBoxTopY + 0.03f - num); } Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(val.x, num5, val.z); float num6 = Mathf.Max(0.5f, _config.AnchorBreakSafetyDistance.Value); float num7 = Mathf.Max(num6 * 3f, num6 + 20f); Vector3 val4 = val3 - me.Root.position; val2 = new Vector2(val4.x, val4.z); float magnitude2 = ((Vector2)(ref val2)).magnitude; float num8 = ((flag3 || flag12) ? 0f : Mathf.Max(0f, headBoxTopY - num2)); float num9 = Mathf.Max(magnitude2, num8); if (num9 > num7) { ClearAnchor(me); return; } if (num9 > num6) { if (flag5 && flag11) { ApplyUnsafePoseAnchor(me, collisionPlayerState, val); return; } Vector3 val5 = BuildAnchorRecoveryPosition(me, collisionPlayerState); SetLocalPlayerPosition(me, val5); RefreshAnchorOffset(me, collisionPlayerState, val5); RememberAnchorSample(me, collisionPlayerState); ApplyCarrierRotationDelta(me, collisionPlayerState); return; } Vector3 val6 = val4; val2 = new Vector2(val6.x, val6.z); float magnitude3 = ((Vector2)(ref val2)).magnitude; float num10 = (flag3 ? 0.25f : 0.025f); if (magnitude3 > num10 || (!flag12 && !flag3 && val6.y > 0.03f)) { if (flag3) { Vector3 val7 = Vector3.Lerp(me.Root.position, val3, 0.35f); SetLocalPlayerPosition(me, val7); me.AnchorOffsetLocal = collisionPlayerState.Root.InverseTransformPoint(val7); } else { SetLocalPlayerPosition(me, val3); } } else if (flag3) { me.AnchorOffsetLocal = collisionPlayerState.Root.InverseTransformPoint(me.Root.position); } RememberAnchorSample(me, collisionPlayerState); ApplyCarrierRotationDelta(me, collisionPlayerState); } private static void AttachAnchor(CollisionPlayerState rider, CollisionPlayerState carrier) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) rider.AnchoredToInstanceId = carrier.InstanceId; Vector3 position = rider.Root.position; RefreshAnchorOffset(rider, carrier, position); rider.AnchorCarrierRotation = carrier.Root.rotation; rider.HasAnchorCarrierRotation = true; } private static void RefreshAnchorOffset(CollisionPlayerState rider, CollisionPlayerState carrier, Vector3 worldRiderPos) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) rider.AnchorOffsetLocal = carrier.Root.InverseTransformPoint(worldRiderPos); rider.AnchorHeightOffset = worldRiderPos.y - carrier.HeadBoxTopY; } private void ApplyUnsafePoseAnchor(CollisionPlayerState rider, CollisionPlayerState carrier, Vector3 carrierWorldOffset) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) Vector3 val = carrier.Root.InverseTransformPoint(rider.Root.position) - carrier.PlatformLocalCenter; float num = Mathf.Max(0.05f, carrier.HeadBoxWidth * 0.5f + 1.25f); float num2 = Mathf.Max(0.05f, carrier.HeadBoxDepth * 0.5f + 1.25f); float num3 = Mathf.Max(num, carrier.HeadBoxWidth * 0.5f + 2.5f); float num4 = Mathf.Max(num2, carrier.HeadBoxDepth * 0.5f + 2.5f); if (Mathf.Abs(val.x) > num3 || Mathf.Abs(val.z) > num4) { ClearAnchor(rider); return; } bool flag = Mathf.Abs(val.x) > num || Mathf.Abs(val.z) > num2; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(carrierWorldOffset.x, rider.Root.position.y, carrierWorldOffset.z); Vector3 val3 = val2 - rider.Root.position; val3.y = 0f; float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude > 0.45f) { float num5 = (flag ? 0.105f : 0.06f); Vector3 val4 = Vector3.ClampMagnitude(val3, num5); Vector3 val5 = rider.Root.position + val4; SetLocalPlayerPosition(rider, val5); rider.AnchorOffsetLocal = carrier.Root.InverseTransformPoint(val5); } else { rider.AnchorOffsetLocal = carrier.Root.InverseTransformPoint(rider.Root.position); } RememberAnchorSample(rider, carrier); ApplyCarrierRotationDelta(rider, carrier); } private static Vector3 BuildAnchorRecoveryPosition(CollisionPlayerState rider, CollisionPlayerState carrier) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) Vector3 val = carrier.Root.InverseTransformPoint(rider.Root.position); float num = Mathf.Max(0.05f, carrier.HeadBoxWidth * 0.5f - 0.05f); float num2 = Mathf.Max(0.05f, carrier.HeadBoxDepth * 0.5f - 0.05f); Vector3 platformLocalCenter = carrier.PlatformLocalCenter; val.x = Mathf.Clamp(val.x, platformLocalCenter.x - num, platformLocalCenter.x + num); val.z = Mathf.Clamp(val.z, platformLocalCenter.z - num2, platformLocalCenter.z + num2); val.y = platformLocalCenter.y; Vector3 val2 = carrier.Root.TransformPoint(val); float num3 = (rider.HasBounds ? rider.BottomOffsetY : 0f); float num4 = carrier.HeadBoxTopY + 0.03f - num3; return new Vector3(val2.x, num4, val2.z); } private static void ClearAnchor(CollisionPlayerState me) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) me.AnchoredToInstanceId = 0; me.AnchorOffsetLocal = Vector3.zero; me.AnchorHeightOffset = 0f; me.AnchorCarrierRotation = Quaternion.identity; me.HasAnchorCarrierRotation = false; me.LastAnchorCarrierHeadTopY = 0f; me.LastAnchorRiderRootY = 0f; me.AnchorPoseSlackUntil = 0f; me.HasAnchorSample = false; } private static void RememberAnchorSample(CollisionPlayerState rider, CollisionPlayerState carrier) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) rider.LastAnchorCarrierHeadTopY = carrier.HeadBoxTopY; rider.LastAnchorRiderRootY = rider.Root.position.y; rider.HasAnchorSample = true; } private static bool IsWithinHeadPlatformHorizontalSlack(CollisionPlayerState rider, CollisionPlayerState carrier) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rider.Root == (Object)null || (Object)(object)carrier.Root == (Object)null) { return false; } Vector3 val = carrier.Root.InverseTransformPoint(rider.Root.position) - carrier.PlatformLocalCenter; float num = Mathf.Max(0.05f, carrier.HeadBoxWidth * 0.5f + 0.25f); float num2 = Mathf.Max(0.05f, carrier.HeadBoxDepth * 0.5f + 0.25f); return Mathf.Abs(val.x) <= num && Mathf.Abs(val.z) <= num2; } private static bool IsStaticHeadCarrier(CollisionPlayerState carrier) { return !carrier.ChestBoxActive && string.Equals(carrier.BoxSizingMode, "static", StringComparison.Ordinal); } private static bool IsRiderSitting(CollisionPlayerState rider) { try { object obj = PlayerIsSittingField?.GetValue(rider.Player); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return false; } } private static bool IsMovementLocked(CollisionPlayerState rider) { try { PlayerMove pMove = rider.Player._pMove; if ((Object)(object)pMove == (Object)null || MovementLockTypeField == null) { return false; } string a = MovementLockTypeField.GetValue(pMove)?.ToString() ?? string.Empty; return !string.Equals(a, "NONE", StringComparison.Ordinal); } catch { return false; } } private bool CanCollide(CollisionPlayerState me, CollisionPlayerState other, Player localPlayer) { if (!CanUsePlayer(other)) { return false; } if (!other.HasBounds) { return false; } if (!other.IsNearLocalPlayer) { return false; } if (!other.IsWithinRenderDistance || !other.IsRenderCapSelected) { return false; } if (!other.ExpectsSolidBody && !other.ExpectsPlatform) { return false; } if (!me.CollisionEnabled || !other.CollisionEnabled) { return false; } if (_registry.IsInGracePeriod(me) || _registry.IsInGracePeriod(other)) { return false; } if (!PlayerIdentity.IsSameMapAsLocal(other.Player, localPlayer)) { return false; } if (!other.IsWhitelisted) { return false; } float value = _config.TinyDisableThreshold.Value; if (value > 0f) { if (me.TinyScale > 0f && me.TinyScale <= value) { return false; } if (other.TinyScale > 0f && other.TinyScale <= value) { return false; } } return true; } private static bool CanUsePlayer(CollisionPlayerState state) { return (Object)(object)state.Player != (Object)null && (Object)(object)state.Root != (Object)null; } private void ApplyCarrierRotationDelta(CollisionPlayerState me, CollisionPlayerState carrier) { //IL_0020: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (!_config.AnchorRotateWithCarrier.Value) { me.AnchorCarrierRotation = carrier.Root.rotation; me.HasAnchorCarrierRotation = true; return; } if (!me.HasAnchorCarrierRotation) { me.AnchorCarrierRotation = carrier.Root.rotation; me.HasAnchorCarrierRotation = true; return; } Quaternion val = carrier.Root.rotation * Quaternion.Inverse(me.AnchorCarrierRotation); me.AnchorCarrierRotation = carrier.Root.rotation; if (Quaternion.Angle(val, Quaternion.identity) < 0.05f) { return; } try { me.Root.rotation = val * me.Root.rotation; } catch { } } private static Vector3 FallbackDirection(CollisionPlayerState me, CollisionPlayerState other) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) int num = me.InstanceId ^ (other.InstanceId << 3); float num2 = (float)(num & 0x3FF) / 1024f * MathF.PI * 2f; return new Vector3(Mathf.Cos(num2), 0f, Mathf.Sin(num2)); } private void MoveLocalPlayer(CollisionPlayerState me, Vector3 push) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) CharacterController val = TryGetController(me); if ((Object)(object)val != (Object)null && ((Collider)val).enabled) { try { val.Move(push); return; } catch { } } if (_config.AllowTransformFallback.Value) { try { Transform root = me.Root; root.position += push; } catch { } } } private static void HardSetLocalPlayerPosition(CollisionPlayerState me, Vector3 worldPosition) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) CharacterController val = TryGetController(me); bool flag = false; try { if ((Object)(object)val != (Object)null && ((Collider)val).enabled) { ((Collider)val).enabled = false; flag = true; } me.Root.position = worldPosition; } catch { } finally { if ((Object)(object)val != (Object)null && flag) { try { ((Collider)val).enabled = true; } catch { } } } } private static void SetLocalPlayerPosition(CollisionPlayerState me, Vector3 worldPosition) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) try { me.Root.position = worldPosition; } catch { } } private static CharacterController? TryGetController(CollisionPlayerState me) { CharacterController val = null; try { PlayerMove pMove = me.Player._pMove; if ((Object)(object)pMove != (Object)null) { val = pMove._playerController; } } catch { } if ((Object)(object)val == (Object)null) { try { val = ((Component)me.Player).GetComponent(); } catch { } } return val; } } [HarmonyPatch(typeof(ChatBehaviour), "Send_ChatMessage")] internal static class CollisionCommands { private static readonly string[] CommandPrefixes = new string[21] { "/collider", "/collision", "/pcollision", "/col", "/anchor", "/stick", "/ca", "/boxwhitelist", "/boxwl", "/cwl", "/wl", "/boxallow", "/boxdeny", "/boxlist", "/boxsave", "/boxload", "/boxdel", "/boxpresets", "/save", "/load", "/remove" }; private static readonly FieldInfo? MaxOnscreenField = typeof(ChatBehaviour).GetField("maxOnscreenMessages", BindingFlags.Instance | BindingFlags.NonPublic) ?? typeof(ChatBehaviour).GetField("_maxOnscreenMessages", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPrefix] private static bool Prefix(ChatBehaviour __instance, string _message) { try { if (string.IsNullOrWhiteSpace(_message)) { return true; } string text = _message.Trim(); string text2 = null; string[] commandPrefixes = CommandPrefixes; foreach (string text3 in commandPrefixes) { if (text.StartsWith(text3, StringComparison.OrdinalIgnoreCase) && (text.Length == text3.Length || char.IsWhiteSpace(text[text3.Length]))) { text2 = text3; break; } } if (text2 == null) { return true; } string text4 = text.Substring(text2.Length).Trim(); string args; if (IsAnchorPrefix(text2)) { args = (string.IsNullOrEmpty(text4) ? "anchor toggle" : ("anchor " + text4)); } else if (text2.Equals("/boxallow", StringComparison.OrdinalIgnoreCase)) { args = (string.IsNullOrEmpty(text4) ? "boxallow" : ("boxallow " + text4)); } else if (text2.Equals("/boxdeny", StringComparison.OrdinalIgnoreCase)) { args = (string.IsNullOrEmpty(text4) ? "boxdeny" : ("boxdeny " + text4)); } else if (text2.Equals("/boxlist", StringComparison.OrdinalIgnoreCase)) { args = "boxlist"; } else if (text2.Equals("/boxsave", StringComparison.OrdinalIgnoreCase)) { args = (string.IsNullOrEmpty(text4) ? "preset save" : ("preset save " + text4)); } else if (text2.Equals("/boxload", StringComparison.OrdinalIgnoreCase)) { args = (string.IsNullOrEmpty(text4) ? "preset load" : ("preset load " + text4)); } else if (text2.Equals("/boxdel", StringComparison.OrdinalIgnoreCase)) { args = (string.IsNullOrEmpty(text4) ? "preset delete" : ("preset delete " + text4)); } else if (text2.Equals("/boxpresets", StringComparison.OrdinalIgnoreCase)) { args = "preset list"; } else if (text2.Equals("/save", StringComparison.OrdinalIgnoreCase)) { if (!TryParseBoxPresetRoot(text4, out string slot)) { return true; } args = "preset save " + slot; } else if (!text2.Equals("/load", StringComparison.OrdinalIgnoreCase)) { args = (text2.Equals("/remove", StringComparison.OrdinalIgnoreCase) ? (string.IsNullOrEmpty(text4) ? "remove" : ("remove " + text4)) : ((!IsWhitelistPrefix(text2)) ? (string.IsNullOrEmpty(text4) ? "status" : text4) : (string.IsNullOrEmpty(text4) ? "whitelist toggle" : ("whitelist " + text4)))); } else { if (!TryParseBoxPresetRoot(text4, out string slot2)) { return true; } args = "preset load " + slot2; } HandleCommand(__instance, args); SetChatFocusFalse(__instance); return false; } catch (Exception ex) { PlayerCollisionPlugin.Log.LogError((object)("[Commands] Collider command failed: " + ex.Message)); return false; } } private static bool TryParseBoxPresetRoot(string rest, out string slot) { slot = string.Empty; if (string.IsNullOrWhiteSpace(rest)) { return false; } string[] array = rest.Trim().Split(new char[2] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length != 2) { return false; } if (!array[0].Equals("boxpreset", StringComparison.OrdinalIgnoreCase)) { return false; } slot = array[1]; return true; } private static bool IsAnchorPrefix(string prefix) { return prefix.Equals("/anchor", StringComparison.OrdinalIgnoreCase) || prefix.Equals("/stick", StringComparison.OrdinalIgnoreCase) || prefix.Equals("/ca", StringComparison.OrdinalIgnoreCase); } private static bool IsWhitelistPrefix(string prefix) { return prefix.Equals("/boxwhitelist", StringComparison.OrdinalIgnoreCase) || prefix.Equals("/boxwl", StringComparison.OrdinalIgnoreCase) || prefix.Equals("/cwl", StringComparison.OrdinalIgnoreCase) || prefix.Equals("/wl", StringComparison.OrdinalIgnoreCase); } private static void HandleCommand(ChatBehaviour chat, string args) { PlayerCollisionPlugin instance = PlayerCollisionPlugin.Instance; if (string.IsNullOrWhiteSpace(args)) { args = "status"; } string[] array = args.Trim().Split(new char[2] { ' ', '\t' }, 2); string text = array[0].ToLowerInvariant(); string text2 = ((array.Length > 1) ? array[1].Trim() : string.Empty); switch (text) { case "on": case "enable": instance.SetLocalCollisionEnabled(enabled: true); SendLocalMessage(chat, "[Collider] Mod and local collision enabled."); break; case "off": case "disable": instance.SetLocalCollisionEnabled(enabled: false); SendLocalMessage(chat, "[Collider] Local collision disabled."); break; case "toggle": instance.SetLocalCollisionEnabled(!instance.EffectiveCollisionEnabled); SendLocalMessage(chat, instance.EffectiveCollisionEnabled ? "[Collider] Mod and local collision enabled." : "[Collider] Local collision disabled."); break; case "panic": instance.PanicLocal(); SendLocalMessage(chat, "[Collider] Panic used. Local collision disabled and grace reset."); break; case "debug": { bool flag = !PlayerCollisionPlugin.ModConfig.DebugCollidersEnabled.Value; PlayerCollisionPlugin.ModConfig.DebugCollidersEnabled.Value = flag; SendLocalMessage(chat, "[Collider] Debug colliders " + (flag ? "enabled" : "disabled") + "."); break; } case "reset": case "resetbody": case "resetbox": ResetBoxDefaults(); SendLocalMessage(chat, "[Collider] Box dimensions reset to defaults. New size will apply within ~0.1s."); break; case "anchor": case "stick": case "a": HandleAnchorCommand(chat, text2); break; case "whitelist": case "boxwhitelist": case "boxwl": case "cwl": case "wl": HandleWhitelistCommand(chat, text2); break; case "allow": case "boxallow": HandleAllow(chat, text2, removeInstead: false); break; case "deny": case "boxdeny": HandleAllow(chat, text2, removeInstead: true); break; case "list": case "boxlist": { HashSet whitelistSet = PlayerCollisionPlugin.ModConfig.GetWhitelistSet(); bool value = PlayerCollisionPlugin.ModConfig.WhitelistEnabled.Value; if (whitelistSet.Count == 0) { SendLocalMessage(chat, value ? "[Collider] Whitelist is ON but empty. No remote player boxes are active until you add someone." : "[Collider] Whitelist is empty (and currently off). All remote players can collide normally."); break; } SendLocalMessage(chat, string.Format("[Collider] Whitelist ({0} entries, mode={1}):", whitelistSet.Count, value ? "on" : "off")); { foreach (string item in whitelistSet) { SendLocalMessage(chat, " " + item); } break; } } case "preset": case "presets": HandlePresetCommand(chat, text2); break; case "remove": HandleRemove(chat, text2); break; case "status": SendStatus(chat, IsAllToken(text2)); break; case "scan": case "players": case "server": SendStatus(chat, includeAllPlayers: true); break; case "help": case "?": SendHelp(chat); break; default: SendLocalMessage(chat, "[Collider] Unknown command. Use /collider help for the list."); break; } } private static void HandleRemove(ChatBehaviour chat, string nameArg) { string message; string text = (PlayerCollisionPlugin.Registry.TryRemoveHeadRider(nameArg, out message) ? "#80FF80" : (string.IsNullOrWhiteSpace(nameArg) ? "#80C8FF" : "#FFFF80")); SendLocalMessage(chat, "[Collider] " + message); } private static void HandlePresetCommand(ChatBehaviour chat, string args) { string[] array = (string.IsNullOrWhiteSpace(args) ? Array.Empty() : args.Trim().Split(new char[2] { ' ', '\t' }, 2)); string text = ((array.Length != 0) ? array[0].ToLowerInvariant() : "list"); string text2 = ((array.Length > 1) ? array[1].Trim() : string.Empty); PlayerCollisionPlugin instance = PlayerCollisionPlugin.Instance; switch (text) { case "save": case "s": { string presetName2; string error2; if (string.IsNullOrWhiteSpace(text2)) { SendLocalMessage(chat, "[Collider] Usage: /save boxpreset 1 (slots: 1, 2, 3)"); } else if (instance.SaveBoxPreset(text2, out presetName2, out error2)) { SendLocalMessage(chat, "[Collider] Saved box preset " + presetName2 + ". Load it with /load boxpreset " + presetName2 + "."); } else { SendLocalMessage(chat, "[Collider] " + error2); } break; } case "load": case "l": { string presetName; string error; if (string.IsNullOrWhiteSpace(text2)) { SendLocalMessage(chat, "[Collider] Usage: /load boxpreset 1 (slots: 1, 2, 3)"); } else if (instance.LoadBoxPreset(text2, out presetName, out error)) { SendLocalMessage(chat, "[Collider] Loaded box preset " + presetName + "."); } else { SendLocalMessage(chat, "[Collider] " + error); } break; } case "delete": case "del": case "remove": { string presetName3; if (string.IsNullOrWhiteSpace(text2)) { SendLocalMessage(chat, "[Collider] Usage: /collider preset delete 1 (slots: 1, 2, 3)"); } else if (instance.DeleteBoxPreset(text2, out presetName3)) { SendLocalMessage(chat, "[Collider] Deleted box preset " + presetName3 + "."); } else { SendLocalMessage(chat, "[Collider] Box preset " + text2 + " was not found."); } break; } case "list": case "ls": { string[] boxPresetNames = PlayerCollisionPlugin.ModConfig.GetBoxPresetNames(); SendLocalMessage(chat, (boxPresetNames.Length == 0) ? "[Collider] No box presets saved yet. Use /save boxpreset 1." : ("[Collider] Saved box preset slots: " + string.Join(", ", boxPresetNames))); break; } default: SendLocalMessage(chat, "[Collider] Usage: /save boxpreset 1 or /load boxpreset 1 (slots: 1, 2, 3)"); break; } } private static void HandleAnchorCommand(ChatBehaviour chat, string action) { string text = (string.IsNullOrWhiteSpace(action) ? "toggle" : action.Trim().ToLowerInvariant()); if (text.StartsWith("rotate", StringComparison.OrdinalIgnoreCase)) { string[] array = text.Split(new char[2] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); HandleAnchorRotateCommand(chat, (array.Length > 1) ? array[1] : "toggle"); return; } ConfigEntry anchorRiderToCarrier = PlayerCollisionPlugin.ModConfig.AnchorRiderToCarrier; switch (text) { case "on": case "enable": case "enabled": case "true": case "1": anchorRiderToCarrier.Value = true; SendAnchorState(chat); break; case "off": case "disable": case "disabled": case "false": case "0": anchorRiderToCarrier.Value = false; SendAnchorState(chat); break; case "toggle": case "t": anchorRiderToCarrier.Value = !anchorRiderToCarrier.Value; SendAnchorState(chat); break; case "status": case "state": case "s": SendAnchorState(chat); break; default: SendLocalMessage(chat, "[Collider] Usage: /anchor [on|off|toggle|status] or /anchor rotate [on|off|status]"); break; } } private static void HandleAnchorRotateCommand(ChatBehaviour chat, string action) { string text = (string.IsNullOrWhiteSpace(action) ? "toggle" : action.Trim().ToLowerInvariant()); ConfigEntry anchorRotateWithCarrier = PlayerCollisionPlugin.ModConfig.AnchorRotateWithCarrier; switch (text) { case "on": case "enable": case "enabled": case "true": case "1": anchorRotateWithCarrier.Value = true; SendAnchorRotateState(chat); break; case "off": case "disable": case "disabled": case "false": case "0": anchorRotateWithCarrier.Value = false; SendAnchorRotateState(chat); break; case "toggle": case "t": anchorRotateWithCarrier.Value = !anchorRotateWithCarrier.Value; SendAnchorRotateState(chat); break; case "status": case "state": case "s": SendAnchorRotateState(chat); break; default: SendLocalMessage(chat, "[Collider] Usage: /anchor rotate [on|off|toggle|status]"); break; } } private static void SendAnchorState(ChatBehaviour chat) { bool value = PlayerCollisionPlugin.ModConfig.AnchorRiderToCarrier.Value; SendLocalMessage(chat, value ? "[Collider] Anchor mode ON. Shortcuts: /anchor off, /stick off, /ca off." : "[Collider] Anchor mode OFF. Shortcuts: /anchor on, /stick on, /ca on."); } private static void SendAnchorRotateState(ChatBehaviour chat) { bool value = PlayerCollisionPlugin.ModConfig.AnchorRotateWithCarrier.Value; SendLocalMessage(chat, value ? "[Collider] Stick rotation ON. Rider turns with carrier rotation but can still turn locally." : "[Collider] Stick rotation OFF. Rider facing is fully free while stuck."); } private static void HandleWhitelistCommand(ChatBehaviour chat, string action) { string text = (string.IsNullOrWhiteSpace(action) ? "toggle" : action.Trim().ToLowerInvariant()); ConfigEntry whitelistEnabled = PlayerCollisionPlugin.ModConfig.WhitelistEnabled; switch (text) { case "on": case "enable": case "enabled": case "true": case "1": whitelistEnabled.Value = true; SendWhitelistState(chat); break; case "off": case "disable": case "disabled": case "false": case "0": whitelistEnabled.Value = false; SendWhitelistState(chat); break; case "toggle": case "t": whitelistEnabled.Value = !whitelistEnabled.Value; SendWhitelistState(chat); break; case "status": case "state": case "s": SendWhitelistState(chat); break; default: SendLocalMessage(chat, "[Collider] Usage: /boxwhitelist [on|off|toggle|status] Aliases: /boxwl, /cwl, /wl"); break; } } private static void SendWhitelistState(ChatBehaviour chat) { bool value = PlayerCollisionPlugin.ModConfig.WhitelistEnabled.Value; int count = PlayerCollisionPlugin.ModConfig.GetWhitelistSet().Count; SendLocalMessage(chat, value ? $"[Collider] Whitelist mode ON. Listed remote players get boxes on your client; compatible clients also hide your box unless listed. {count} player(s) listed. /boxallow to add." : $"[Collider] Whitelist mode OFF. All remote players collide normally on your client. {count} player(s) saved in the whitelist."); } private static void HandleAllow(ChatBehaviour chat, string nameArg, bool removeInstead) { if (string.IsNullOrWhiteSpace(nameArg)) { SendLocalMessage(chat, removeInstead ? "[Collider] Usage: /collider deny " : "[Collider] Usage: /collider allow "); return; } string text = nameArg.Trim().ToLowerInvariant(); Player[] array = Object.FindObjectsOfType(); Player val = null; Player val2 = null; Player val3 = null; string text2 = string.Empty; Player[] array2 = array; foreach (Player val4 in array2) { if ((Object)(object)val4 == (Object)null) { continue; } string text3 = PlayerIdentity.GetDisplayName(val4) ?? string.Empty; string text4 = text3.ToLowerInvariant(); if (text4 == text) { val = val4; text2 = text3; break; } if (text4.StartsWith(text) && (Object)(object)val2 == (Object)null) { val2 = val4; if (text2.Length == 0) { text2 = text3; } } else if (text4.Contains(text) && (Object)(object)val3 == (Object)null) { val3 = val4; if (text2.Length == 0) { text2 = text3; } } } Player val5 = val ?? val2 ?? val3; if ((Object)(object)val5 == (Object)null) { SendLocalMessage(chat, "[Collider] No player named '" + nameArg + "' found in this server."); return; } string text5 = PlayerIdentity.GetSteamId(val5) ?? "0"; if (text5 == "0") { SendLocalMessage(chat, "[Collider] Found '" + text2 + "' but steam id not available yet."); } else if (removeInstead) { bool flag = PlayerCollisionPlugin.ModConfig.RemoveFromWhitelist(text5); SendLocalMessage(chat, flag ? ("[Collider] Removed '" + text2 + "' (" + text5 + ") from whitelist.") : ("[Collider] '" + text2 + "' (" + text5 + ") was not on the whitelist.")); } else { bool flag2 = PlayerCollisionPlugin.ModConfig.AddToWhitelist(text5); SendLocalMessage(chat, flag2 ? ("[Collider] Whitelisted '" + text2 + "' (" + text5 + ").") : ("[Collider] '" + text2 + "' (" + text5 + ") was already whitelisted.")); } } private static void ResetBoxDefaults() { CollisionConfig modConfig = PlayerCollisionPlugin.ModConfig; modConfig.ResetSessionBoxDimensions(); modConfig.MinDimension.Value = (float)((ConfigEntryBase)modConfig.MinDimension).DefaultValue; modConfig.MaxDimension.Value = (float)((ConfigEntryBase)modConfig.MaxDimension).DefaultValue; modConfig.TinyDisableThreshold.Value = (float)((ConfigEntryBase)modConfig.TinyDisableThreshold).DefaultValue; modConfig.PlatformExtraWidth.Value = (float)((ConfigEntryBase)modConfig.PlatformExtraWidth).DefaultValue; modConfig.PlatformExtraDepth.Value = (float)((ConfigEntryBase)modConfig.PlatformExtraDepth).DefaultValue; modConfig.PlatformThickness.Value = (float)((ConfigEntryBase)modConfig.PlatformThickness).DefaultValue; modConfig.PlatformTopOffset.Value = (float)((ConfigEntryBase)modConfig.PlatformTopOffset).DefaultValue; modConfig.HeadBoneTopOffset.Value = (float)((ConfigEntryBase)modConfig.HeadBoneTopOffset).DefaultValue; modConfig.BodyHeadClearance.Value = (float)((ConfigEntryBase)modConfig.BodyHeadClearance).DefaultValue; modConfig.BodyWidthAdjustment.Value = (float)((ConfigEntryBase)modConfig.BodyWidthAdjustment).DefaultValue; modConfig.BodyDepthAdjustment.Value = (float)((ConfigEntryBase)modConfig.BodyDepthAdjustment).DefaultValue; modConfig.BodyHeightAdjustment.Value = (float)((ConfigEntryBase)modConfig.BodyHeightAdjustment).DefaultValue; modConfig.HeadWidthAdjustment.Value = (float)((ConfigEntryBase)modConfig.HeadWidthAdjustment).DefaultValue; modConfig.HeadDepthAdjustment.Value = (float)((ConfigEntryBase)modConfig.HeadDepthAdjustment).DefaultValue; modConfig.HeadHeightAdjustment.Value = (float)((ConfigEntryBase)modConfig.HeadHeightAdjustment).DefaultValue; modConfig.ChestBoxHeightRatio.Value = (float)((ConfigEntryBase)modConfig.ChestBoxHeightRatio).DefaultValue; modConfig.ChestBoxWidthMultiplier.Value = (float)((ConfigEntryBase)modConfig.ChestBoxWidthMultiplier).DefaultValue; modConfig.ChestBoxDepthMultiplier.Value = (float)((ConfigEntryBase)modConfig.ChestBoxDepthMultiplier).DefaultValue; modConfig.ChestBoxThickness.Value = (float)((ConfigEntryBase)modConfig.ChestBoxThickness).DefaultValue; modConfig.ChestBoxForwardOffset.Value = (float)((ConfigEntryBase)modConfig.ChestBoxForwardOffset).DefaultValue; modConfig.VisualBoundsLerpSpeed.Value = (float)((ConfigEntryBase)modConfig.VisualBoundsLerpSpeed).DefaultValue; modConfig.PoseMeasureIntervalSeconds.Value = (float)((ConfigEntryBase)modConfig.PoseMeasureIntervalSeconds).DefaultValue; modConfig.PushStrength.Value = (float)((ConfigEntryBase)modConfig.PushStrength).DefaultValue; modConfig.MaxPushPerFrame.Value = (float)((ConfigEntryBase)modConfig.MaxPushPerFrame).DefaultValue; modConfig.UseBakedPoseBounds.Value = false; modConfig.UseBodyMeshForSize.Value = true; modConfig.VisualBoundsEnabled.Value = true; modConfig.IncludeAccessoriesInBounds.Value = false; modConfig.StaticBoxesEnabled.Value = true; modConfig.DynamicBoxesEnabled.Value = false; modConfig.UnsafeStickEnabled.Value = true; modConfig.StrictStickEnabled.Value = false; modConfig.ChestBoxEnabled.Value = false; modConfig.NormalizeBoxMode(preferStatic: true); modConfig.NormalizeStickMode(preferUnsafe: true); } private static void SendHelp(ChatBehaviour chat) { SendLocalMessage(chat, "[Collider] Available commands:"); SendLocalMessage(chat, " /collider on - Enable local player collision"); SendLocalMessage(chat, " /collider off - Disable local player collision"); SendLocalMessage(chat, " /collider toggle - Flip the enable/disable state"); SendLocalMessage(chat, " /collider debug - Toggle visible green wireframe boxes"); SendLocalMessage(chat, " /anchor on|off - Shortcut for stick-to-carrier mode"); SendLocalMessage(chat, " /anchor rotate on|off - Rotate rider with carrier while stick is active"); SendLocalMessage(chat, " /stick - Toggle anchor mode; alias: /ca"); SendLocalMessage(chat, " /collider anchor on|off|status - Full anchor command"); SendLocalMessage(chat, " /collider reset - Reset box dimensions and platform settings to defaults"); SendLocalMessage(chat, " /collider status - Print local player bounds + diagnostics"); SendLocalMessage(chat, " /collider status all - Print scale and box diagnostics for every tracked player"); SendLocalMessage(chat, " /remove - Remove a detected rider from your head box"); SendLocalMessage(chat, " /collider panic - Emergency disable + reset grace period"); SendLocalMessage(chat, " /collider whitelist on|off|status - Set or check whitelist-only mode"); SendLocalMessage(chat, " /boxwl on|off|status - Short whitelist command; aliases: /cwl, /wl"); SendLocalMessage(chat, " /collider allow - Add player to the whitelist"); SendLocalMessage(chat, " /collider deny - Remove player from the whitelist"); SendLocalMessage(chat, " /collider list - Show every steam id on the whitelist"); SendLocalMessage(chat, " /save boxpreset 1 - Save box tuning to slot 1 (slots 1-3)"); SendLocalMessage(chat, " /load boxpreset 1 - Load box tuning from slot 1"); SendLocalMessage(chat, " /boxsave 1, /boxload 1, /boxpresets - Preset shortcuts"); SendLocalMessage(chat, " /collider help - Show this list"); SendLocalMessage(chat, "Aliases: /col, /collision, /pcollision"); } private static void SendStatus(ChatBehaviour chat, bool includeAllPlayers = false) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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) CollisionPlayerState localPlayer = PlayerCollisionPlugin.Registry.LocalPlayer; int count = PlayerCollisionPlugin.Registry.Players.Count; string text; if (localPlayer == null) { text = "local player not found yet"; } else if (!localPlayer.HasBounds) { text = $"local={localPlayer.DisplayName}, steam={localPlayer.SteamId}, bounds=NONE, grace={localPlayer.IsInGracePeriod}"; } else { Bounds bounds = localPlayer.Bounds; Vector3 size = ((Bounds)(ref bounds)).size; bounds = localPlayer.Bounds; Vector3 center = ((Bounds)(ref bounds)).center; text = "local=" + localPlayer.DisplayName + ", steam=" + localPlayer.SteamId + ", " + $"size=({size.x:F2},{size.y:F2},{size.z:F2}), " + $"center=({center.x:F2},{center.y:F2},{center.z:F2}), " + $"renderers={localPlayer.CachedRenderers.Length}, grace={localPlayer.IsInGracePeriod}"; } CollisionConfig modConfig = PlayerCollisionPlugin.ModConfig; string text2 = (modConfig.IsDynamicBoxMode() ? "dynamic" : "static"); string text3 = (modConfig.IsStrictStickMode() ? "oldStrict" : "emote"); SendLocalMessage(chat, $"[Collider] modEnabled={modConfig.ModEnabled.Value}, localCollision={PlayerCollisionPlugin.Instance.LocalCollisionEnabled}, effective={PlayerCollisionPlugin.Instance.EffectiveCollisionEnabled}, boxMode={text2}, stickSafety={text3}, chestBox={modConfig.ChestBoxEnabled.Value}, players={count}, {text}"); if (!includeAllPlayers) { return; } foreach (CollisionPlayerState player in PlayerCollisionPlugin.Registry.Players) { SendLocalMessage(chat, FormatPlayerDiagnostics(player)); } } private static bool IsAllToken(string token) { if (string.IsNullOrWhiteSpace(token)) { return false; } return token.Equals("all", StringComparison.OrdinalIgnoreCase) || token.Equals("players", StringComparison.OrdinalIgnoreCase) || token.Equals("server", StringComparison.OrdinalIgnoreCase); } private static string FormatPlayerDiagnostics(CollisionPlayerState state) { //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) if (state == null) { return "[Collider] "; } if (!state.HasBounds) { return "[Collider] " + state.DisplayName + ": steam=" + state.SteamId + ", bounds=NONE, " + $"scale=({state.EffectiveScale.x:F2},{state.EffectiveScale.y:F2}), tiny={state.TinyScale:F3}, " + $"boxMode={state.BoxSizingMode}, measure={state.MeasurementMode}, chest={state.ChestBoxActive}, poseLowered={state.StaticPoseLowered}, remotePose={state.HasRemotePoseState}/{state.RemotePoseLowered}/{state.RemotePoseSitting}/{state.RemotePoseEmoting}, " + $"map={state.IsSameMapAsLocal}, near={state.IsNearLocalPlayer}, debugNear={state.ShouldRenderDebug}, " + $"localWhitelist={state.IsLocalWhitelisted}, remoteWhitelist={state.IsRemoteWhitelisted}/{state.HasRemoteWhitelistPolicy}, " + $"boxObj={state.BodyObjectActive}, solid={state.SolidBodyActive}/{state.ExpectsSolidBody}, platform={state.PlatformActive}/{state.ExpectsPlatform}, reason={state.LastHideReason}, " + $"renderers={state.CachedRenderers.Length}, grace={state.IsInGracePeriod}"; } return "[Collider] " + state.DisplayName + ": steam=" + state.SteamId + ", " + $"scale=({state.EffectiveScale.x:F2},{state.EffectiveScale.y:F2}), " + $"tiny={state.TinyScale:F3}, " + $"boxMode={state.BoxSizingMode}, measure={state.MeasurementMode}, chest={state.ChestBoxActive}, poseLowered={state.StaticPoseLowered}, remotePose={state.HasRemotePoseState}/{state.RemotePoseLowered}/{state.RemotePoseSitting}/{state.RemotePoseEmoting}, " + $"body=({state.BoxWidth:F2},{state.BoxHeight:F2},{state.BoxDepth:F2}), " + $"head=({state.HeadBoxWidth:F2},{state.HeadBoxThickness:F2},{state.HeadBoxDepth:F2}), " + $"bodyTop={state.TopOffsetY:F2}, headTop={state.HeadBoxTopOffsetY:F2}, headTracked={(Object)(object)state.CachedHeadTransform != (Object)null}, whitelisted={state.IsWhitelisted}, " + $"localWhitelist={state.IsLocalWhitelisted}, remoteWhitelist={state.IsRemoteWhitelisted}/{state.HasRemoteWhitelistPolicy}, " + $"map={state.IsSameMapAsLocal}, near={state.IsNearLocalPlayer}, debugNear={state.ShouldRenderDebug}, " + $"boxObj={state.BodyObjectActive}, solid={state.SolidBodyActive}/{state.ExpectsSolidBody}, platform={state.PlatformActive}/{state.ExpectsPlatform}, wire={state.WireVisible}, reason={state.LastHideReason}, " + $"renderers={state.CachedRenderers.Length}, grace={state.IsInGracePeriod}"; } private static void SendLocalMessage(ChatBehaviour chat, string message) { try { try { MaxOnscreenField?.SetValue(chat, 50); } catch { } chat.Init_GameLogicMessage(message); } catch (Exception ex) { PlayerCollisionPlugin.Log.LogError((object)("[Commands] Failed to send local message: " + ex.Message)); } } private static void SetChatFocusFalse(ChatBehaviour chat) { try { string[] array = new string[5] { "Init_ChatFocusFalse", "Set_ChatFocusFalse", "Close_Chat", "Deactivate_Chat", "Exit_Chat" }; Type type = ((object)chat).GetType(); string[] array2 = array; foreach (string name in array2) { MethodInfo method = type.GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(method == null)) { method.Invoke(chat, null); return; } } type.GetField("_focusedInChat", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(chat, false); } catch { } } } internal static class CommandLibBinding { [CompilerGenerated] private static class <>O { public static CommandCallback <0>__Handle; public static CommandCallback <1>__HandleAnchorShortcut; public static CommandCallback <2>__HandleBoxAllow; public static CommandCallback <3>__HandleBoxDeny; public static CommandCallback <4>__HandleBoxList; public static CommandCallback <5>__HandleBoxWhitelist; public static CommandCallback <6>__HandleRemoveRider; public static CommandCallback <7>__HandleBoxSavePreset; public static CommandCallback <8>__HandleBoxLoadPreset; public static CommandCallback <9>__HandleBoxDeletePreset; public static CommandCallback <10>__HandleBoxListPresets; public static CommandCallback <11>__HandleRootSave; public static CommandCallback <12>__HandleRootLoad; } internal static void Register() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00e2: Expected O, but got Unknown //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Expected O, but got Unknown //IL_014f: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Expected O, but got Unknown //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown try { CommandOptions value = default(CommandOptions); ((CommandOptions)(ref value))..ctor((ChatCommandType)1); object obj = <>O.<0>__Handle; if (obj == null) { CommandCallback val = Handle; <>O.<0>__Handle = val; obj = (object)val; } ModCommand val2 = Utils.RegisterCommand("collider", "Manage the player collider mod. Args: on, off, toggle, status, debug, panic, anchor, reset, whitelist, allow, deny, list, remove, preset", "Examples: /collider on | /save boxpreset 1 | /remove PlayerName", (CommandCallback)obj, (CommandOptions?)value); Utils.RegisterAlias(new string[3] { "col", "collision", "pcollision" }, val2); object obj2 = <>O.<1>__HandleAnchorShortcut; if (obj2 == null) { CommandCallback val3 = HandleAnchorShortcut; <>O.<1>__HandleAnchorShortcut = val3; obj2 = (object)val3; } ModCommand val4 = Utils.RegisterCommand("anchor", "Toggle or set stick-to-carrier mode. /anchor [on|off|toggle|status]", "Examples: /anchor | /anchor on | /stick off | /ca status", (CommandCallback)obj2, (CommandOptions?)value); Utils.RegisterAlias(new string[2] { "stick", "ca" }, val4); object obj3 = <>O.<2>__HandleBoxAllow; if (obj3 == null) { CommandCallback val5 = HandleBoxAllow; <>O.<2>__HandleBoxAllow = val5; obj3 = (object)val5; } ModCommand val6 = Utils.RegisterCommand("boxallow", "Add a player to the collision whitelist by display name. /boxallow ", "Looks up the remote player's steam id and adds it to the whitelist. Only meaningful when /boxwhitelist is on.", (CommandCallback)obj3, (CommandOptions?)value); object obj4 = <>O.<3>__HandleBoxDeny; if (obj4 == null) { CommandCallback val7 = HandleBoxDeny; <>O.<3>__HandleBoxDeny = val7; obj4 = (object)val7; } ModCommand val8 = Utils.RegisterCommand("boxdeny", "Remove a player from the collision whitelist by display name. /boxdeny ", "Removes the player's steam id from the whitelist.", (CommandCallback)obj4, (CommandOptions?)value); object obj5 = <>O.<4>__HandleBoxList; if (obj5 == null) { CommandCallback val9 = HandleBoxList; <>O.<4>__HandleBoxList = val9; obj5 = (object)val9; } ModCommand val10 = Utils.RegisterCommand("boxlist", "List every steam id currently in the collision whitelist.", "Shows the names that match each id if those players are nearby.", (CommandCallback)obj5, (CommandOptions?)value); object obj6 = <>O.<5>__HandleBoxWhitelist; if (obj6 == null) { CommandCallback val11 = HandleBoxWhitelist; <>O.<5>__HandleBoxWhitelist = val11; obj6 = (object)val11; } ModCommand val12 = Utils.RegisterCommand("boxwhitelist", "Toggle whitelist-only collision mode. /boxwhitelist [on|off|toggle|status]", "When ON, only listed remote players have solid colliders on your client. Default: off.", (CommandCallback)obj6, (CommandOptions?)value); Utils.RegisterAlias(new string[3] { "boxwl", "cwl", "wl" }, val12); try { object obj7 = <>O.<6>__HandleRemoveRider; if (obj7 == null) { CommandCallback val13 = HandleRemoveRider; <>O.<6>__HandleRemoveRider = val13; obj7 = (object)val13; } Utils.RegisterCommand("remove", "Remove a detected rider from your head box. /remove [player name]", "Use /remove to list detected riders, or /remove to remove one.", (CommandCallback)obj7, (CommandOptions?)value); } catch (Exception ex) { PlayerCollisionPlugin.Log.LogWarning((object)("[CommandLib] Could not register /remove shortcut: " + ex.Message)); } object obj8 = <>O.<7>__HandleBoxSavePreset; if (obj8 == null) { CommandCallback val14 = HandleBoxSavePreset; <>O.<7>__HandleBoxSavePreset = val14; obj8 = (object)val14; } ModCommand val15 = Utils.RegisterCommand("boxsave", "Save current collider sizing settings to preset slot 1-3. /boxsave ", "Example: /boxsave 1", (CommandCallback)obj8, (CommandOptions?)value); object obj9 = <>O.<8>__HandleBoxLoadPreset; if (obj9 == null) { CommandCallback val16 = HandleBoxLoadPreset; <>O.<8>__HandleBoxLoadPreset = val16; obj9 = (object)val16; } ModCommand val17 = Utils.RegisterCommand("boxload", "Load collider sizing settings from preset slot 1-3. /boxload ", "Example: /boxload 1", (CommandCallback)obj9, (CommandOptions?)value); object obj10 = <>O.<9>__HandleBoxDeletePreset; if (obj10 == null) { CommandCallback val18 = HandleBoxDeletePreset; <>O.<9>__HandleBoxDeletePreset = val18; obj10 = (object)val18; } ModCommand val19 = Utils.RegisterCommand("boxdel", "Delete collider sizing preset slot 1-3. /boxdel ", "Example: /boxdel 1", (CommandCallback)obj10, (CommandOptions?)value); object obj11 = <>O.<10>__HandleBoxListPresets; if (obj11 == null) { CommandCallback val20 = HandleBoxListPresets; <>O.<10>__HandleBoxListPresets = val20; obj11 = (object)val20; } ModCommand val21 = Utils.RegisterCommand("boxpresets", "List saved collider sizing presets.", "Example: /boxpresets", (CommandCallback)obj11, (CommandOptions?)value); try { object obj12 = <>O.<11>__HandleRootSave; if (obj12 == null) { CommandCallback val22 = HandleRootSave; <>O.<11>__HandleRootSave = val22; obj12 = (object)val22; } Utils.RegisterCommand("save", "Save a numbered box preset. Usage: /save boxpreset <1-3>", "Example: /save boxpreset 1", (CommandCallback)obj12, (CommandOptions?)value); object obj13 = <>O.<12>__HandleRootLoad; if (obj13 == null) { CommandCallback val23 = HandleRootLoad; <>O.<12>__HandleRootLoad = val23; obj13 = (object)val23; } Utils.RegisterCommand("load", "Load a numbered box preset. Usage: /load boxpreset <1-3>", "Example: /load boxpreset 1", (CommandCallback)obj13, (CommandOptions?)value); } catch (Exception ex2) { PlayerCollisionPlugin.Log.LogWarning((object)("[CommandLib] Could not register /save or /load preset shortcuts: " + ex2.Message)); } PlayerCollisionPlugin.Log.LogInfo((object)"[CommandLib] Registered /collider, /anchor, /stick, /ca + whitelist, remove, and preset commands."); } catch (Exception ex3) { PlayerCollisionPlugin.Log.LogError((object)("[CommandLib] Registration failed: " + ex3.Message)); } } private static bool Handle(Caller caller, string[] args) { //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_06ff: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_0793: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Unknown result type (might be due to invalid IL or missing references) //IL_079f: Unknown result type (might be due to invalid IL or missing references) //IL_07b0: Unknown result type (might be due to invalid IL or missing references) //IL_074c: Unknown result type (might be due to invalid IL or missing references) //IL_0758: Unknown result type (might be due to invalid IL or missing references) //IL_0769: Unknown result type (might be due to invalid IL or missing references) //IL_0713: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) PlayerCollisionPlugin instance = PlayerCollisionPlugin.Instance; string text = ((args.Length == 0) ? "status" : args[0]).ToLowerInvariant(); switch (text) { case "on": case "enable": instance.SetLocalCollisionEnabled(enabled: true); Utils.NotifyCaller(caller, "[Collider] Mod and local collision enabled.", new Color(0.5f, 1f, 0.5f)); return true; case "off": case "disable": instance.SetLocalCollisionEnabled(enabled: false); Utils.NotifyCaller(caller, "[Collider] Local collision disabled.", new Color(1f, 0.5f, 0.5f)); return true; case "toggle": instance.SetLocalCollisionEnabled(!instance.EffectiveCollisionEnabled); Utils.NotifyCaller(caller, instance.EffectiveCollisionEnabled ? "[Collider] Mod and local collision enabled." : "[Collider] Local collision disabled.", instance.EffectiveCollisionEnabled ? new Color(0.5f, 1f, 0.5f) : new Color(1f, 0.5f, 0.5f)); return true; case "panic": instance.PanicLocal(); Utils.NotifyCaller(caller, "[Collider] Panic used. Local collision disabled and grace reset.", new Color(1f, 0.5f, 0.5f)); return true; case "debug": { bool flag = !PlayerCollisionPlugin.ModConfig.DebugCollidersEnabled.Value; PlayerCollisionPlugin.ModConfig.DebugCollidersEnabled.Value = flag; Utils.NotifyCaller(caller, "[Collider] Debug colliders " + (flag ? "enabled" : "disabled") + ".", new Color(0.5f, 0.78f, 1f)); return true; } case "reset": case "resetbody": case "resetbox": ResetBoxDefaults(); Utils.NotifyCaller(caller, "[Collider] Box dimensions reset to defaults. New size will apply within ~0.1s.", new Color(0.5f, 0.78f, 1f)); return true; case "anchor": case "stick": case "a": return HandleAnchorArgs(caller, args, 1); case "whitelist": case "boxwhitelist": case "boxwl": case "cwl": case "wl": return HandleBoxWhitelist(caller, TailArgs(args, 1)); case "allow": case "boxallow": return HandleBoxAllow(caller, TailArgs(args, 1)); case "deny": case "boxdeny": return HandleBoxDeny(caller, TailArgs(args, 1)); case "list": case "boxlist": return HandleBoxList(caller, TailArgs(args, 1)); case "preset": case "presets": return HandlePresetArgs(caller, args, 1); case "remove": return HandleRemoveRider(caller, TailArgs(args, 1)); case "status": SendStatus(caller, args.Length > 1 && IsAllToken(args[1])); return true; case "scan": case "players": case "server": SendStatus(caller, includeAllPlayers: true); return true; case "help": case "?": SendHelp(caller); return true; default: Utils.NotifyCaller(caller, "[Collider] Unknown subcommand '" + text + "'. Use /collider help for the full list.", Color.yellow); return false; } } private static string[] TailArgs(string[] args, int startIndex) { if (args.Length <= startIndex) { return Array.Empty(); } string[] array = new string[args.Length - startIndex]; Array.Copy(args, startIndex, array, 0, array.Length); return array; } private static bool HandleAnchorShortcut(Caller caller, string[] args) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HandleAnchorArgs(caller, args, 0); } private static bool HandleBoxSavePreset(Caller caller, string[] args) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HandlePresetShortcut(caller, "save", args); } private static bool HandleBoxLoadPreset(Caller caller, string[] args) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HandlePresetShortcut(caller, "load", args); } private static bool HandleBoxDeletePreset(Caller caller, string[] args) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HandlePresetShortcut(caller, "delete", args); } private static bool HandleBoxListPresets(Caller caller, string[] args) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HandlePresetShortcut(caller, "list", args); } private static bool HandleRootSave(Caller caller, string[] args) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HandleRootPresetCommand(caller, "save", args); } private static bool HandleRootLoad(Caller caller, string[] args) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HandleRootPresetCommand(caller, "load", args); } private static bool HandleRootPresetCommand(Caller caller, string action, string[] args) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (args.Length != 2 || !args[0].Equals("boxpreset", StringComparison.OrdinalIgnoreCase)) { Utils.NotifyCaller(caller, "[Collider] Usage: /" + action + " boxpreset <1-3>", Color.yellow); return true; } return HandlePresetShortcut(caller, action, new string[1] { args[1] }); } private static bool HandlePresetShortcut(Caller caller, string action, string[] args) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) string[] array = new string[args.Length + 1]; array[0] = action; Array.Copy(args, 0, array, 1, args.Length); return HandlePresetArgs(caller, array, 0); } private static bool HandleRemoveRider(Caller caller, string[] args) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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) string text = ((args.Length == 0) ? string.Empty : string.Join(" ", args).Trim()); string message; Color val = (Color)(PlayerCollisionPlugin.Registry.TryRemoveHeadRider(text, out message) ? new Color(0.5f, 1f, 0.5f) : (string.IsNullOrWhiteSpace(text) ? new Color(0.5f, 0.78f, 1f) : Color.yellow)); Utils.NotifyCaller(caller, "[Collider] " + message, val); return true; } private static bool HandlePresetArgs(Caller caller, string[] args, int startIndex) { //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) string text = ((args.Length <= startIndex) ? "list" : args[startIndex].ToLowerInvariant()); string text2 = ((args.Length <= startIndex + 1) ? string.Empty : string.Join(" ", TailArgs(args, startIndex + 1)).Trim()); PlayerCollisionPlugin instance = PlayerCollisionPlugin.Instance; switch (text) { case "save": case "s": { if (string.IsNullOrWhiteSpace(text2)) { Utils.NotifyCaller(caller, "[Collider] Usage: /save boxpreset 1 (slots: 1, 2, 3)", Color.yellow); return true; } if (instance.SaveBoxPreset(text2, out string presetName2, out string error2)) { Utils.NotifyCaller(caller, "[Collider] Saved box preset " + presetName2 + ". Load it with /load boxpreset " + presetName2 + ".", new Color(0.5f, 1f, 0.5f)); } else { Utils.NotifyCaller(caller, "[Collider] " + error2, Color.yellow); } return true; } case "load": case "l": { if (string.IsNullOrWhiteSpace(text2)) { Utils.NotifyCaller(caller, "[Collider] Usage: /load boxpreset 1 (slots: 1, 2, 3)", Color.yellow); return true; } if (instance.LoadBoxPreset(text2, out string presetName, out string error)) { Utils.NotifyCaller(caller, "[Collider] Loaded box preset " + presetName + ".", new Color(0.5f, 1f, 0.5f)); } else { Utils.NotifyCaller(caller, "[Collider] " + error, Color.yellow); } return true; } case "delete": case "del": case "remove": { if (string.IsNullOrWhiteSpace(text2)) { Utils.NotifyCaller(caller, "[Collider] Usage: /collider preset delete 1 (slots: 1, 2, 3)", Color.yellow); return true; } if (instance.DeleteBoxPreset(text2, out string presetName3)) { Utils.NotifyCaller(caller, "[Collider] Deleted box preset " + presetName3 + ".", new Color(1f, 0.78f, 0.5f)); } else { Utils.NotifyCaller(caller, "[Collider] Box preset " + text2 + " was not found.", Color.yellow); } return true; } case "list": case "ls": { string[] boxPresetNames = PlayerCollisionPlugin.ModConfig.GetBoxPresetNames(); Utils.NotifyCaller(caller, (boxPresetNames.Length == 0) ? "[Collider] No box presets saved yet. Use /save boxpreset 1." : ("[Collider] Saved box preset slots: " + string.Join(", ", boxPresetNames)), new Color(0.5f, 0.78f, 1f)); return true; } default: Utils.NotifyCaller(caller, "[Collider] Usage: /save boxpreset 1 or /load boxpreset 1 (slots: 1, 2, 3)", Color.yellow); return true; } } private static bool HandleAnchorArgs(Caller caller, string[] args, int startIndex) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) string text = ((args.Length <= startIndex) ? "toggle" : args[startIndex].ToLowerInvariant()); if (text == "rotate") { return HandleAnchorRotateArgs(caller, args, startIndex + 1); } ConfigEntry anchorRiderToCarrier = PlayerCollisionPlugin.ModConfig.AnchorRiderToCarrier; switch (text) { case "on": case "enable": case "enabled": case "true": case "1": anchorRiderToCarrier.Value = true; SendAnchorState(caller); return true; case "off": case "disable": case "disabled": case "false": case "0": anchorRiderToCarrier.Value = false; SendAnchorState(caller); return true; case "toggle": case "t": anchorRiderToCarrier.Value = !anchorRiderToCarrier.Value; SendAnchorState(caller); return true; case "status": case "state": case "s": SendAnchorState(caller); return true; default: Utils.NotifyCaller(caller, "[Collider] Usage: /anchor [on|off|toggle|status] or /anchor rotate [on|off|status]", Color.yellow); return true; } } private static bool HandleAnchorRotateArgs(Caller caller, string[] args, int startIndex) { //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) string text = ((args.Length <= startIndex) ? "toggle" : args[startIndex].ToLowerInvariant()); ConfigEntry anchorRotateWithCarrier = PlayerCollisionPlugin.ModConfig.AnchorRotateWithCarrier; switch (text) { case "on": case "enable": case "enabled": case "true": case "1": anchorRotateWithCarrier.Value = true; SendAnchorRotateState(caller); return true; case "off": case "disable": case "disabled": case "false": case "0": anchorRotateWithCarrier.Value = false; SendAnchorRotateState(caller); return true; case "toggle": case "t": anchorRotateWithCarrier.Value = !anchorRotateWithCarrier.Value; SendAnchorRotateState(caller); return true; case "status": case "state": case "s": SendAnchorRotateState(caller); return true; default: Utils.NotifyCaller(caller, "[Collider] Usage: /anchor rotate [on|off|toggle|status]", Color.yellow); return true; } } private static void SendAnchorState(Caller caller) { //IL_0011: 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_0033: Unknown result type (might be due to invalid IL or missing references) bool value = PlayerCollisionPlugin.ModConfig.AnchorRiderToCarrier.Value; Utils.NotifyCaller(caller, value ? "[Collider] Anchor mode ON. Shortcuts: /anchor off, /stick off, /ca off." : "[Collider] Anchor mode OFF. Shortcuts: /anchor on, /stick on, /ca on.", value ? new Color(0.5f, 1f, 0.5f) : new Color(1f, 0.5f, 0.5f)); } private static void SendAnchorRotateState(Caller caller) { //IL_0011: 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_0033: Unknown result type (might be due to invalid IL or missing references) bool value = PlayerCollisionPlugin.ModConfig.AnchorRotateWithCarrier.Value; Utils.NotifyCaller(caller, value ? "[Collider] Stick rotation ON. Rider turns with carrier rotation but can still turn locally." : "[Collider] Stick rotation OFF. Rider facing is fully free while stuck.", value ? new Color(0.5f, 1f, 0.5f) : new Color(1f, 0.78f, 0.5f)); } private static bool HandleBoxAllow(Caller caller, string[] args) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) if (args.Length == 0) { Utils.NotifyCaller(caller, "[Collider] Usage: /boxallow ", Color.yellow); return true; } string text = string.Join(" ", args).Trim(); if (!TryResolvePlayerByName(text, out string canonicalName, out string steamId)) { Utils.NotifyCaller(caller, "[Collider] No player named '" + text + "' found in this server. Names are matched exactly (case-insensitive).", Color.yellow); return true; } if (steamId == "0") { Utils.NotifyCaller(caller, "[Collider] Found '" + canonicalName + "' but their steam id is not available yet (still connecting?). Try again in a few seconds.", Color.yellow); return true; } bool flag = PlayerCollisionPlugin.ModConfig.AddToWhitelist(steamId); Utils.NotifyCaller(caller, flag ? ("[Collider] Whitelisted '" + canonicalName + "' (steam " + steamId + ").") : ("[Collider] '" + canonicalName + "' (steam " + steamId + ") was already whitelisted."), new Color(0.5f, 1f, 0.5f)); return true; } private static bool HandleBoxDeny(Caller caller, string[] args) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_004b: 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) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (args.Length == 0) { Utils.NotifyCaller(caller, "[Collider] Usage: /boxdeny ", Color.yellow); return true; } string text = string.Join(" ", args).Trim(); if (!TryResolvePlayerByName(text, out string canonicalName, out string steamId)) { Utils.NotifyCaller(caller, "[Collider] No player named '" + text + "' found. (To remove an offline player, edit WhitelistedSteamIds in the config file.)", Color.yellow); return true; } bool flag = PlayerCollisionPlugin.ModConfig.RemoveFromWhitelist(steamId); Utils.NotifyCaller(caller, flag ? ("[Collider] Removed '" + canonicalName + "' (steam " + steamId + ") from the whitelist.") : ("[Collider] '" + canonicalName + "' (steam " + steamId + ") was not on the whitelist."), new Color(1f, 0.78f, 0.5f)); return true; } private static bool HandleBoxList(Caller caller, string[] args) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) HashSet whitelistSet = PlayerCollisionPlugin.ModConfig.GetWhitelistSet(); bool value = PlayerCollisionPlugin.ModConfig.WhitelistEnabled.Value; if (whitelistSet.Count == 0) { Utils.NotifyCaller(caller, value ? "[Collider] Whitelist is ON but EMPTY. No remote player boxes are active until you add someone with /boxallow." : "[Collider] Whitelist is empty (and currently OFF - all remote players collide normally on your client). Enable with /boxwhitelist on.", new Color(0.5f, 0.78f, 1f)); return true; } Utils.NotifyCaller(caller, string.Format("[Collider] Whitelist ({0} entr{1}, mode={2}):", whitelistSet.Count, (whitelistSet.Count == 1) ? "y" : "ies", value ? "ON" : "off"), new Color(0.5f, 0.78f, 1f)); foreach (string item in whitelistSet) { string text = ResolveSteamIdToName(item); Utils.NotifyCaller(caller, " " + item + " - " + text, Color.white); } return true; } private static bool HandleBoxWhitelist(Caller caller, string[] args) { //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_00e9: Unknown result type (might be due to invalid IL or missing references) ConfigEntry whitelistEnabled = PlayerCollisionPlugin.ModConfig.WhitelistEnabled; bool value; if (args.Length == 0 || args[0].Equals("toggle", StringComparison.OrdinalIgnoreCase)) { value = !whitelistEnabled.Value; } else if (args[0].Equals("on", StringComparison.OrdinalIgnoreCase) || args[0].Equals("true", StringComparison.OrdinalIgnoreCase) || args[0].Equals("enable", StringComparison.OrdinalIgnoreCase)) { value = true; } else { if (!args[0].Equals("off", StringComparison.OrdinalIgnoreCase) && !args[0].Equals("false", StringComparison.OrdinalIgnoreCase) && !args[0].Equals("disable", StringComparison.OrdinalIgnoreCase)) { if (args[0].Equals("status", StringComparison.OrdinalIgnoreCase) || args[0].Equals("state", StringComparison.OrdinalIgnoreCase) || args[0].Equals("s", StringComparison.OrdinalIgnoreCase)) { SendWhitelistState(caller); return true; } Utils.NotifyCaller(caller, "[Collider] Usage: /boxwhitelist [on|off|toggle|status] Aliases: /boxwl, /cwl, /wl", Color.yellow); return true; } value = false; } whitelistEnabled.Value = value; SendWhitelistState(caller); return true; } private static void SendWhitelistState(Caller caller) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) bool value = PlayerCollisionPlugin.ModConfig.WhitelistEnabled.Value; int count = PlayerCollisionPlugin.ModConfig.GetWhitelistSet().Count; Utils.NotifyCaller(caller, value ? $"[Collider] Whitelist mode ON. Listed remote players get boxes on your client; compatible clients also hide your box unless listed. {count} player(s) listed. /boxallow to add." : $"[Collider] Whitelist mode OFF. All remote players collide normally on your client. {count} player(s) saved in the whitelist.", value ? new Color(0.5f, 1f, 0.5f) : new Color(1f, 0.78f, 0.5f)); } private static bool TryResolvePlayerByName(string name, out string canonicalName, out string steamId) { canonicalName = string.Empty; steamId = "0"; if (string.IsNullOrWhiteSpace(name)) { return false; } string text = name.Trim().ToLowerInvariant(); Player[] array = Object.FindObjectsOfType(); Player val = null; Player val2 = null; Player val3 = null; Player[] array2 = array; foreach (Player val4 in array2) { if ((Object)(object)val4 == (Object)null) { continue; } string text2 = PlayerIdentity.GetDisplayName(val4) ?? string.Empty; string text3 = text2.ToLowerInvariant(); if (text3 == text) { val = val4; canonicalName = text2; break; } if (text3.StartsWith(text) && (Object)(object)val2 == (Object)null) { val2 = val4; if (canonicalName.Length == 0) { canonicalName = text2; } } else if (text3.Contains(text) && (Object)(object)val3 == (Object)null) { val3 = val4; if (canonicalName.Length == 0) { canonicalName = text2; } } } Player val5 = val ?? val2 ?? val3; if ((Object)(object)val5 == (Object)null) { return false; } steamId = PlayerIdentity.GetSteamId(val5) ?? "0"; if (string.IsNullOrEmpty(canonicalName)) { canonicalName = PlayerIdentity.GetDisplayName(val5) ?? name; } return true; } private static string ResolveSteamIdToName(string steamId) { if (string.IsNullOrEmpty(steamId)) { return "(unknown)"; } try { Player[] array = Object.FindObjectsOfType(); Player[] array2 = array; foreach (Player val in array2) { if (!((Object)(object)val == (Object)null) && PlayerIdentity.GetSteamId(val) == steamId) { return PlayerIdentity.GetDisplayName(val) ?? "(unnamed)"; } } } catch { } return "(offline)"; } private static void ResetBoxDefaults() { CollisionConfig modConfig = PlayerCollisionPlugin.ModConfig; modConfig.ResetSessionBoxDimensions(); modConfig.MinDimension.Value = (float)((ConfigEntryBase)modConfig.MinDimension).DefaultValue; modConfig.MaxDimension.Value = (float)((ConfigEntryBase)modConfig.MaxDimension).DefaultValue; modConfig.TinyDisableThreshold.Value = (float)((ConfigEntryBase)modConfig.TinyDisableThreshold).DefaultValue; modConfig.PlatformExtraWidth.Value = (float)((ConfigEntryBase)modConfig.PlatformExtraWidth).DefaultValue; modConfig.PlatformExtraDepth.Value = (float)((ConfigEntryBase)modConfig.PlatformExtraDepth).DefaultValue; modConfig.PlatformThickness.Value = (float)((ConfigEntryBase)modConfig.PlatformThickness).DefaultValue; modConfig.PlatformTopOffset.Value = (float)((ConfigEntryBase)modConfig.PlatformTopOffset).DefaultValue; modConfig.HeadBoneTopOffset.Value = (float)((ConfigEntryBase)modConfig.HeadBoneTopOffset).DefaultValue; modConfig.BodyHeadClearance.Value = (float)((ConfigEntryBase)modConfig.BodyHeadClearance).DefaultValue; modConfig.BodyWidthAdjustment.Value = (float)((ConfigEntryBase)modConfig.BodyWidthAdjustment).DefaultValue; modConfig.BodyDepthAdjustment.Value = (float)((ConfigEntryBase)modConfig.BodyDepthAdjustment).DefaultValue; modConfig.BodyHeightAdjustment.Value = (float)((ConfigEntryBase)modConfig.BodyHeightAdjustment).DefaultValue; modConfig.HeadWidthAdjustment.Value = (float)((ConfigEntryBase)modConfig.HeadWidthAdjustment).DefaultValue; modConfig.HeadDepthAdjustment.Value = (float)((ConfigEntryBase)modConfig.HeadDepthAdjustment).DefaultValue; modConfig.HeadHeightAdjustment.Value = (float)((ConfigEntryBase)modConfig.HeadHeightAdjustment).DefaultValue; modConfig.ChestBoxHeightRatio.Value = (float)((ConfigEntryBase)modConfig.ChestBoxHeightRatio).DefaultValue; modConfig.ChestBoxWidthMultiplier.Value = (float)((ConfigEntryBase)modConfig.ChestBoxWidthMultiplier).DefaultValue; modConfig.ChestBoxDepthMultiplier.Value = (float)((ConfigEntryBase)modConfig.ChestBoxDepthMultiplier).DefaultValue; modConfig.ChestBoxThickness.Value = (float)((ConfigEntryBase)modConfig.ChestBoxThickness).DefaultValue; modConfig.ChestBoxForwardOffset.Value = (float)((ConfigEntryBase)modConfig.ChestBoxForwardOffset).DefaultValue; modConfig.VisualBoundsLerpSpeed.Value = (float)((ConfigEntryBase)modConfig.VisualBoundsLerpSpeed).DefaultValue; modConfig.PoseMeasureIntervalSeconds.Value = (float)((ConfigEntryBase)modConfig.PoseMeasureIntervalSeconds).DefaultValue; modConfig.PushStrength.Value = (float)((ConfigEntryBase)modConfig.PushStrength).DefaultValue; modConfig.MaxPushPerFrame.Value = (float)((ConfigEntryBase)modConfig.MaxPushPerFrame).DefaultValue; modConfig.UseBakedPoseBounds.Value = false; modConfig.UseBodyMeshForSize.Value = true; modConfig.VisualBoundsEnabled.Value = true; modConfig.IncludeAccessoriesInBounds.Value = false; modConfig.StaticBoxesEnabled.Value = true; modConfig.DynamicBoxesEnabled.Value = false; modConfig.UnsafeStickEnabled.Value = true; modConfig.StrictStickEnabled.Value = false; modConfig.ChestBoxEnabled.Value = false; modConfig.NormalizeBoxMode(preferStatic: true); modConfig.NormalizeStickMode(preferUnsafe: true); } private static void SendHelp(Caller caller) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_00f6: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); ((Color)(ref val))..ctor(0.5f, 0.78f, 1f); Utils.NotifyCaller(caller, "[Collider] Available commands:", val); Utils.NotifyCaller(caller, " /collider on Enable local player collision", Color.white); Utils.NotifyCaller(caller, " /collider off Disable local player collision", Color.white); Utils.NotifyCaller(caller, " /collider toggle Flip the enable/disable state", Color.white); Utils.NotifyCaller(caller, " /collider debug Toggle visible green wireframe boxes", Color.white); Utils.NotifyCaller(caller, " /anchor on|off Shortcut for stick-to-carrier mode", Color.white); Utils.NotifyCaller(caller, " /anchor rotate on|off Rotate rider with carrier while stick is active", Color.white); Utils.NotifyCaller(caller, " /stick Toggle anchor mode; alias: /ca", Color.white); Utils.NotifyCaller(caller, " /collider anchor on|off|status Full anchor command", Color.white); Utils.NotifyCaller(caller, " /collider reset Reset box dimensions and platform settings to defaults", Color.white); Utils.NotifyCaller(caller, " /collider status Print local player bounds + diagnostics", Color.white); Utils.NotifyCaller(caller, " /collider status all Print scale and box diagnostics for every tracked player", Color.white); Utils.NotifyCaller(caller, " /remove Remove a detected rider from your head box", Color.white); Utils.NotifyCaller(caller, " /collider panic Emergency disable + reset grace period", Color.white); Utils.NotifyCaller(caller, " /collider help Show this list", Color.white); Utils.NotifyCaller(caller, "Whitelist (when /boxwhitelist on):", val); Utils.NotifyCaller(caller, " /boxallow Add a player to the collider whitelist", Color.white); Utils.NotifyCaller(caller, " /boxdeny Remove a player from the whitelist", Color.white); Utils.NotifyCaller(caller, " /boxlist Show every steam id on the whitelist", Color.white); Utils.NotifyCaller(caller, " /boxwhitelist on|off|status Set or check whitelist-only mode", Color.white); Utils.NotifyCaller(caller, " /boxwl on|off|status Short whitelist command; aliases: /cwl, /wl", Color.white); Utils.NotifyCaller(caller, "Box presets:", val); Utils.NotifyCaller(caller, " /save boxpreset 1 Save box tuning to slot 1 (slots 1-3)", Color.white); Utils.NotifyCaller(caller, " /load boxpreset 1 Load box tuning from slot 1", Color.white); Utils.NotifyCaller(caller, " /boxsave 1, /boxload 1, /boxpresets", Color.white); Utils.NotifyCaller(caller, "Aliases: /col, /collision, /pcollision", val); } private static void SendStatus(Caller caller, bool includeAllPlayers = false) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) CollisionPlayerState localPlayer = PlayerCollisionPlugin.Registry.LocalPlayer; int count = PlayerCollisionPlugin.Registry.Players.Count; string text; if (localPlayer == null) { text = "local player not found yet"; } else if (!localPlayer.HasBounds) { text = $"local={localPlayer.DisplayName}, steam={localPlayer.SteamId}, bounds=NONE, grace={localPlayer.IsInGracePeriod}"; } else { Bounds bounds = localPlayer.Bounds; Vector3 size = ((Bounds)(ref bounds)).size; bounds = localPlayer.Bounds; Vector3 center = ((Bounds)(ref bounds)).center; text = "local=" + localPlayer.DisplayName + ", steam=" + localPlayer.SteamId + ", " + $"size=({size.x:F2},{size.y:F2},{size.z:F2}), " + $"center=({center.x:F2},{center.y:F2},{center.z:F2}), " + $"renderers={localPlayer.CachedRenderers.Length}, grace={localPlayer.IsInGracePeriod}"; } CollisionConfig modConfig = PlayerCollisionPlugin.ModConfig; string text2 = (modConfig.IsDynamicBoxMode() ? "dynamic" : "static"); string text3 = (modConfig.IsStrictStickMode() ? "oldStrict" : "emote"); Utils.NotifyCaller(caller, $"[Collider] modEnabled={modConfig.ModEnabled.Value}, localCollision={PlayerCollisionPlugin.Instance.LocalCollisionEnabled}, effective={PlayerCollisionPlugin.Instance.EffectiveCollisionEnabled}, boxMode={text2}, stickSafety={text3}, chestBox={modConfig.ChestBoxEnabled.Value}, players={count}, {text}", new Color(0.5f, 0.78f, 1f)); if (!includeAllPlayers) { return; } foreach (CollisionPlayerState player in PlayerCollisionPlugin.Registry.Players) { Utils.NotifyCaller(caller, FormatPlayerDiagnostics(player), Color.white); } } private static bool IsAllToken(string token) { return token.Equals("all", StringComparison.OrdinalIgnoreCase) || token.Equals("players", StringComparison.OrdinalIgnoreCase) || token.Equals("server", StringComparison.OrdinalIgnoreCase); } private static string FormatPlayerDiagnostics(CollisionPlayerState state) { //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) if (state == null) { return "[Collider] "; } if (!state.HasBounds) { return "[Collider] " + state.DisplayName + ": steam=" + state.SteamId + ", bounds=NONE, " + $"scale=({state.EffectiveScale.x:F2},{state.EffectiveScale.y:F2}), tiny={state.TinyScale:F3}, " + $"boxMode={state.BoxSizingMode}, measure={state.MeasurementMode}, chest={state.ChestBoxActive}, poseLowered={state.StaticPoseLowered}, remotePose={state.HasRemotePoseState}/{state.RemotePoseLowered}/{state.RemotePoseSitting}/{state.RemotePoseEmoting}, " + $"map={state.IsSameMapAsLocal}, near={state.IsNearLocalPlayer}, debugNear={state.ShouldRenderDebug}, " + $"localWhitelist={state.IsLocalWhitelisted}, remoteWhitelist={state.IsRemoteWhitelisted}/{state.HasRemoteWhitelistPolicy}, " + $"boxObj={state.BodyObjectActive}, solid={state.SolidBodyActive}/{state.ExpectsSolidBody}, platform={state.PlatformActive}/{state.ExpectsPlatform}, reason={state.LastHideReason}, " + $"renderers={state.CachedRenderers.Length}, grace={state.IsInGracePeriod}"; } return "[Collider] " + state.DisplayName + ": steam=" + state.SteamId + ", " + $"scale=({state.EffectiveScale.x:F2},{state.EffectiveScale.y:F2}), " + $"tiny={state.TinyScale:F3}, " + $"boxMode={state.BoxSizingMode}, measure={state.MeasurementMode}, chest={state.ChestBoxActive}, poseLowered={state.StaticPoseLowered}, remotePose={state.HasRemotePoseState}/{state.RemotePoseLowered}/{state.RemotePoseSitting}/{state.RemotePoseEmoting}, " + $"body=({state.BoxWidth:F2},{state.BoxHeight:F2},{state.BoxDepth:F2}), " + $"head=({state.HeadBoxWidth:F2},{state.HeadBoxThickness:F2},{state.HeadBoxDepth:F2}), " + $"bodyTop={state.TopOffsetY:F2}, headTop={state.HeadBoxTopOffsetY:F2}, headTracked={(Object)(object)state.CachedHeadTransform != (Object)null}, whitelisted={state.IsWhitelisted}, " + $"localWhitelist={state.IsLocalWhitelisted}, remoteWhitelist={state.IsRemoteWhitelisted}/{state.HasRemoteWhitelistPolicy}, " + $"map={state.IsSameMapAsLocal}, near={state.IsNearLocalPlayer}, debugNear={state.ShouldRenderDebug}, " + $"boxObj={state.BodyObjectActive}, solid={state.SolidBodyActive}/{state.ExpectsSolidBody}, platform={state.PlatformActive}/{state.ExpectsPlatform}, wire={state.WireVisible}, reason={state.LastHideReason}, " + $"renderers={state.CachedRenderers.Length}, grace={state.IsInGracePeriod}"; } } internal sealed class CollisionConfig { internal const float TinyDisableDefault = 0.05f; internal const string CurrentSettingsVersion = "1.0.0"; private const int BoxPresetValueCount = 32; private const int ChestHeightPresetValueCount = 28; private const int LegacyBoxPresetValueCount = 27; private const float PlatformTopDefault = 0.05f; private const float PreviousPlatformTopDefault = 0.08f; private const float ChestHeightDefault = 0.46f; private const float PreviousChestHeightDefault = 0.42f; private const float ChestWidthDefault = 0.85f; private const float ChestDepthDefault = 0.75f; private const float ChestThicknessDefault = 0.08f; private const float ChestForwardDefault = 0.12f; private const float SliderMin = -10f; private const float TuningSliderMax = 10f; internal ConfigEntry SettingsVersion { get; private set; } = null; internal ConfigEntry ModEnabled { get; private set; } = null; internal ConfigEntry LocalCollisionEnabled { get; private set; } = null; internal ConfigEntry DebugCollidersEnabled { get; private set; } = null; internal ConfigEntry AllowTransformFallback { get; private set; } = null; internal ConfigEntry SolidRemoteBodyEnabled { get; private set; } = null; internal ConfigEntry StandingPlatformEnabled { get; private set; } = null; internal ConfigEntry StaticBoxesEnabled { get; private set; } = null; internal ConfigEntry DynamicBoxesEnabled { get; private set; } = null; internal ConfigEntry ChestBoxEnabled { get; private set; } = null; internal ConfigEntry VisualBoundsEnabled { get; private set; } = null; internal ConfigEntry IncludeAccessoriesInBounds { get; private set; } = null; internal ConfigEntry AnchorRiderToCarrier { get; private set; } = null; internal ConfigEntry AnchorRotateWithCarrier { get; private set; } = null; internal ConfigEntry UnsafeStickEnabled { get; private set; } = null; internal ConfigEntry StrictStickEnabled { get; private set; } = null; internal ConfigEntry AnchorBreakSafetyDistance { get; private set; } = null; internal ConfigEntry TinyDisableThreshold { get; private set; } = null; internal ConfigEntry WhitelistEnabled { get; private set; } = null; internal ConfigEntry WhitelistedSteamIds { get; private set; } = null; internal ConfigEntry BoxPresetData { get; private set; } = null; internal ConfigEntry UseBodyMeshForSize { get; private set; } = null; internal ConfigEntry ScanIntervalSeconds { get; private set; } = null; internal ConfigEntry RendererRecacheSeconds { get; private set; } = null; internal ConfigEntry PoseMeasureIntervalSeconds { get; private set; } = null; internal ConfigEntry SpawnGraceSeconds { get; private set; } = null; internal ConfigEntry VisualBoundsLerpSpeed { get; private set; } = null; internal ConfigEntry LimitRenderedBoxesByDistance { get; private set; } = null; internal ConfigEntry RenderedBoxDistance { get; private set; } = null; internal ConfigEntry ReduceRenderedBoxes { get; private set; } = null; internal ConfigEntry MaxRenderedBoxes { get; private set; } = null; internal ConfigEntry ColliderActivationRange { get; private set; } = null; internal ConfigEntry DebugRenderRange { get; private set; } = null; internal ConfigEntry UseBakedPoseBounds { get; private set; } = null; internal ConfigEntry BaseBoxWidth { get; private set; } = null; internal ConfigEntry BaseBoxDepth { get; private set; } = null; internal ConfigEntry BaseBoxHeight { get; private set; } = null; internal ConfigEntry BoxWidthMultiplier { get; private set; } = null; internal ConfigEntry BoxDepthMultiplier { get; private set; } = null; internal ConfigEntry BoxHeightMultiplier { get; private set; } = null; internal ConfigEntry MinDimension { get; private set; } = null; internal ConfigEntry MaxDimension { get; private set; } = null; internal ConfigEntry WidthPadding { get; private set; } = null; internal ConfigEntry HeightPadding { get; private set; } = null; internal ConfigEntry BodyWidthAdjustment { get; private set; } = null; internal ConfigEntry BodyDepthAdjustment { get; private set; } = null; internal ConfigEntry BodyHeightAdjustment { get; private set; } = null; internal ConfigEntry PlatformExtraWidth { get; private set; } = null; internal ConfigEntry PlatformExtraDepth { get; private set; } = null; internal ConfigEntry PlatformThickness { get; private set; } = null; internal ConfigEntry PlatformTopOffset { get; private set; } = null; internal ConfigEntry HeadBoneTopOffset { get; private set; } = null; internal ConfigEntry BodyHeadClearance { get; private set; } = null; internal ConfigEntry HeadWidthAdjustment { get; private set; } = null; internal ConfigEntry HeadDepthAdjustment { get; private set; } = null; internal ConfigEntry HeadHeightAdjustment { get; private set; } = null; internal ConfigEntry ChestBoxHeightRatio { get; private set; } = null; internal ConfigEntry ChestBoxWidthMultiplier { get; private set; } = null; internal ConfigEntry ChestBoxDepthMultiplier { get; private set; } = null; internal ConfigEntry ChestBoxThickness { get; private set; } = null; internal ConfigEntry ChestBoxForwardOffset { get; private set; } = null; internal ConfigEntry PushStrength { get; private set; } = null; internal ConfigEntry MaxPushPerFrame { get; private set; } = null; internal static CollisionConfig Bind(ConfigFile file) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Expected O, but got Unknown //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Expected O, but got Unknown //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Expected O, but got Unknown //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Expected O, but got Unknown //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Expected O, but got Unknown //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Expected O, but got Unknown //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Expected O, but got Unknown //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Expected O, but got Unknown //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Expected O, but got Unknown //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Expected O, but got Unknown //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Expected O, but got Unknown //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Expected O, but got Unknown //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Expected O, but got Unknown //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Expected O, but got Unknown //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Expected O, but got Unknown //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Expected O, but got Unknown //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Expected O, but got Unknown //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Expected O, but got Unknown //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Expected O, but got Unknown //IL_05f0: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Expected O, but got Unknown //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Expected O, but got Unknown //IL_0652: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Expected O, but got Unknown //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Expected O, but got Unknown //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Expected O, but got Unknown //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_070a: Expected O, but got Unknown //IL_073a: Unknown result type (might be due to invalid IL or missing references) //IL_0744: Expected O, but got Unknown //IL_0774: Unknown result type (might be due to invalid IL or missing references) //IL_077e: Expected O, but got Unknown //IL_07ae: Unknown result type (might be due to invalid IL or missing references) //IL_07b8: Expected O, but got Unknown //IL_07e8: Unknown result type (might be due to invalid IL or missing references) //IL_07f2: Expected O, but got Unknown //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_082c: Expected O, but got Unknown //IL_085c: Unknown result type (might be due to invalid IL or missing references) //IL_0866: Expected O, but got Unknown //IL_0896: Unknown result type (might be due to invalid IL or missing references) //IL_08a0: Expected O, but got Unknown //IL_08d0: Unknown result type (might be due to invalid IL or missing references) //IL_08da: Expected O, but got Unknown //IL_090a: Unknown result type (might be due to invalid IL or missing references) //IL_0914: Expected O, but got Unknown //IL_0944: Unknown result type (might be due to invalid IL or missing references) //IL_094e: Expected O, but got Unknown //IL_097e: Unknown result type (might be due to invalid IL or missing references) //IL_0988: Expected O, but got Unknown //IL_09b8: Unknown result type (might be due to invalid IL or missing references) //IL_09c2: Expected O, but got Unknown //IL_09f2: Unknown result type (might be due to invalid IL or missing references) //IL_09fc: Expected O, but got Unknown //IL_0a2c: Unknown result type (might be due to invalid IL or missing references) //IL_0a36: Expected O, but got Unknown //IL_0a66: Unknown result type (might be due to invalid IL or missing references) //IL_0a70: Expected O, but got Unknown //IL_0aa0: Unknown result type (might be due to invalid IL or missing references) //IL_0aaa: Expected O, but got Unknown //IL_0ada: Unknown result type (might be due to invalid IL or missing references) //IL_0ae4: Expected O, but got Unknown //IL_0b14: Unknown result type (might be due to invalid IL or missing references) //IL_0b1e: Expected O, but got Unknown //IL_0b4e: Unknown result type (might be due to invalid IL or missing references) //IL_0b58: Expected O, but got Unknown //IL_0b88: Unknown result type (might be due to invalid IL or missing references) //IL_0b92: Expected O, but got Unknown //IL_0bc2: Unknown result type (might be due to invalid IL or missing references) //IL_0bcc: Expected O, but got Unknown //IL_0bfc: Unknown result type (might be due to invalid IL or missing references) //IL_0c06: Expected O, but got Unknown //IL_0c36: Unknown result type (might be due to invalid IL or missing references) //IL_0c40: Expected O, but got Unknown //IL_0c70: Unknown result type (might be due to invalid IL or missing references) //IL_0c7a: Expected O, but got Unknown //IL_0caa: Unknown result type (might be due to invalid IL or missing references) //IL_0cb4: Expected O, but got Unknown CollisionConfig collisionConfig = new CollisionConfig { SettingsVersion = file.Bind("General", "SettingsVersion", "0", new ConfigDescription("Internal migration marker. Do not edit manually.", (AcceptableValueBase)null, Array.Empty())), ModEnabled = file.Bind("General", "ModEnabled", true, new ConfigDescription("Master enable for player soft collision.", (AcceptableValueBase)null, Array.Empty())), LocalCollisionEnabled = file.Bind("General", "LocalCollisionEnabled", true, new ConfigDescription("Whether the local player participates in collision. Persists between sessions.", (AcceptableValueBase)null, Array.Empty())), DebugCollidersEnabled = file.Bind("Debug", "DebugCollidersEnabled", false, new ConfigDescription("Show the green wireframe box around each player in-game (body + standing platform).", (AcceptableValueBase)null, Array.Empty())), AllowTransformFallback = file.Bind("Movement", "AllowTransformFallback", false, new ConfigDescription("Fallback to transform.position if CharacterController.Move is unavailable. Safer default is false.", (AcceptableValueBase)null, Array.Empty())), SolidRemoteBodyEnabled = file.Bind("Body", "SolidRemoteBodyEnabled", true, new ConfigDescription("Enable the green body BoxCollider on remote players so the local CharacterController physically bumps into them. Turn this off to keep only the head platform active.", (AcceptableValueBase)null, Array.Empty())), StandingPlatformEnabled = file.Bind("Body", "StandingPlatformEnabled", true, new ConfigDescription("Enable a thin top BoxCollider so the local player can stand on remote players' heads. This can stay on even when the green body box is disabled.", (AcceptableValueBase)null, Array.Empty())), StaticBoxesEnabled = file.Bind("Body", "StaticBoxesEnabled", true, new ConfigDescription("Use stable scale-aware boxes. This skips per-pose renderer measuring and is the default performance-friendly mode.", (AcceptableValueBase)null, Array.Empty())), DynamicBoxesEnabled = file.Bind("Body", "DynamicBoxesEnabled", false, new ConfigDescription("Use adaptive renderer/body-mesh measuring so boxes follow race, scale, and pose changes more closely. More expensive than static boxes.", (AcceptableValueBase)null, Array.Empty())), ChestBoxEnabled = file.Bind("Body", "ChestBoxEnabled", false, new ConfigDescription("Replace the normal green body/head platform with one platform at chest height. This is a manual mode and still supports standing, stick, and /remove.", (AcceptableValueBase)null, Array.Empty())), VisualBoundsEnabled = file.Bind("Body", "VisualBoundsEnabled", true, new ConfigDescription("Refine the body's height/center/footprint from current renderer bounds so emotes (prone, sit, etc.) reshape the box.", (AcceptableValueBase)null, Array.Empty())), IncludeAccessoriesInBounds = file.Bind("Body", "IncludeAccessoriesInBounds", false, new ConfigDescription("If true, hair/ears/horns/tails/leaves/wings are included when measuring visual bounds. Off by default - they inflate the box.", (AcceptableValueBase)null, Array.Empty())), AnchorRiderToCarrier = file.Bind("Anchor", "AnchorRiderToCarrier", false, new ConfigDescription("When the local player is standing on another player's head, keep them attached to that carrier. Stick mode holds horizontal position and allows limited vertical slack for sit/emote movement; the main ways out are toggling this off (e.g. /collider anchor) or moving farther than AnchorBreakSafetyDistance. Off by default.", (AcceptableValueBase)null, Array.Empty())), AnchorRotateWithCarrier = file.Bind("Anchor", "AnchorRotateWithCarrier", true, new ConfigDescription("When stick mode is active, rotate the rider by the carrier's rotation delta while still allowing the rider to turn. Turn off if you want completely free facing while stuck.", (AcceptableValueBase)null, Array.Empty())), UnsafeStickEnabled = file.Bind("Anchor", "UnsafeStickEnabled", true, new ConfigDescription("Emote stick safety for sit/emote use. Keeps horizontal following, avoids strict upward reseat correction while posed, and gives more room before unsticking than normal movement.", (AcceptableValueBase)null, Array.Empty())), StrictStickEnabled = file.Bind("Anchor", "StrictStickEnabled", false, new ConfigDescription("Stricter stick safety. Uses the stronger recovery/reseat behavior for players who prefer stable riding over sit/emote freedom.", (AcceptableValueBase)null, Array.Empty())), AnchorBreakSafetyDistance = file.Bind("Anchor", "AnchorBreakSafetyDistance", 25f, new ConfigDescription("Safety-break distance in metres. If the rider somehow ends up farther than this from the desired anchor point (teleport, scene transition, runaway physics), the anchor releases instead of dragging them across the map. Set high - this is NOT a jump threshold.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 50f), Array.Empty())), TinyDisableThreshold = file.Bind("Body", "TinyDisableThreshold", 0.05f, new ConfigDescription("Players whose effective body scale is at or below this value get NO colliders or wireframes. Matches the casino-style tiny-player exemption. Set to 0 to disable.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), UseBodyMeshForSize = file.Bind("Body", "UseBodyMeshForSize", true, new ConfigDescription("If true (default), the box hugs the rendered body mesh of each player - automatically adapts to race size differences, /size commands, and emote poses. If false, falls back to BaseBoxWidth/Depth/Height × EstimateBodyScale × multiplier.", (AcceptableValueBase)null, Array.Empty())), WhitelistEnabled = file.Bind("Whitelist", "WhitelistEnabled", false, new ConfigDescription("If true, only remote players whose steam IDs appear in WhitelistedSteamIds get solid colliders on your client. You do not need to add your own Steam ID. Use /boxallow to add a player and /boxdeny to remove them.", (AcceptableValueBase)null, Array.Empty())), WhitelistedSteamIds = file.Bind("Whitelist", "WhitelistedSteamIds", string.Empty, new ConfigDescription("Comma-separated steam64 IDs of remote players permitted to have collision boxes on your client when WhitelistEnabled is on. Managed via /boxallow / /boxdeny chat commands - manual editing also works.", (AcceptableValueBase)null, Array.Empty())), BoxPresetData = file.Bind("Presets", "BoxPresetData", string.Empty, new ConfigDescription("Saved collider size preset slots 1-3. Managed by /save boxpreset <1-3> and /load boxpreset <1-3>. Manual editing is not recommended.", (AcceptableValueBase)null, Array.Empty())), ScanIntervalSeconds = file.Bind("Runtime", "ScanIntervalSeconds", 2f, new ConfigDescription("Safety-net poll interval for Player object discovery (seconds).", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), RendererRecacheSeconds = file.Bind("Runtime", "RendererRecacheSeconds", 2f, new ConfigDescription("How often to re-collect each player's active body renderer list (seconds).", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), PoseMeasureIntervalSeconds = file.Bind("Runtime", "PoseMeasureIntervalSeconds", 0.2f, new ConfigDescription("How often to re-measure player pose/race mesh bounds (seconds). Lower follows emotes faster; higher is cheaper. Colliders still lerp every frame.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), SpawnGraceSeconds = file.Bind("Runtime", "SpawnGraceSeconds", 30f, new ConfigDescription("Seconds to keep collision boxes inactive after first discovery, scene load, or toggle.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 60f), Array.Empty())), VisualBoundsLerpSpeed = file.Bind("Runtime", "VisualBoundsLerpSpeed", 12f, new ConfigDescription("How quickly the body resizes toward new measurements (higher = snappier).", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 60f), Array.Empty())), LimitRenderedBoxesByDistance = file.Bind("Runtime", "LimitRenderedBoxesByDistance", false, new ConfigDescription("If true, only remote players within RenderedBoxDistance have active collision boxes and debug wires.", (AcceptableValueBase)null, Array.Empty())), RenderedBoxDistance = file.Bind("Runtime", "RenderedBoxDistance", 25f, new ConfigDescription("Distance in metres for limiting active collision boxes and debug wires.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 80f), Array.Empty())), ReduceRenderedBoxes = file.Bind("Runtime", "ReduceRenderedBoxes", false, new ConfigDescription("If true, only the nearest MaxRenderedBoxes eligible remote players keep active boxes.", (AcceptableValueBase)null, Array.Empty())), MaxRenderedBoxes = file.Bind("Runtime", "MaxRenderedBoxes", 10f, new ConfigDescription("Maximum number of active remote player boxes when ReduceRenderedBoxes is on.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 20f), Array.Empty())), ColliderActivationRange = file.Bind("Runtime", "ColliderActivationRange", 0f, new ConfigDescription("Legacy compatibility value. Use LimitRenderedBoxesByDistance and RenderedBoxDistance for the user-facing render distance control.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 80f), Array.Empty())), DebugRenderRange = file.Bind("Runtime", "DebugRenderRange", 0f, new ConfigDescription("Only draw debug wireframes for players within this distance. Set 0 to draw every active debug wire.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 80f), Array.Empty())), UseBakedPoseBounds = file.Bind("Runtime", "UseBakedPoseBounds", false, new ConfigDescription("Expensive accurate mode: bake skinned meshes when measuring pose bounds. OFF by default because it can cause severe lag with several players.", (AcceptableValueBase)null, Array.Empty())), BaseBoxWidth = file.Bind("Body", "BaseBoxWidth", 1f, new ConfigDescription("Base box width in metres (before scale and multiplier).", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), BaseBoxDepth = file.Bind("Body", "BaseBoxDepth", 0.5f, new ConfigDescription("Base box depth in metres (before scale and multiplier).", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), BaseBoxHeight = file.Bind("Body", "BaseBoxHeight", 1.85f, new ConfigDescription("Base box height in metres (before scale and multiplier).", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), BoxWidthMultiplier = file.Bind("Body", "BoxWidthMultiplier", 1f, new ConfigDescription("Tuning multiplier for box width. 1.0 = use BaseBoxWidth directly. Increase if the box feels too narrow, decrease if too wide.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), BoxDepthMultiplier = file.Bind("Body", "BoxDepthMultiplier", 1f, new ConfigDescription("Tuning multiplier for box depth. 1.0 = use BaseBoxDepth directly.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), BoxHeightMultiplier = file.Bind("Body", "BoxHeightMultiplier", 1f, new ConfigDescription("Tuning multiplier for box height. 1.0 = use BaseBoxHeight directly.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), MinDimension = file.Bind("Body", "MinDimension", 0.1f, new ConfigDescription("Floor for any box dimension (metres).", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), MaxDimension = file.Bind("Body", "MaxDimension", 0f, new ConfigDescription("Optional ceiling for any box dimension in metres. 0 = uncapped, which is the intended default for giant players.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 500f), Array.Empty())), WidthPadding = file.Bind("Body", "WidthPadding", 0f, new ConfigDescription("Extra horizontal inflation per side (metres).", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), HeightPadding = file.Bind("Body", "HeightPadding", 0f, new ConfigDescription("Extra vertical inflation per side (metres).", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), BodyWidthAdjustment = file.Bind("Body", "BodyWidthAdjustment", 0f, new ConfigDescription("Centered body width adjustment. Scales with player size, so giant players respond to the same slider range. Negative tightens, positive widens.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), BodyDepthAdjustment = file.Bind("Body", "BodyDepthAdjustment", 0f, new ConfigDescription("Centered body depth adjustment. Scales with player size, so giant players respond to the same slider range. Negative tightens, positive deepens.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), BodyHeightAdjustment = file.Bind("Body", "BodyHeightAdjustment", 0f, new ConfigDescription("Centered body height adjustment. Scales with player size. Negative shortens, positive raises the body box.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), PlatformExtraWidth = file.Bind("Body", "PlatformExtraWidth", 0f, new ConfigDescription("Extra width added to the top standing platform (metres) so jumping onto a head from the side has room to land.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), PlatformExtraDepth = file.Bind("Body", "PlatformExtraDepth", 0f, new ConfigDescription("Extra depth added to the top standing platform (metres).", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), PlatformThickness = file.Bind("Body", "PlatformThickness", 0.1f, new ConfigDescription("Thickness of the top standing platform (metres).", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), PlatformTopOffset = file.Bind("Body", "PlatformTopOffset", 0.05f, new ConfigDescription("Small clearance above the visual head for the platform top face. The platform extends downward from that top face, so modest values let the bottom clip into the head.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), HeadBoneTopOffset = file.Bind("Body", "HeadBoneTopOffset", 0.44f, new ConfigDescription("Vertical offset above the detected head bone used as a head-top estimate. The platform uses whichever is higher: this estimate or the visual mesh top.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), BodyHeadClearance = file.Bind("Body", "BodyHeadClearance", 0.28f, new ConfigDescription("Gap between the green push body and the yellow head platform. Higher values stop the body box from pushing riders off the head box.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), HeadWidthAdjustment = file.Bind("Body", "HeadWidthAdjustment", 0f, new ConfigDescription("Centered head platform width adjustment. Scales with player size. Negative tightens, positive widens.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), HeadDepthAdjustment = file.Bind("Body", "HeadDepthAdjustment", 0f, new ConfigDescription("Centered head platform depth adjustment. Scales with player size. Negative tightens, positive deepens.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), HeadHeightAdjustment = file.Bind("Body", "HeadHeightAdjustment", 0f, new ConfigDescription("Centered vertical head platform adjustment. Scales with player size. Negative lowers, positive raises.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), ChestBoxHeightRatio = file.Bind("Body", "ChestBoxHeightRatio", 0.46f, new ConfigDescription("Chest platform lower-middle target. With chest/boob bounds this is the fraction up from the bottom of the chest bounds; fallback uses the same fraction of body height.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), ChestBoxWidthMultiplier = file.Bind("Body", "ChestBoxWidthMultiplier", 0.85f, new ConfigDescription("Chest platform width multiplier. Applies to detected chest/boob bounds when available, otherwise to the scale-aware fallback size.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), ChestBoxDepthMultiplier = file.Bind("Body", "ChestBoxDepthMultiplier", 0.75f, new ConfigDescription("Chest platform depth multiplier. Applies to detected chest/boob bounds when available, otherwise to the scale-aware fallback size.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), ChestBoxThickness = file.Bind("Body", "ChestBoxThickness", 0.08f, new ConfigDescription("Chest platform thickness in metres before player scale.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), ChestBoxForwardOffset = file.Bind("Body", "ChestBoxForwardOffset", 0.12f, new ConfigDescription("Local forward offset for the chest platform. Positive moves it in front of the player; negative moves it back.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())), PushStrength = file.Bind("Movement", "PushStrength", 3f, new ConfigDescription("Soft push strength applied to the local player only.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 50f), Array.Empty())), MaxPushPerFrame = file.Bind("Movement", "MaxPushPerFrame", 0.03f, new ConfigDescription("Maximum horizontal push (metres) the local player can receive in one frame.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 10f), Array.Empty())) }; bool flag = !string.Equals(collisionConfig.SettingsVersion.Value, "1.0.0", StringComparison.Ordinal); if (collisionConfig.TinyDisableThreshold.Value > 0f && collisionConfig.TinyDisableThreshold.Value < 0.05f) { collisionConfig.TinyDisableThreshold.Value = 0.05f; } if ((collisionConfig.MaxDimension.Value > 7.999f && collisionConfig.MaxDimension.Value < 8.001f) || (collisionConfig.MaxDimension.Value > 19.999f && collisionConfig.MaxDimension.Value < 20.001f)) { collisionConfig.MaxDimension.Value = 0f; } collisionConfig.RenderedBoxDistance.Value = ClampFloat(collisionConfig.RenderedBoxDistance.Value, 1f, 80f, 25f); collisionConfig.MaxRenderedBoxes.Value = ClampFloat(collisionConfig.MaxRenderedBoxes.Value, 1f, 20f, 10f); collisionConfig.MigrateHeadPlatformDefaults(); collisionConfig.MigrateChestDefaults(); collisionConfig.PlatformTopOffset.Value = ClampFloat(collisionConfig.PlatformTopOffset.Value, -10f, 10f, 0.05f); collisionConfig.ChestBoxHeightRatio.Value = ClampFloat(collisionConfig.ChestBoxHeightRatio.Value, -10f, 10f, 0.46f); collisionConfig.ChestBoxWidthMultiplier.Value = ClampFloat(collisionConfig.ChestBoxWidthMultiplier.Value, -10f, 10f, 0.85f); collisionConfig.ChestBoxDepthMultiplier.Value = ClampFloat(collisionConfig.ChestBoxDepthMultiplier.Value, -10f, 10f, 0.75f); collisionConfig.ChestBoxThickness.Value = ClampFloat(collisionConfig.ChestBoxThickness.Value, -10f, 10f, 0.08f); collisionConfig.ChestBoxForwardOffset.Value = ClampFloat(collisionConfig.ChestBoxForwardOffset.Value, -10f, 10f, 0.12f); collisionConfig.NormalizeBoxMode(preferStatic: true); collisionConfig.NormalizeStickMode(preferUnsafe: true); if (flag) { if (collisionConfig.ColliderActivationRange.Value > 13.99f && collisionConfig.ColliderActivationRange.Value < 14.01f) { collisionConfig.ColliderActivationRange.Value = 0f; } if (collisionConfig.DebugRenderRange.Value > 9.99f && collisionConfig.DebugRenderRange.Value < 10.01f) { collisionConfig.DebugRenderRange.Value = 0f; } if (collisionConfig.SpawnGraceSeconds.Value > 0.001f && collisionConfig.SpawnGraceSeconds.Value <= 5.001f) { collisionConfig.SpawnGraceSeconds.Value = 30f; } collisionConfig.SettingsVersion.Value = "1.0.0"; } return collisionConfig; } internal float GetRenderedBoxDistance() { return ClampFloat(RenderedBoxDistance.Value, 1f, 80f, 25f); } internal int GetMaxRenderedBoxCount() { float num = ClampFloat(MaxRenderedBoxes.Value, 1f, 20f, 10f); return Math.Max(1, Math.Min(20, (int)Math.Round(num))); } internal bool IsStaticBoxMode() { return StaticBoxesEnabled.Value || !DynamicBoxesEnabled.Value; } internal bool IsDynamicBoxMode() { return DynamicBoxesEnabled.Value && !StaticBoxesEnabled.Value; } internal bool IsUnsafeStickMode() { return UnsafeStickEnabled.Value || !StrictStickEnabled.Value; } internal bool IsStrictStickMode() { return StrictStickEnabled.Value && !UnsafeStickEnabled.Value; } internal void NormalizeBoxMode(bool preferStatic) { if ((!StaticBoxesEnabled.Value || DynamicBoxesEnabled.Value) && (!DynamicBoxesEnabled.Value || StaticBoxesEnabled.Value)) { StaticBoxesEnabled.Value = preferStatic; DynamicBoxesEnabled.Value = !preferStatic; } } internal void NormalizeStickMode(bool preferUnsafe) { if ((!UnsafeStickEnabled.Value || StrictStickEnabled.Value) && (!StrictStickEnabled.Value || UnsafeStickEnabled.Value)) { UnsafeStickEnabled.Value = preferUnsafe; StrictStickEnabled.Value = !preferUnsafe; } } private static float ClampFloat(float value, float min, float max, float fallback) { if (float.IsNaN(value) || float.IsInfinity(value)) { return fallback; } if (value < min) { return min; } if (value > max) { return max; } return value; } private void MigrateHeadPlatformDefaults() { if (IsNear(PlatformTopOffset.Value, 0.08f, 0.015f)) { PlatformTopOffset.Value = 0.05f; } } private void MigrateChestDefaults() { if (IsNear(ChestBoxHeightRatio.Value, 0.68f, 0.025f)) { ChestBoxHeightRatio.Value = 0.46f; } if (IsNear(ChestBoxHeightRatio.Value, 0.42f, 0.015f)) { ChestBoxHeightRatio.Value = 0.46f; } if (IsNear(ChestBoxWidthMultiplier.Value, 1.25f, 0.025f)) { ChestBoxWidthMultiplier.Value = 0.85f; } if (IsNear(ChestBoxDepthMultiplier.Value, 1.1f, 0.025f)) { ChestBoxDepthMultiplier.Value = 0.75f; } if (IsNear(ChestBoxThickness.Value, 0.1f, 0.01f)) { ChestBoxThickness.Value = 0.08f; } if (IsNear(ChestBoxForwardOffset.Value, 0.18f, 0.015f)) { ChestBoxForwardOffset.Value = 0.12f; } } private static bool IsNear(float value, float target, float tolerance) { if (float.IsNaN(value) || float.IsInfinity(value)) { return true; } return Math.Abs(value - target) <= tolerance; } internal void ResetSessionBoxDimensions() { BaseBoxWidth.Value = (float)((ConfigEntryBase)BaseBoxWidth).DefaultValue; BaseBoxDepth.Value = (float)((ConfigEntryBase)BaseBoxDepth).DefaultValue; BaseBoxHeight.Value = (float)((ConfigEntryBase)BaseBoxHeight).DefaultValue; BoxWidthMultiplier.Value = (float)((ConfigEntryBase)BoxWidthMultiplier).DefaultValue; BoxDepthMultiplier.Value = (float)((ConfigEntryBase)BoxDepthMultiplier).DefaultValue; BoxHeightMultiplier.Value = (float)((ConfigEntryBase)BoxHeightMultiplier).DefaultValue; WidthPadding.Value = (float)((ConfigEntryBase)WidthPadding).DefaultValue; HeightPadding.Value = (float)((ConfigEntryBase)HeightPadding).DefaultValue; BodyWidthAdjustment.Value = (float)((ConfigEntryBase)BodyWidthAdjustment).DefaultValue; BodyDepthAdjustment.Value = (float)((ConfigEntryBase)BodyDepthAdjustment).DefaultValue; BodyHeightAdjustment.Value = (float)((ConfigEntryBase)BodyHeightAdjustment).DefaultValue; HeadWidthAdjustment.Value = (float)((ConfigEntryBase)HeadWidthAdjustment).DefaultValue; HeadDepthAdjustment.Value = (float)((ConfigEntryBase)HeadDepthAdjustment).DefaultValue; HeadHeightAdjustment.Value = (float)((ConfigEntryBase)HeadHeightAdjustment).DefaultValue; ChestBoxHeightRatio.Value = (float)((ConfigEntryBase)ChestBoxHeightRatio).DefaultValue; ChestBoxWidthMultiplier.Value = (float)((ConfigEntryBase)ChestBoxWidthMultiplier).DefaultValue; ChestBoxDepthMultiplier.Value = (float)((ConfigEntryBase)ChestBoxDepthMultiplier).DefaultValue; ChestBoxThickness.Value = (float)((ConfigEntryBase)ChestBoxThickness).DefaultValue; ChestBoxForwardOffset.Value = (float)((ConfigEntryBase)ChestBoxForwardOffset).DefaultValue; } internal bool SaveCurrentBoxPreset(string requestedName, out string presetName, out string error) { if (!TryNormalizePresetSlot(requestedName, out presetName, out error)) { return false; } Dictionary dictionary = ParsePresetMap(); dictionary[presetName] = string.Join(",", from v in CapturePresetValues() select v.ToString("R", CultureInfo.InvariantCulture)); BoxPresetData.Value = SerializePresetMap(dictionary); return true; } internal bool TryLoadBoxPreset(string requestedName, out string presetName, out string error) { if (!TryNormalizePresetSlot(requestedName, out presetName, out error)) { return false; } Dictionary dictionary = ParsePresetMap(); if (!dictionary.TryGetValue(presetName, out var value)) { error = "Preset '" + presetName + "' was not found."; return false; } string[] array = value.Split(','); if (array.Length != 32 && array.Length != 28 && array.Length != 27) { error = "Preset '" + presetName + "' is from an incompatible build."; return false; } float[] array2 = new float[array.Length]; for (int i = 0; i < array.Length; i++) { if (!float.TryParse(array[i], NumberStyles.Float, CultureInfo.InvariantCulture, out array2[i])) { error = "Preset '" + presetName + "' has invalid value data."; return false; } } ApplyPresetValues(array2); return true; } internal bool DeleteBoxPreset(string requestedName, out string presetName) { if (!TryNormalizePresetSlot(requestedName, out presetName, out string _)) { return false; } if (string.IsNullOrEmpty(presetName)) { return false; } Dictionary dictionary = ParsePresetMap(); if (!dictionary.Remove(presetName)) { return false; } BoxPresetData.Value = SerializePresetMap(dictionary); return true; } internal string[] GetBoxPresetNames() { return ParsePresetMap().Keys.OrderBy((string k) => k).ToArray(); } private float[] CapturePresetValues() { return new float[32] { BaseBoxWidth.Value, BaseBoxDepth.Value, BaseBoxHeight.Value, BoxWidthMultiplier.Value, BoxDepthMultiplier.Value, BoxHeightMultiplier.Value, MinDimension.Value, MaxDimension.Value, WidthPadding.Value, HeightPadding.Value, BodyWidthAdjustment.Value, BodyDepthAdjustment.Value, BodyHeightAdjustment.Value, PlatformExtraWidth.Value, PlatformExtraDepth.Value, PlatformThickness.Value, PlatformTopOffset.Value, HeadBoneTopOffset.Value, BodyHeadClearance.Value, HeadWidthAdjustment.Value, HeadDepthAdjustment.Value, HeadHeightAdjustment.Value, ChestBoxHeightRatio.Value, ChestBoxWidthMultiplier.Value, ChestBoxDepthMultiplier.Value, ChestBoxThickness.Value, ChestBoxForwardOffset.Value, VisualBoundsLerpSpeed.Value, PoseMeasureIntervalSeconds.Value, UseBodyMeshForSize.Value ? 1f : 0f, VisualBoundsEnabled.Value ? 1f : 0f, IncludeAccessoriesInBounds.Value ? 1f : 0f }; } private void ApplyPresetValues(float[] values) { int num = 0; bool flag = values.Length >= 28; bool flag2 = values.Length >= 32; BaseBoxWidth.Value = values[num++]; BaseBoxDepth.Value = values[num++]; BaseBoxHeight.Value = values[num++]; BoxWidthMultiplier.Value = values[num++]; BoxDepthMultiplier.Value = values[num++]; BoxHeightMultiplier.Value = values[num++]; MinDimension.Value = values[num++]; MaxDimension.Value = values[num++]; WidthPadding.Value = values[num++]; HeightPadding.Value = values[num++]; BodyWidthAdjustment.Value = values[num++]; BodyDepthAdjustment.Value = values[num++]; BodyHeightAdjustment.Value = values[num++]; PlatformExtraWidth.Value = values[num++]; PlatformExtraDepth.Value = values[num++]; PlatformThickness.Value = values[num++]; PlatformTopOffset.Value = values[num++]; HeadBoneTopOffset.Value = values[num++]; BodyHeadClearance.Value = values[num++]; HeadWidthAdjustment.Value = values[num++]; HeadDepthAdjustment.Value = values[num++]; HeadHeightAdjustment.Value = values[num++]; ChestBoxHeightRatio.Value = (flag ? values[num++] : ((float)((ConfigEntryBase)ChestBoxHeightRatio).DefaultValue)); ChestBoxWidthMultiplier.Value = (flag2 ? values[num++] : ((float)((ConfigEntryBase)ChestBoxWidthMultiplier).DefaultValue)); ChestBoxDepthMultiplier.Value = (flag2 ? values[num++] : ((float)((ConfigEntryBase)ChestBoxDepthMultiplier).DefaultValue)); ChestBoxThickness.Value = (flag2 ? values[num++] : ((float)((ConfigEntryBase)ChestBoxThickness).DefaultValue)); ChestBoxForwardOffset.Value = (flag2 ? values[num++] : ((float)((ConfigEntryBase)ChestBoxForwardOffset).DefaultValue)); VisualBoundsLerpSpeed.Value = values[num++]; PoseMeasureIntervalSeconds.Value = values[num++]; UseBodyMeshForSize.Value = values[num++] >= 0.5f; VisualBoundsEnabled.Value = values[num++] >= 0.5f; IncludeAccessoriesInBounds.Value = values[num] >= 0.5f; } private Dictionary ParsePresetMap() { Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); string text = BoxPresetData.Value ?? string.Empty; if (string.IsNullOrWhiteSpace(text)) { return dictionary; } string[] array = text.Split('|'); foreach (string text2 in array) { int num = text2.IndexOf('='); if (num > 0 && num < text2.Length - 1 && TryNormalizePresetSlot(text2.Substring(0, num), out string slot, out string _)) { string value = text2.Substring(num + 1).Trim(); if (!string.IsNullOrEmpty(slot) && !string.IsNullOrEmpty(value)) { dictionary[slot] = value; } } } return dictionary; } private static string SerializePresetMap(Dictionary presets) { return string.Join("|", from kvp in presets where !string.IsNullOrWhiteSpace(kvp.Key) && !string.IsNullOrWhiteSpace(kvp.Value) orderby kvp.Key select kvp.Key + "=" + kvp.Value); } private static bool TryNormalizePresetSlot(string value, out string slot, out string error) { slot = string.Empty; error = string.Empty; if (string.IsNullOrWhiteSpace(value)) { error = "Use preset slot 1, 2, or 3."; return false; } string[] array = value.Trim().ToLowerInvariant().Split(new char[2] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); string s = ((array.Length >= 2 && array[0] == "boxpreset") ? array[1] : array[0]); if (int.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) && result >= 1 && result <= 3) { slot = result.ToString(CultureInfo.InvariantCulture); return true; } error = "Box presets only support slots 1, 2, or 3. Example: /save boxpreset 1"; return false; } internal HashSet GetWhitelistSet() { HashSet hashSet = new HashSet(); string text = WhitelistedSteamIds.Value ?? string.Empty; if (string.IsNullOrWhiteSpace(text)) { return hashSet; } string[] array = text.Split(','); foreach (string text2 in array) { string text3 = text2.Trim(); if (!string.IsNullOrEmpty(text3) && text3 != "0") { hashSet.Add(text3); } } return hashSet; } internal bool IsAllowedBySteamId(string steamId) { if (!WhitelistEnabled.Value) { return true; } if (string.IsNullOrEmpty(steamId) || steamId == "0") { return false; } return GetWhitelistSet().Contains(steamId); } internal bool AddToWhitelist(string steamId) { if (string.IsNullOrWhiteSpace(steamId) || steamId == "0") { return false; } HashSet whitelistSet = GetWhitelistSet(); if (!whitelistSet.Add(steamId)) { return false; } WhitelistedSteamIds.Value = string.Join(",", whitelistSet.OrderBy((string s) => s)); return true; } internal bool RemoveFromWhitelist(string steamId) { if (string.IsNullOrWhiteSpace(steamId)) { return false; } HashSet whitelistSet = GetWhitelistSet(); if (!whitelistSet.Remove(steamId)) { return false; } WhitelistedSteamIds.Value = string.Join(",", whitelistSet.OrderBy((string s) => s)); return true; } } internal sealed class CollisionRuntime : MonoBehaviour { private CollisionPlayerRegistry? _registry; private LocalCollisionResolver? _resolver; internal void Initialize(CollisionPlayerRegistry registry, LocalCollisionResolver resolver) { _registry = registry; _resolver = resolver; } private void LateUpdate() { try { _registry?.Tick(); CollisionNetworkBridge.Tick(); _resolver?.Tick(); } catch (Exception ex) { PlayerCollisionPlugin.Log.LogError((object)("[CollisionRuntime] LateUpdate failed: " + ex.Message)); } } } [BepInPlugin("dev.seth.atlyssplayercollision", "ATLYSS Player Collision", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class PlayerCollisionPlugin : BaseUnityPlugin { public const string PluginGuid = "dev.seth.atlyssplayercollision"; public const string PluginName = "ATLYSS Player Collision"; public const string PluginVersion = "1.0.0"; internal const string EasySettingsGuid = "EasySettings"; internal const string CommandLibGuid = "Soggy_Pancake.CommandLib"; internal const string CodeTalkerGuid = "CodeTalker"; private Harmony? _harmony; private CollisionRuntime? _runtime; private bool _suppressLiveConfigEvents; private bool _normalizingModes; internal static PlayerCollisionPlugin Instance { get; private set; } internal static ManualLogSource Log { get; private set; } internal static CollisionConfig ModConfig { get; private set; } internal static CollisionPlayerRegistry Registry { get; private set; } internal bool LocalCollisionEnabled { get { return ModConfig.LocalCollisionEnabled.Value; } private set { ModConfig.LocalCollisionEnabled.Value = value; } } internal bool EffectiveCollisionEnabled => ModConfig.ModEnabled.Value && LocalCollisionEnabled; private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; ModConfig = CollisionConfig.Bind(((BaseUnityPlugin)this).Config); Registry = new CollisionPlayerRegistry(ModConfig); CollisionNetworkBridge.Initialize(); GameObject val = new GameObject("AtlyssPlayerCollision_Runtime"); Object.DontDestroyOnLoad((Object)(object)val); _runtime = val.AddComponent(); _runtime.Initialize(Registry, new LocalCollisionResolver(Registry, ModConfig)); SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.activeSceneChanged += OnActiveSceneChanged; _harmony = new Harmony("dev.seth.atlyssplayercollision"); try { _harmony.PatchAll(typeof(PlayerLifecyclePatches)); } catch (Exception ex) { Log.LogError((object)("[Init] PlayerLifecyclePatches failed: " + ex.Message + ". Player discovery will rely on the 0.5s safety-net poll.")); } bool flag = Chainloader.PluginInfos.ContainsKey("Soggy_Pancake.CommandLib"); try { if (flag) { Log.LogInfo((object)"CommandLib detected - registering /collider via CommandLib."); CommandLibBinding.Register(); } else { Log.LogInfo((object)"CommandLib not detected - falling back to handcrafted /collider chat patch."); _harmony.PatchAll(typeof(CollisionCommands)); } } catch (Exception ex2) { Log.LogError((object)("[Init] Command registration failed: " + ex2.Message + ". Chat commands will be unavailable this session.")); } bool flag2 = Chainloader.PluginInfos.ContainsKey("EasySettings"); try { if (flag2) { Log.LogInfo((object)"EasySettings detected - building Player Collider settings tab."); EasySettingsBinding.Bind(ModConfig, ((BaseUnityPlugin)this).Config); } else { Log.LogInfo((object)"EasySettings not detected - skip building in-game settings tab."); } } catch (Exception ex3) { Log.LogError((object)("[Init] EasySettings binding failed: " + ex3.Message + ". Edit the BepInEx config file directly to change settings.")); } ModConfig.ModEnabled.SettingChanged += delegate { OnModEnabledChanged(); }; ModConfig.LocalCollisionEnabled.SettingChanged += delegate { OnLocalToggleChanged(); }; ModConfig.AnchorRiderToCarrier.SettingChanged += delegate { SaveConfigNow(); }; ModConfig.AnchorRotateWithCarrier.SettingChanged += delegate { SaveConfigNow(); }; ModConfig.UnsafeStickEnabled.SettingChanged += delegate { OnStickModeChanged(ModConfig.UnsafeStickEnabled); }; ModConfig.StrictStickEnabled.SettingChanged += delegate { OnStickModeChanged(ModConfig.StrictStickEnabled); }; ModConfig.StaticBoxesEnabled.SettingChanged += delegate { OnBoxModeChanged(ModConfig.StaticBoxesEnabled); }; ModConfig.DynamicBoxesEnabled.SettingChanged += delegate { OnBoxModeChanged(ModConfig.DynamicBoxesEnabled); }; ModConfig.AnchorBreakSafetyDistance.SettingChanged += delegate { SaveConfigNow(); }; ModConfig.SpawnGraceSeconds.SettingChanged += delegate { SaveConfigNow(); }; ModConfig.WhitelistEnabled.SettingChanged += delegate { OnWhitelistChanged(); }; ModConfig.WhitelistedSteamIds.SettingChanged += delegate { OnWhitelistChanged(); }; RegisterLiveConfigUpdates(); Log.LogInfo((object)"ATLYSS Player Collision 1.0.0 loaded. Use /collider status for diagnostics."); } private void OnDestroy() { try { Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } SceneManager.sceneLoaded -= OnSceneLoaded; SceneManager.activeSceneChanged -= OnActiveSceneChanged; Registry?.Dispose(); } catch { } } internal void SetLocalCollisionEnabled(bool enabled) { if (enabled && !ModConfig.ModEnabled.Value) { ModConfig.ModEnabled.Value = true; } LocalCollisionEnabled = enabled; Registry?.SyncLocalCollisionEnabled(enabled); if (enabled) { Registry?.ForceRemeasureAll(); } else { Registry?.ClearRuntimeContactState(); } SaveConfigNow(); } internal void PanicLocal() { SetLocalCollisionEnabled(enabled: false); ApplyConfiguredGraceToAll(); } internal void SaveConfigNow() { try { ((BaseUnityPlugin)this).Config.Save(); } catch (Exception ex) { Log.LogWarning((object)("[Config] Save failed: " + ex.Message)); } } internal bool SaveBoxPreset(string requestedName, out string presetName, out string error) { bool flag = ModConfig.SaveCurrentBoxPreset(requestedName, out presetName, out error); if (flag) { SaveConfigNow(); } return flag; } internal bool LoadBoxPreset(string requestedName, out string presetName, out string error) { _suppressLiveConfigEvents = true; bool flag; try { flag = ModConfig.TryLoadBoxPreset(requestedName, out presetName, out error); } finally { _suppressLiveConfigEvents = false; } if (flag) { NormalizeModesToDefaults(); OnBoxSettingsChanged(); } return flag; } internal bool DeleteBoxPreset(string requestedName, out string presetName) { bool flag = ModConfig.DeleteBoxPreset(requestedName, out presetName); if (flag) { SaveConfigNow(); } return flag; } internal void OnBoxSettingsChanged() { NormalizeModesToDefaults(); Registry?.ForceRemeasureAll(); SaveConfigNow(); } private void OnBoxModeChanged(ConfigEntry changed) { if (!_normalizingModes) { _normalizingModes = true; try { bool preferStatic = changed != ModConfig.DynamicBoxesEnabled || !ModConfig.DynamicBoxesEnabled.Value; ModConfig.NormalizeBoxMode(preferStatic); } finally { _normalizingModes = false; } Registry?.ForceRemeasureAll(); SaveConfigNow(); } } private void OnStickModeChanged(ConfigEntry changed) { if (!_normalizingModes) { _normalizingModes = true; try { bool preferUnsafe = changed != ModConfig.StrictStickEnabled || !ModConfig.StrictStickEnabled.Value; ModConfig.NormalizeStickMode(preferUnsafe); } finally { _normalizingModes = false; } SaveConfigNow(); } } private void NormalizeModesToDefaults() { if (_normalizingModes) { return; } _normalizingModes = true; try { ModConfig.NormalizeBoxMode(preferStatic: true); ModConfig.NormalizeStickMode(preferUnsafe: true); } finally { _normalizingModes = false; } } private void RegisterLiveConfigUpdates() { Track(ModConfig.SolidRemoteBodyEnabled); Track(ModConfig.StandingPlatformEnabled); Track(ModConfig.ChestBoxEnabled); Track(ModConfig.DebugCollidersEnabled); Track(ModConfig.AllowTransformFallback); Track(ModConfig.VisualBoundsEnabled); Track(ModConfig.IncludeAccessoriesInBounds); Track(ModConfig.UseBodyMeshForSize); Track(ModConfig.RendererRecacheSeconds); Track(ModConfig.PoseMeasureIntervalSeconds); Track(ModConfig.VisualBoundsLerpSpeed); Track(ModConfig.LimitRenderedBoxesByDistance); Track(ModConfig.RenderedBoxDistance); Track(ModConfig.ReduceRenderedBoxes); Track(ModConfig.MaxRenderedBoxes); Track(ModConfig.DebugRenderRange); Track(ModConfig.UseBakedPoseBounds); Track(ModConfig.AnchorRotateWithCarrier); Track(ModConfig.BaseBoxWidth); Track(ModConfig.BaseBoxDepth); Track(ModConfig.BaseBoxHeight); Track(ModConfig.BoxWidthMultiplier); Track(ModConfig.BoxDepthMultiplier); Track(ModConfig.BoxHeightMultiplier); Track(ModConfig.MinDimension); Track(ModConfig.MaxDimension); Track(ModConfig.WidthPadding); Track(ModConfig.HeightPadding); Track(ModConfig.BodyWidthAdjustment); Track(ModConfig.BodyDepthAdjustment); Track(ModConfig.BodyHeightAdjustment); Track(ModConfig.PlatformExtraWidth); Track(ModConfig.PlatformExtraDepth); Track(ModConfig.PlatformThickness); Track(ModConfig.PlatformTopOffset); Track(ModConfig.HeadBoneTopOffset); Track(ModConfig.BodyHeadClearance); Track(ModConfig.HeadWidthAdjustment); Track(ModConfig.HeadDepthAdjustment); Track(ModConfig.HeadHeightAdjustment); Track(ModConfig.ChestBoxHeightRatio); Track(ModConfig.ChestBoxWidthMultiplier); Track(ModConfig.ChestBoxDepthMultiplier); Track(ModConfig.ChestBoxThickness); Track(ModConfig.ChestBoxForwardOffset); Track(ModConfig.PushStrength); Track(ModConfig.MaxPushPerFrame); void Track(ConfigEntry entry) where T : notnull { entry.SettingChanged += delegate { if (!_suppressLiveConfigEvents) { OnBoxSettingsChanged(); } }; } } private void OnModEnabledChanged() { if (ModConfig.ModEnabled.Value) { Registry?.SyncLocalCollisionEnabled(LocalCollisionEnabled); Registry?.ForceRemeasureAll(); } else { Registry?.HideAllBodiesAndClearContact("modOff"); } SaveConfigNow(); } private void OnLocalToggleChanged() { Registry?.SyncLocalCollisionEnabled(LocalCollisionEnabled); if (LocalCollisionEnabled) { Registry?.ForceRemeasureAll(); } else { Registry?.ClearRuntimeContactState(); } SaveConfigNow(); } private void OnWhitelistChanged() { Registry?.ForceRemeasureAll(); CollisionNetworkBridge.BroadcastLocalWhitelistPolicy(); SaveConfigNow(); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { ApplyConfiguredGraceToAll(); CollisionNetworkBridge.RequestPolicyBroadcastSoon(); } private void OnActiveSceneChanged(Scene previous, Scene current) { ApplyConfiguredGraceToAll(); CollisionNetworkBridge.RequestPolicyBroadcastSoon(); } private static void ApplyConfiguredGraceToAll() { Registry?.ApplyGraceToAll(ModConfig.SpawnGraceSeconds.Value); } } internal static class CollisionNetworkBridge { private sealed class RemoteCollisionPolicy { internal string SteamId { get; } internal string DisplayName { get; } internal string PluginVersion { get; } internal bool WhitelistEnabled { get; } internal HashSet AllowedSteamIds { get; } internal float LastReceivedTime { get; } internal RemoteCollisionPolicy(string steamId, string displayName, string pluginVersion, bool whitelistEnabled, HashSet allowedSteamIds, float lastReceivedTime) { SteamId = steamId; DisplayName = displayName; PluginVersion = pluginVersion; WhitelistEnabled = whitelistEnabled; AllowedSteamIds = allowedSteamIds; LastReceivedTime = lastReceivedTime; } } private sealed class RemotePoseState { internal string SteamId { get; } internal string DisplayName { get; } internal string PluginVersion { get; } internal bool IsLowered { get; } internal bool IsSitting { get; } internal bool IsEmoting { get; } internal double TimestampUtc { get; } internal float LastReceivedTime { get; } internal RemotePoseState(string steamId, string displayName, string pluginVersion, bool isLowered, bool isSitting, bool isEmoting, double timestampUtc, float lastReceivedTime) { SteamId = steamId; DisplayName = displayName; PluginVersion = pluginVersion; IsLowered = isLowered; IsSitting = isSitting; IsEmoting = isEmoting; TimestampUtc = timestampUtc; LastReceivedTime = lastReceivedTime; } } [CompilerGenerated] private static class <>O { public static PacketListener <0>__ReceiveWhitelistPolicy; public static PacketListener <1>__ReceiveRemoveRequest; public static PacketListener <2>__ReceiveRemoveResponse; public static PacketListener <3>__ReceivePoseState; } private const int ProtocolVersion = 1; private const float PolicyBroadcastSeconds = 20f; private const float RemotePolicyTimeoutSeconds = 75f; private const float PoseBroadcastMinSeconds = 0.25f; private const float PoseBroadcastIdleSeconds = 1f; private const float PoseBroadcastKeepAliveSeconds = 1.5f; private const float RemotePoseTimeoutSeconds = 4f; private const float StalePruneIntervalSeconds = 1f; private static readonly Dictionary RemotePolicies = new Dictionary(StringComparer.Ordinal); private static readonly Dictionary RemotePoseStates = new Dictionary(StringComparer.Ordinal); private static readonly Dictionary PendingRemoveRequests = new Dictionary(StringComparer.Ordinal); private static readonly List StaleKeys = new List(8); private static bool _initialized; private static float _nextPolicyBroadcastTime; private static float _nextPoseBroadcastTime; private static float _nextPruneTime; private static float _lastPoseBroadcastTime = -1000f; private static bool _hasLastPoseState; private static bool _lastPoseLowered; private static bool _lastPoseSitting; private static bool _lastPoseEmoting; internal static void Initialize() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //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_006e: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown if (!_initialized) { object obj = <>O.<0>__ReceiveWhitelistPolicy; if (obj == null) { PacketListener val = ReceiveWhitelistPolicy; <>O.<0>__ReceiveWhitelistPolicy = val; obj = (object)val; } bool flag = CodeTalkerNetwork.RegisterListener((PacketListener)obj); object obj2 = <>O.<1>__ReceiveRemoveRequest; if (obj2 == null) { PacketListener val2 = ReceiveRemoveRequest; <>O.<1>__ReceiveRemoveRequest = val2; obj2 = (object)val2; } bool flag2 = CodeTalkerNetwork.RegisterListener((PacketListener)obj2); object obj3 = <>O.<2>__ReceiveRemoveResponse; if (obj3 == null) { PacketListener val3 = ReceiveRemoveResponse; <>O.<2>__ReceiveRemoveResponse = val3; obj3 = (object)val3; } bool flag3 = CodeTalkerNetwork.RegisterListener((PacketListener)obj3); object obj4 = <>O.<3>__ReceivePoseState; if (obj4 == null) { PacketListener val4 = ReceivePoseState; <>O.<3>__ReceivePoseState = val4; obj4 = (object)val4; } bool flag4 = CodeTalkerNetwork.RegisterListener((PacketListener)obj4); _initialized = true; _nextPolicyBroadcastTime = 0f; _nextPoseBroadcastTime = 0f; _nextPruneTime = 0f; PlayerCollisionPlugin.Log.LogInfo((object)$"[CodeYapper] Registered listeners. policy={flag}, remove={flag2}, response={flag3}, pose={flag4}"); } } internal static void Tick() { if (!_initialized) { return; } PruneStaleState(); BroadcastLocalPoseStateIfNeeded(); if (!(Time.time < _nextPolicyBroadcastTime)) { if (!TryGetLocalIdentity(out string _, out string _)) { _nextPolicyBroadcastTime = Time.time + 2f; } else { BroadcastLocalWhitelistPolicy(); } } } internal static void RequestPolicyBroadcastSoon() { if (_initialized) { _nextPolicyBroadcastTime = 0f; } } internal static void BroadcastLocalWhitelistPolicy() { if (!_initialized || !TryGetLocalIdentity(out string steamId, out string displayName)) { return; } HashSet whitelistSet = PlayerCollisionPlugin.ModConfig.GetWhitelistSet(); string allowedSteamIds = string.Join(",", whitelistSet.OrderBy((string s) => s, StringComparer.Ordinal)); CollisionWhitelistPolicyPacket collisionWhitelistPolicyPacket = new CollisionWhitelistPolicyPacket(1, "1.0.0", steamId, displayName, PlayerCollisionPlugin.ModConfig.WhitelistEnabled.Value, allowedSteamIds); try { CodeTalkerNetwork.SendNetworkPacket((PacketBase)(object)collisionWhitelistPolicyPacket); _nextPolicyBroadcastTime = Time.time + 20f; } catch (Exception ex) { PlayerCollisionPlugin.Log.LogWarning((object)("[CodeYapper] Whitelist policy broadcast failed: " + ex.Message)); _nextPolicyBroadcastTime = Time.time + 5f; } } private static void BroadcastLocalPoseStateIfNeeded() { if (!_initialized || Time.time < _nextPoseBroadcastTime) { return; } if (!TryGetLocalIdentity(out string steamId, out string displayName)) { _nextPoseBroadcastTime = Time.time + 1f; return; } CollisionPlayerRegistry registry = PlayerCollisionPlugin.Registry; if (registry == null || !registry.TryGetLocalPoseState(out var isLowered, out var isSitting, out var isEmoting)) { _nextPoseBroadcastTime = Time.time + 1f; return; } bool flag = !_hasLastPoseState || _lastPoseLowered != isLowered || _lastPoseSitting != isSitting || _lastPoseEmoting != isEmoting; bool flag2 = isLowered && Time.time - _lastPoseBroadcastTime >= 1.5f; if (!flag && !flag2) { _nextPoseBroadcastTime = Time.time + (isLowered ? 0.25f : 1f); return; } CollisionPoseStatePacket collisionPoseStatePacket = new CollisionPoseStatePacket(1, "1.0.0", steamId, displayName, isLowered, isSitting, isEmoting, (double)DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() / 1000.0); try { CodeTalkerNetwork.SendNetworkPacket((PacketBase)(object)collisionPoseStatePacket); _hasLastPoseState = true; _lastPoseLowered = isLowered; _lastPoseSitting = isSitting; _lastPoseEmoting = isEmoting; _lastPoseBroadcastTime = Time.time; _nextPoseBroadcastTime = Time.time + 0.25f; } catch (Exception ex) { PlayerCollisionPlugin.Log.LogWarning((object)("[CodeYapper] Pose state broadcast failed: " + ex.Message)); _nextPoseBroadcastTime = Time.time + 1f; } } internal static bool IsRemotePolicyAllowed(string remoteSteamId, string localSteamId) { if (string.IsNullOrWhiteSpace(remoteSteamId) || remoteSteamId == "0") { return true; } if (!RemotePolicies.TryGetValue(remoteSteamId, out RemoteCollisionPolicy value)) { return true; } if (Time.time - value.LastReceivedTime > 75f) { RemotePolicies.Remove(remoteSteamId); return true; } if (!value.WhitelistEnabled) { return true; } if (string.IsNullOrWhiteSpace(localSteamId) || localSteamId == "0") { return true; } return value.AllowedSteamIds.Contains(localSteamId); } internal static bool HasRemotePolicy(string remoteSteamId) { return !string.IsNullOrWhiteSpace(remoteSteamId) && RemotePolicies.ContainsKey(remoteSteamId); } internal static bool TryGetRemotePoseState(string remoteSteamId, out bool isLowered, out bool isSitting, out bool isEmoting) { isLowered = false; isSitting = false; isEmoting = false; if (string.IsNullOrWhiteSpace(remoteSteamId) || remoteSteamId == "0") { return false; } if (!RemotePoseStates.TryGetValue(remoteSteamId, out RemotePoseState value)) { return false; } if (Time.time - value.LastReceivedTime > 4f) { RemotePoseStates.Remove(remoteSteamId); return false; } isLowered = value.IsLowered; isSitting = value.IsSitting; isEmoting = value.IsEmoting; return true; } internal static bool TrySendRemoveRequest(CollisionPlayerState carrier, CollisionPlayerState rider, out string detail) { detail = "Remote remove request was not sent."; if (!_initialized) { detail = "CodeYapper networking is not initialized."; return false; } if (carrier == null || rider == null) { detail = "Carrier or rider state was missing."; return false; } if (string.IsNullOrWhiteSpace(carrier.SteamId) || carrier.SteamId == "0") { detail = "Your Steam64 ID is not ready yet."; return false; } if (!ulong.TryParse(rider.SteamId, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) || result == 0) { detail = rider.DisplayName + "'s Steam64 ID is not ready yet."; return false; } string text = carrier.SteamId + ":" + rider.SteamId + ":" + DateTime.UtcNow.Ticks.ToString(CultureInfo.InvariantCulture); CollisionRemoveRequestPacket collisionRemoveRequestPacket = new CollisionRemoveRequestPacket(1, text, carrier.SteamId, carrier.DisplayName, rider.SteamId); try { CodeTalkerNetwork.SendNetworkPacket(result, (PacketBase)(object)collisionRemoveRequestPacket, (CompressionType)0, CompressionLevel.Fastest); PendingRemoveRequests[text] = Time.time; detail = "Sent a compatible-client remove request through CodeYapper."; return true; } catch (Exception ex) { detail = "CodeYapper remove request failed: " + ex.Message; return false; } } private static void ReceiveWhitelistPolicy(PacketHeader header, PacketBase packet) { if (packet is CollisionWhitelistPolicyPacket collisionWhitelistPolicyPacket && collisionWhitelistPolicyPacket.ProtocolVersion == 1) { string text = header.SenderID.ToString(CultureInfo.InvariantCulture); if (!IsLocalSteamId(text)) { RemotePolicies[text] = new RemoteCollisionPolicy(text, collisionWhitelistPolicyPacket.SenderName, collisionWhitelistPolicyPacket.PluginVersion, collisionWhitelistPolicyPacket.WhitelistEnabled, ParseSteamIdSet(collisionWhitelistPolicyPacket.AllowedSteamIds), Time.time); } } } private static void ReceiveRemoveRequest(PacketHeader header, PacketBase packet) { if (packet is CollisionRemoveRequestPacket collisionRemoveRequestPacket) { string text = header.SenderID.ToString(CultureInfo.InvariantCulture); bool accepted = false; string reason; string steamId; string displayName; if (collisionRemoveRequestPacket.ProtocolVersion != 1) { reason = "protocolMismatch"; } else if (!string.IsNullOrWhiteSpace(collisionRemoveRequestPacket.CarrierSteamId) && !string.Equals(collisionRemoveRequestPacket.CarrierSteamId, text, StringComparison.Ordinal)) { reason = "senderMismatch"; } else if (!TryGetLocalIdentity(out steamId, out displayName)) { reason = "localNotReady"; } else if (!string.IsNullOrWhiteSpace(collisionRemoveRequestPacket.RiderSteamId) && !string.Equals(collisionRemoveRequestPacket.RiderSteamId, steamId, StringComparison.Ordinal)) { reason = "targetMismatch"; } else { accepted = PlayerCollisionPlugin.Registry.TryHonorRemoteRemoveRequest(text, out reason); } TrySendRemoveResponse(text, collisionRemoveRequestPacket.RequestId, accepted, reason); } } private static void ReceiveRemoveResponse(PacketHeader header, PacketBase packet) { if (packet is CollisionRemoveResponsePacket collisionRemoveResponsePacket && collisionRemoveResponsePacket.ProtocolVersion == 1) { PendingRemoveRequests.Remove(collisionRemoveResponsePacket.RequestId); string text = header.SenderID.ToString(CultureInfo.InvariantCulture); PlayerCollisionPlugin.Log.LogInfo((object)$"[CodeYapper] Remove response from {collisionRemoveResponsePacket.RiderName} ({text}): accepted={collisionRemoveResponsePacket.Accepted}, reason={collisionRemoveResponsePacket.Reason}"); } } private static void ReceivePoseState(PacketHeader header, PacketBase packet) { if (packet is CollisionPoseStatePacket collisionPoseStatePacket && collisionPoseStatePacket.ProtocolVersion == 1) { string text = header.SenderID.ToString(CultureInfo.InvariantCulture); if (!IsLocalSteamId(text)) { RemotePoseStates[text] = new RemotePoseState(text, collisionPoseStatePacket.SenderName, collisionPoseStatePacket.PluginVersion, collisionPoseStatePacket.IsLowered, collisionPoseStatePacket.IsSitting, collisionPoseStatePacket.IsEmoting, collisionPoseStatePacket.TimestampUtc, Time.time); } } } private static void TrySendRemoveResponse(string targetSteamId, string requestId, bool accepted, string reason) { if (!ulong.TryParse(targetSteamId, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) || result == 0) { return; } TryGetLocalIdentity(out string steamId, out string displayName); CollisionRemoveResponsePacket collisionRemoveResponsePacket = new CollisionRemoveResponsePacket(1, requestId, steamId, displayName, accepted, reason); try { CodeTalkerNetwork.SendNetworkPacket(result, (PacketBase)(object)collisionRemoveResponsePacket, (CompressionType)0, CompressionLevel.Fastest); } catch (Exception ex) { PlayerCollisionPlugin.Log.LogWarning((object)("[CodeYapper] Remove response failed: " + ex.Message)); } } private static bool TryGetLocalIdentity(out string steamId, out string displayName) { steamId = "0"; displayName = "Player"; CollisionPlayerState collisionPlayerState = PlayerCollisionPlugin.Registry?.LocalPlayer; if (collisionPlayerState != null) { steamId = collisionPlayerState.SteamId; displayName = collisionPlayerState.DisplayName; } Player mainPlayer = Player._mainPlayer; if ((Object)(object)mainPlayer != (Object)null) { steamId = PlayerIdentity.GetSteamId(mainPlayer); displayName = PlayerIdentity.GetDisplayName(mainPlayer); } return !string.IsNullOrWhiteSpace(steamId) && steamId != "0"; } private static bool IsLocalSteamId(string steamId) { string steamId2; string displayName; return TryGetLocalIdentity(out steamId2, out displayName) && string.Equals(steamId2, steamId, StringComparison.Ordinal); } private static HashSet ParseSteamIdSet(string raw) { HashSet hashSet = new HashSet(StringComparer.Ordinal); if (string.IsNullOrWhiteSpace(raw)) { return hashSet; } string[] array = raw.Split(','); foreach (string text in array) { string text2 = text.Trim(); if (!string.IsNullOrWhiteSpace(text2) && text2 != "0") { hashSet.Add(text2); } } return hashSet; } private static void PruneStaleState() { float time = Time.time; if (time < _nextPruneTime) { return; } _nextPruneTime = time + 1f; StaleKeys.Clear(); foreach (KeyValuePair remotePolicy in RemotePolicies) { if (!(time - remotePolicy.Value.LastReceivedTime <= 75f)) { StaleKeys.Add(remotePolicy.Key); } } foreach (string staleKey in StaleKeys) { RemotePolicies.Remove(staleKey); } StaleKeys.Clear(); foreach (KeyValuePair remotePoseState in RemotePoseStates) { if (!(time - remotePoseState.Value.LastReceivedTime <= 4f)) { StaleKeys.Add(remotePoseState.Key); } } foreach (string staleKey2 in StaleKeys) { RemotePoseStates.Remove(staleKey2); } StaleKeys.Clear(); foreach (KeyValuePair pendingRemoveRequest in PendingRemoveRequests) { if (!(time - pendingRemoveRequest.Value <= 75f)) { StaleKeys.Add(pendingRemoveRequest.Key); } } foreach (string staleKey3 in StaleKeys) { PendingRemoveRequests.Remove(staleKey3); } StaleKeys.Clear(); } } public sealed class CollisionWhitelistPolicyPacket : PacketBase { public override string PacketSourceGUID => "dev.seth.atlyssplayercollision"; [JsonProperty] public int ProtocolVersion { get; set; } [JsonProperty] public string PluginVersion { get; set; } = string.Empty; [JsonProperty] public string SenderSteamId { get; set; } = string.Empty; [JsonProperty] public string SenderName { get; set; } = string.Empty; [JsonProperty] public bool WhitelistEnabled { get; set; } [JsonProperty] public string AllowedSteamIds { get; set; } = string.Empty; public CollisionWhitelistPolicyPacket() { } internal CollisionWhitelistPolicyPacket(int protocolVersion, string pluginVersion, string senderSteamId, string senderName, bool whitelistEnabled, string allowedSteamIds) { ProtocolVersion = protocolVersion; PluginVersion = pluginVersion; SenderSteamId = senderSteamId; SenderName = senderName; WhitelistEnabled = whitelistEnabled; AllowedSteamIds = allowedSteamIds; } } public sealed class CollisionRemoveRequestPacket : PacketBase { public override string PacketSourceGUID => "dev.seth.atlyssplayercollision"; [JsonProperty] public int ProtocolVersion { get; set; } [JsonProperty] public string RequestId { get; set; } = string.Empty; [JsonProperty] public string CarrierSteamId { get; set; } = string.Empty; [JsonProperty] public string CarrierName { get; set; } = string.Empty; [JsonProperty] public string RiderSteamId { get; set; } = string.Empty; public CollisionRemoveRequestPacket() { } internal CollisionRemoveRequestPacket(int protocolVersion, string requestId, string carrierSteamId, string carrierName, string riderSteamId) { ProtocolVersion = protocolVersion; RequestId = requestId; CarrierSteamId = carrierSteamId; CarrierName = carrierName; RiderSteamId = riderSteamId; } } public sealed class CollisionRemoveResponsePacket : PacketBase { public override string PacketSourceGUID => "dev.seth.atlyssplayercollision"; [JsonProperty] public int ProtocolVersion { get; set; } [JsonProperty] public string RequestId { get; set; } = string.Empty; [JsonProperty] public string RiderSteamId { get; set; } = string.Empty; [JsonProperty] public string RiderName { get; set; } = string.Empty; [JsonProperty] public bool Accepted { get; set; } [JsonProperty] public string Reason { get; set; } = string.Empty; public CollisionRemoveResponsePacket() { } internal CollisionRemoveResponsePacket(int protocolVersion, string requestId, string riderSteamId, string riderName, bool accepted, string reason) { ProtocolVersion = protocolVersion; RequestId = requestId; RiderSteamId = riderSteamId; RiderName = riderName; Accepted = accepted; Reason = reason; } } public sealed class CollisionPoseStatePacket : PacketBase { public override string PacketSourceGUID => "dev.seth.atlyssplayercollision"; [JsonProperty] public int ProtocolVersion { get; set; } [JsonProperty] public string PluginVersion { get; set; } = string.Empty; [JsonProperty] public string SenderSteamId { get; set; } = string.Empty; [JsonProperty] public string SenderName { get; set; } = string.Empty; [JsonProperty] public bool IsLowered { get; set; } [JsonProperty] public bool IsSitting { get; set; } [JsonProperty] public bool IsEmoting { get; set; } [JsonProperty] public double TimestampUtc { get; set; } public CollisionPoseStatePacket() { } internal CollisionPoseStatePacket(int protocolVersion, string pluginVersion, string senderSteamId, string senderName, bool isLowered, bool isSitting, bool isEmoting, double timestampUtc) { ProtocolVersion = protocolVersion; PluginVersion = pluginVersion; SenderSteamId = senderSteamId; SenderName = senderName; IsLowered = isLowered; IsSitting = isSitting; IsEmoting = isEmoting; TimestampUtc = timestampUtc; } } internal sealed class CollisionPlayerRegistry : IDisposable { private const float ScaleSanityLimit = 1000f; private const float BodyWidthFitFactor = 0.6f; private const float BodyDepthFitFactor = 0.64f; private const float BodyFootprintMinFactor = 0.28f; private const float BodyFootprintMaxFactor = 1.45f; private const float PlatformFootprintFactor = 0.64f; private const float LocalHeadRiderBodySuppressionSeconds = 0.35f; private const float StaticScaleRefreshSecondsMin = 4f; private const float StaticPoseLoweredTopFactor = 0.62f; private const float StaticScaleChangeThreshold = 0.03f; private const float StaticDynamicBurstSeconds = 0.04f; private const float StaticDynamicRefreshSeconds = 180f; private const float StaticDynamicPoseProbeSeconds = 3f; private const float StaticDynamicVisualProbeDistance = 12f; private const float StaticDynamicVisualDriftMin = 0.04f; private const float IdentityRefreshSeconds = 5f; private const float StaticDynamicVisualDriftScaleFactor = 0.035f; private const float ChestLowerMiddleMinFactor = 0.28f; private const float ChestLowerMiddleMaxFactor = 0.55f; private const float ChestStaticLowerMiddleMinFactor = 0.36f; private const float ChestStaticLowerMiddleMaxFactor = 0.6f; private const float ChestFallbackLowerMiddleMinFactor = 0.4f; private const float ChestFallbackLowerMiddleMaxFactor = 0.62f; private const float ChestStaticHeightBiasFactor = 0.03f; private const float ChestSmallLiftFactor = 0.08f; private const float ChestSmallLiftScale = 0.025f; private static readonly FieldInfo? PlayerIsSittingField = typeof(Player).GetField("_isSitting", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo? MovementLockTypeField = typeof(PlayerMove).GetField("_movementLockType", BindingFlags.Instance | BindingFlags.NonPublic); private readonly CollisionConfig _config; private readonly Dictionary _states = new Dictionary(); private readonly Dictionary _nextRendererRecache = new Dictionary(); private readonly List _renderSlotCandidates = new List(); private readonly HashSet _scanSeenPlayers = new HashSet(); private readonly List _scanStalePlayers = new List(); private float _nextScanTime; private float _globalGraceUntil; internal CollisionPlayerState? LocalPlayer { get; private set; } internal IReadOnlyCollection Players => _states.Values; internal CollisionPlayerRegistry(CollisionConfig config) { _config = config; } internal bool AddPlayer(Player player) { if ((Object)(object)player == (Object)null) { return false; } int instanceID = ((Object)player).GetInstanceID(); if (_states.ContainsKey(instanceID)) { return false; } bool flag = IsLocalPlayer(player); string steamId = PlayerIdentity.GetSteamId(player); string displayName = PlayerIdentity.GetDisplayName(player); CollisionPlayerState collisionPlayerState = new CollisionPlayerState(player) { CollisionEnabled = (!flag || PlayerCollisionPlugin.Instance.LocalCollisionEnabled), SteamId = steamId, DisplayName = displayName, NextIdentityRefreshTime = Time.time + 5f, IgnoreCollisionUntil = Mathf.Max(Time.time + _config.SpawnGraceSeconds.Value, _globalGraceUntil), CachedRenderers = (Renderer[])(_config.IsDynamicBoxMode() ? ((Array)PlayerIdentity.CollectRenderers(player)) : ((Array)Array.Empty())), CachedHeadTransform = (_config.IsDynamicBoxMode() ? PlayerIdentity.FindHeadTransform(player) : null), NextStaticDynamicRefreshTime = Time.time + 180f, NextStaticPoseProbeTime = Time.time + 3f }; collisionPlayerState.Body = new CollisionBody(collisionPlayerState, _config); _states[instanceID] = collisionPlayerState; _nextRendererRecache[instanceID] = Time.time + Mathf.Max(0.5f, _config.RendererRecacheSeconds.Value); PlayerCollisionPlugin.Log.LogInfo((object)$"[Registry] AddPlayer {displayName} ({steamId}). Local={flag}, renderers={collisionPlayerState.CachedRenderers.Length}"); return true; } internal bool RemovePlayer(Player player) { if ((Object)(object)player == (Object)null) { return false; } int instanceID = ((Object)player).GetInstanceID(); if (!_states.TryGetValue(instanceID, out CollisionPlayerState value)) { return false; } value.Body?.Destroy(); _states.Remove(instanceID); _nextRendererRecache.Remove(instanceID); PlayerCollisionPlugin.Log.LogInfo((object)("[Registry] RemovePlayer " + value.DisplayName + " (" + value.SteamId + ")")); return true; } internal void Tick() { if (Time.time >= _nextScanTime) { _nextScanTime = Time.time + Mathf.Max(0.5f, _config.ScanIntervalSeconds.Value); SafetyNetScan(); } Player mainPlayer = Player._mainPlayer; string localSteamId = (((Object)(object)mainPlayer != (Object)null) ? PlayerIdentity.GetSteamId(mainPlayer) : "0"); UpdateRenderSlotSelections(mainPlayer, localSteamId); LocalPlayer = null; foreach (CollisionPlayerState value in _states.Values) { RefreshState(value, mainPlayer, localSteamId); if (value.IsLocal) { LocalPlayer = value; } } ApplyLocalHeadRiderBodySuppression(); } private void UpdateRenderSlotSelections(Player? local, string localSteamId) { bool value = _config.LimitRenderedBoxesByDistance.Value; float renderedBoxDistance = _config.GetRenderedBoxDistance(); bool value2 = _config.ReduceRenderedBoxes.Value; int maxRenderedBoxCount = _config.GetMaxRenderedBoxCount(); List list = null; if (value2) { _renderSlotCandidates.Clear(); list = _renderSlotCandidates; } foreach (CollisionPlayerState value4 in _states.Values) { if ((Object)(object)value4.Player == (Object)null) { value4.IsWithinRenderDistance = false; value4.IsRenderCapSelected = false; value4.DistanceToLocalPlayer = float.PositiveInfinity; continue; } value4.IsLocal = value4.Player == local || IsLocalPlayer(value4.Player); RefreshIdentity(value4); value4.DistanceToLocalPlayer = HorizontalDistanceToLocal(value4, local); value4.IsWithinRenderDistance = value4.IsLocal || !value || value4.DistanceToLocalPlayer <= renderedBoxDistance; value4.IsRenderCapSelected = true; if (value2 && !value4.IsLocal && !((Object)(object)value4.Root == (Object)null) && !((Object)(object)local == (Object)null) && PlayerIdentity.IsSameMapAsLocal(value4.Player, local) && _config.IsAllowedBySteamId(value4.SteamId) && CollisionNetworkBridge.IsRemotePolicyAllowed(value4.SteamId, localSteamId) && value4.IsWithinRenderDistance) { float value3 = _config.TinyDisableThreshold.Value; if (!(value3 > 0f) || !(value4.TinyScale > 0f) || !(value4.TinyScale <= value3)) { list?.Add(value4); } } } if (value2 && list != null && list.Count > maxRenderedBoxCount) { list.Sort((CollisionPlayerState a, CollisionPlayerState b) => a.DistanceToLocalPlayer.CompareTo(b.DistanceToLocalPlayer)); for (int i = maxRenderedBoxCount; i < list.Count; i++) { list[i].IsRenderCapSelected = false; } } } internal void ApplyGraceToAll(float seconds) { float ignoreCollisionUntil = (_globalGraceUntil = Time.time + Mathf.Max(0f, seconds)); foreach (CollisionPlayerState value in _states.Values) { value.IgnoreCollisionUntil = ignoreCollisionUntil; } } internal void ForceRemeasureAll() { foreach (CollisionPlayerState value in _states.Values) { value.HasPoseTarget = false; value.NextPoseMeasureTime = 0f; value.StaticDynamicMeasureUntil = 0f; value.NextStaticDynamicRefreshTime = Time.time + 180f; value.NextStaticPoseProbeTime = 0f; value.HasStaticVisualPoseSample = false; } } internal void SyncLocalCollisionEnabled(bool enabled) { foreach (CollisionPlayerState value in _states.Values) { if (value.IsLocal) { value.CollisionEnabled = enabled; if (!enabled) { ClearRuntimeContactState(value); } } } } internal void ClearRuntimeContactState() { foreach (CollisionPlayerState value in _states.Values) { ClearRuntimeContactState(value); } } internal void HideAllBodiesAndClearContact(string reason) { foreach (CollisionPlayerState value in _states.Values) { value.ExpectsSolidBody = false; value.ExpectsPlatform = false; value.LastHideReason = reason; value.Body?.Hide(); ClearRuntimeContactState(value); SyncBodyHealth(value); } } private static void ClearRuntimeContactState(CollisionPlayerState state) { //IL_001e: 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) state.StandingOnInstanceId = 0; state.StandingOnUntil = 0f; state.AnchoredToInstanceId = 0; state.AnchorOffsetLocal = Vector3.zero; state.AnchorHeightOffset = 0f; state.AnchorCarrierRotation = Quaternion.identity; state.HasAnchorCarrierRotation = false; state.LastAnchorCarrierHeadTopY = 0f; state.LastAnchorRiderRootY = 0f; state.AnchorPoseSlackUntil = 0f; state.HasAnchorSample = false; state.SuppressSolidBodyUntil = 0f; } private void SafetyNetScan() { Player[] array = Object.FindObjectsOfType(); _scanSeenPlayers.Clear(); _scanStalePlayers.Clear(); Player[] array2 = array; foreach (Player val in array2) { if (!((Object)(object)val == (Object)null)) { _scanSeenPlayers.Add(((Object)val).GetInstanceID()); AddPlayer(val); } } foreach (KeyValuePair state in _states) { if (!_scanSeenPlayers.Contains(state.Key) || (Object)(object)state.Value.Player == (Object)null) { _scanStalePlayers.Add(state.Key); } } foreach (int scanStalePlayer in _scanStalePlayers) { _states[scanStalePlayer].Body?.Destroy(); _states.Remove(scanStalePlayer); _nextRendererRecache.Remove(scanStalePlayer); } _scanSeenPlayers.Clear(); _scanStalePlayers.Clear(); } private void RefreshState(CollisionPlayerState state, Player? local, string localSteamId) { //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_0892: Unknown result type (might be due to invalid IL or missing references) //IL_087d: Unknown result type (might be due to invalid IL or missing references) //IL_0883: Unknown result type (might be due to invalid IL or missing references) //IL_088a: Unknown result type (might be due to invalid IL or missing references) //IL_089f: Unknown result type (might be due to invalid IL or missing references) //IL_08b0: Unknown result type (might be due to invalid IL or missing references) //IL_08ba: Unknown result type (might be due to invalid IL or missing references) //IL_08cb: Unknown result type (might be due to invalid IL or missing references) //IL_08d0: Unknown result type (might be due to invalid IL or missing references) //IL_08d4: Unknown result type (might be due to invalid IL or missing references) //IL_08db: Unknown result type (might be due to invalid IL or missing references) //IL_08e9: Unknown result type (might be due to invalid IL or missing references) //IL_091a: Unknown result type (might be due to invalid IL or missing references) //IL_091c: Unknown result type (might be due to invalid IL or missing references) //IL_091e: Unknown result type (might be due to invalid IL or missing references) //IL_0ae2: Unknown result type (might be due to invalid IL or missing references) //IL_0b64: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)state.Player == (Object)null) { return; } state.IsLocal = state.Player == local || IsLocalPlayer(state.Player); RefreshIdentity(state); bool flag2 = (state.IsSameMapAsLocal = state.IsLocal || PlayerIdentity.IsSameMapAsLocal(state.Player, local)); state.DistanceToLocalPlayer = HorizontalDistanceToLocal(state, local); state.IsWithinRenderDistance = state.IsLocal || !_config.LimitRenderedBoxesByDistance.Value || state.DistanceToLocalPlayer <= _config.GetRenderedBoxDistance(); bool flag4 = (state.IsNearLocalPlayer = state.IsLocal || (state.IsWithinRenderDistance && state.IsRenderCapSelected)); state.ShouldRenderDebug = flag4 && (state.IsLocal || IsWithinRange(state, local, _config.DebugRenderRange.Value)); state.IsLocalWhitelisted = state.IsLocal || _config.IsAllowedBySteamId(state.SteamId); state.IsRemoteWhitelisted = state.IsLocal || CollisionNetworkBridge.IsRemotePolicyAllowed(state.SteamId, localSteamId); state.HasRemoteWhitelistPolicy = !state.IsLocal && CollisionNetworkBridge.HasRemotePolicy(state.SteamId); state.IsWhitelisted = state.IsLocal || (state.IsLocalWhitelisted && state.IsRemoteWhitelisted); if (!state.IsLocal && !flag2) { HideState(state, "differentMap"); return; } if (!state.IsLocal && !state.IsWithinRenderDistance) { HideState(state, "outOfRenderDistance"); return; } if (!state.IsLocal && !state.IsRenderCapSelected) { HideState(state, "renderCap"); return; } if (!state.IsLocal && !state.IsLocalWhitelisted) { HideState(state, "notWhitelisted"); return; } if (!state.IsLocal && !state.IsRemoteWhitelisted) { HideState(state, "remoteWhitelist"); return; } bool flag5 = _config.IsDynamicBoxMode(); bool value = _config.ChestBoxEnabled.Value; string text = (flag5 ? "dynamic" : "static"); bool flag6 = !string.Equals(state.BoxSizingMode, text, StringComparison.Ordinal) || state.ChestBoxActive != value; bool isLowered = false; bool isSitting = false; bool isEmoting = false; bool flag8 = (state.HasRemotePoseState = !state.IsLocal && CollisionNetworkBridge.TryGetRemotePoseState(state.SteamId, out isLowered, out isSitting, out isEmoting)); state.RemotePoseLowered = flag8 && isLowered; state.RemotePoseSitting = flag8 && isSitting; state.RemotePoseEmoting = flag8 && isEmoting; bool remotePoseLowered = state.RemotePoseLowered; bool flag9 = !flag5 && (IsStaticLoweredPose(state) || remotePoseLowered); string text2 = (flag9 ? "lowered" : "standing"); bool flag10 = !flag5 && !string.Equals(state.StaticPoseBucket, text2, StringComparison.Ordinal); Vector2 val = (flag5 ? state.CachedTransformScale : PlayerIdentity.EstimateBodyScale(state.Player)); bool flag11 = !flag5 && HasScaleChanged(state.CachedTransformScale, val); if (!flag5 && state.NextStaticDynamicRefreshTime <= 0f) { state.NextStaticDynamicRefreshTime = Time.time + 180f; } bool flag12 = !flag5 && state.StaticDynamicMeasureUntil > 0f && Time.time <= state.StaticDynamicMeasureUntil; bool flag13 = !flag5 && state.HasPoseTarget && state.NextStaticDynamicRefreshTime > 0f && Time.time >= state.NextStaticDynamicRefreshTime; bool flag14 = false; if (!flag5 && !flag12 && !flag11 && !flag10 && !flag6 && state.HasPoseTarget && ShouldProbeStaticVisualPose(state, flag9) && Time.time >= state.NextStaticPoseProbeTime) { state.NextStaticPoseProbeTime = Time.time + 3f; flag14 = HasStaticVisualPoseDrift(state); } bool flag15 = !flag5 && (flag11 || flag10 || flag14 || flag13); if (flag15) { state.StaticDynamicMeasureUntil = Mathf.Max(state.StaticDynamicMeasureUntil, Time.time + 0.04f); state.NextStaticDynamicRefreshTime = Time.time + 180f; state.NextStaticPoseProbeTime = Time.time + 3f; } bool flag16 = !flag5 && state.StaticDynamicMeasureUntil > 0f && Time.time <= state.StaticDynamicMeasureUntil; bool flag17 = flag5 || (flag16 && !remotePoseLowered); bool flag18 = !state.HasPoseTarget || Time.time >= state.NextPoseMeasureTime || flag6 || flag10 || flag15; if (flag17) { if (!_nextRendererRecache.TryGetValue(state.InstanceId, out var value2) || Time.time >= value2 || state.CachedRenderers.Length == 0 || flag11 || flag10 || flag6) { RefreshCalibrationSources(state); } } else if (flag18 && !flag11 && !flag6 && !flag10 && !flag15 && state.HasPoseTarget) { state.NextPoseMeasureTime = Time.time + StaticScaleCheckInterval(); flag18 = false; } if (!flag17 && (flag18 || flag11)) { RefreshCalibrationSources(state); } if (flag17 ? (flag18 || flag11 || flag10 || flag6) : (flag18 || flag11)) { MeasurePoseTarget(state, flag17, value, flag9, !flag5 && !flag17, flag17 ? null : new Vector2?(val)); } state.BoxSizingMode = text; state.MeasurementMode = MeasurementModeName(flag5, flag16, flag9, flag11, flag10, flag14, flag13, remotePoseLowered); state.ChestBoxActive = value; state.StaticPoseLowered = flag9; state.StaticPoseBucket = text2; float num = ((!flag17 || flag16 || state.BoxWidth <= 0f) ? 1f : Mathf.Clamp01(Mathf.Max(1f, _config.VisualBoundsLerpSpeed.Value) * Time.deltaTime)); state.BoxWidth = Mathf.Lerp((state.BoxWidth <= 0f) ? state.TargetBoxWidth : state.BoxWidth, state.TargetBoxWidth, num); state.BoxDepth = Mathf.Lerp((state.BoxDepth <= 0f) ? state.TargetBoxDepth : state.BoxDepth, state.TargetBoxDepth, num); state.BoxHeight = Mathf.Lerp((state.BoxHeight <= 0f) ? state.TargetBoxHeight : state.BoxHeight, state.TargetBoxHeight, num); state.CenterY = Mathf.Lerp((state.CenterY <= 0f) ? state.TargetCenterY : state.CenterY, state.TargetCenterY, num); state.BottomOffsetY = Mathf.Lerp(state.BottomOffsetY, state.TargetBottomOffsetY, num); state.TopOffsetY = Mathf.Lerp((state.TopOffsetY <= 0f) ? state.TargetTopOffsetY : state.TopOffsetY, state.TargetTopOffsetY, num); state.HeadBoxWidth = Mathf.Lerp((state.HeadBoxWidth <= 0f) ? state.TargetHeadBoxWidth : state.HeadBoxWidth, state.TargetHeadBoxWidth, num); state.HeadBoxDepth = Mathf.Lerp((state.HeadBoxDepth <= 0f) ? state.TargetHeadBoxDepth : state.HeadBoxDepth, state.TargetHeadBoxDepth, num); state.HeadBoxThickness = Mathf.Lerp((state.HeadBoxThickness <= 0f) ? state.TargetHeadBoxThickness : state.HeadBoxThickness, state.TargetHeadBoxThickness, num); state.HeadBoxCenterY = Mathf.Lerp((state.HeadBoxCenterY <= 0f) ? state.TargetHeadBoxCenterY : state.HeadBoxCenterY, state.TargetHeadBoxCenterY, num); state.HeadBoxTopOffsetY = Mathf.Lerp((state.HeadBoxTopOffsetY <= 0f) ? state.TargetHeadBoxTopOffsetY : state.HeadBoxTopOffsetY, state.TargetHeadBoxTopOffsetY, num); state.PlatformLocalCenter = ((state.HeadBoxWidth <= 0f) ? state.TargetPlatformLocalCenter : Vector3.Lerp(state.PlatformLocalCenter, state.TargetPlatformLocalCenter, num)); state.PlatformLocalCenter = new Vector3(state.PlatformLocalCenter.x, state.HeadBoxCenterY, state.PlatformLocalCenter.z); Vector3 position = state.Root.position; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(position.x, position.y + state.CenterY, position.z); float num2 = Mathf.Max(state.BoxWidth, state.BoxDepth); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(num2, state.BoxHeight, num2); state.Bounds = new Bounds(val2, val3); state.HasBounds = true; bool flag20 = (state.IsTinyDisabled = _config.TinyDisableThreshold.Value > 0f && state.TinyScale > 0f && state.TinyScale <= _config.TinyDisableThreshold.Value); bool flag21 = IsInGracePeriod(state); bool flag22 = _config.ModEnabled.Value && !state.IsLocal && state.CollisionEnabled && !flag21 && flag2 && state.IsNearLocalPlayer && state.IsWithinRenderDistance && state.IsRenderCapSelected && state.IsWhitelisted && !flag20; bool flag23 = flag22 && !state.ShouldSuppressSolidBody && !value; bool flag24 = flag22; state.ExpectsSolidBody = flag23 && _config.SolidRemoteBodyEnabled.Value; state.ExpectsPlatform = flag24 && (value || _config.StandingPlatformEnabled.Value); if (state.Body == null || !state.Body.IsAlive) { state.Body = new CollisionBody(state, _config); } if (flag20) { state.LastHideReason = "tiny"; state.ExpectsSolidBody = false; state.ExpectsPlatform = false; state.Body.Hide(); SyncBodyHealth(state); return; } if (!state.Body.UpdateShape(state.BoxWidth, state.BoxDepth, state.BoxHeight, state.CenterY, state.HeadBoxWidth, state.HeadBoxDepth, state.HeadBoxThickness, state.HeadBoxCenterY, state.PlatformLocalCenter, flag23, flag24, _config.DebugCollidersEnabled.Value && state.ShouldRenderDebug, value)) { state.Body = new CollisionBody(state, _config); state.Body.UpdateShape(state.BoxWidth, state.BoxDepth, state.BoxHeight, state.CenterY, state.HeadBoxWidth, state.HeadBoxDepth, state.HeadBoxThickness, state.HeadBoxCenterY, state.PlatformLocalCenter, flag23, flag24, _config.DebugCollidersEnabled.Value && state.ShouldRenderDebug, value); } state.LastHideReason = ((!flag22) ? DisabledReason(state, flag2, flag21) : (state.ShouldSuppressSolidBody ? "bodySuppressedForRider" : "active")); state.LastShapeUpdateTime = Time.time; SyncBodyHealth(state); } private static void HideState(CollisionPlayerState state, string reason) { state.LastHideReason = reason; state.ExpectsSolidBody = false; state.ExpectsPlatform = false; state.ShouldRenderDebug = false; state.Body?.Hide(); SyncBodyHealth(state); } private static void SyncBodyHealth(CollisionPlayerState state) { CollisionBody body = state.Body; state.BodyObjectActive = body?.IsObjectActive ?? false; state.SolidBodyActive = body?.IsSolidBodyActive ?? false; state.PlatformActive = body?.IsPlatformActive ?? false; state.WireVisible = body?.IsAnyWireVisible ?? false; } private static void RefreshIdentity(CollisionPlayerState state) { if (!((Object)(object)state.Player == (Object)null) && (!(state.NextIdentityRefreshTime > 0f) || !(Time.time < state.NextIdentityRefreshTime))) { state.SteamId = PlayerIdentity.GetSteamId(state.Player); state.DisplayName = PlayerIdentity.GetDisplayName(state.Player); state.NextIdentityRefreshTime = Time.time + 5f; } } private void RefreshCalibrationSources(CollisionPlayerState state) { state.CachedRenderers = PlayerIdentity.CollectRenderers(state.Player); state.CachedHeadTransform = PlayerIdentity.FindHeadTransform(state.Player); _nextRendererRecache[state.InstanceId] = Time.time + Mathf.Max(0.5f, _config.RendererRecacheSeconds.Value); } private bool ShouldProbeStaticVisualPose(CollisionPlayerState state, bool staticPoseLowered) { if (state.IsLocal || !state.IsNearLocalPlayer || !state.IsWithinRenderDistance || !state.IsRenderCapSelected) { return false; } if (staticPoseLowered || state.ShouldRenderDebug) { return true; } if (state.DistanceToLocalPlayer <= 12f) { return true; } CollisionPlayerState localPlayer = LocalPlayer; if (localPlayer == null || (Object)(object)localPlayer.Root == (Object)null || !localPlayer.HasBounds) { return false; } if ((Object)(object)state.Root == (Object)null || !state.HasBounds) { return false; } return localPlayer.AnchoredToInstanceId == state.InstanceId || IsStandingOnHeadPlatform(state, localPlayer); } private bool HasStaticVisualPoseDrift(CollisionPlayerState state) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)state.Root == (Object)null) { return false; } if (state.CachedRenderers.Length == 0 || !_nextRendererRecache.TryGetValue(state.InstanceId, out var value) || Time.time >= value) { RefreshCalibrationSources(state); } if (!TryStaticVisualPoseBounds(state, out var topY, out var centerY, out var height)) { state.HasStaticVisualPoseSample = false; return false; } if (!state.HasStaticVisualPoseSample) { StoreStaticVisualPoseSample(state, topY, centerY, height); return false; } float num = Mathf.Max(0.1f, state.EffectiveScale.y); float num2 = Mathf.Max(0.04f, 0.035f * num); bool flag = Mathf.Abs(topY - state.StaticVisualPoseTopY) > num2 || Mathf.Abs(centerY - state.StaticVisualPoseCenterY) > num2 || Mathf.Abs(height - state.StaticVisualPoseHeight) > num2 * 1.5f; if (flag) { StoreStaticVisualPoseSample(state, topY, centerY, height); } return flag; } private static void StoreStaticVisualPoseSample(CollisionPlayerState state) { if (TryStaticVisualPoseBounds(state, out var topY, out var centerY, out var height)) { StoreStaticVisualPoseSample(state, topY, centerY, height); } else { state.HasStaticVisualPoseSample = false; } } private static void StoreStaticVisualPoseSample(CollisionPlayerState state, float topY, float centerY, float height) { state.StaticVisualPoseTopY = topY; state.StaticVisualPoseCenterY = centerY; state.StaticVisualPoseHeight = height; state.HasStaticVisualPoseSample = true; } private static bool TryStaticVisualPoseBounds(CollisionPlayerState state, out float topY, out float centerY, out float height) { //IL_005a: 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_0076: Unknown result type (might be due to invalid IL or missing references) topY = 0f; centerY = 0f; height = 0f; if ((Object)(object)state.Root == (Object)null || state.CachedRenderers.Length == 0) { return false; } if (!PlayerIdentity.TryGetBodyMeshBounds(state.CachedRenderers, state.Root, out var bounds)) { return false; } topY = ((Bounds)(ref bounds)).max.y; centerY = ((Bounds)(ref bounds)).center.y; height = ((Bounds)(ref bounds)).size.y; return true; } private static bool HasScaleChanged(Vector2 previous, Vector2 current) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) return Mathf.Abs(previous.x - current.x) > 0.03f || Mathf.Abs(previous.y - current.y) > 0.03f; } private static bool IsStaticDynamicMeasurement(string measurementMode) { return measurementMode?.StartsWith("staticDynamic", StringComparison.Ordinal) ?? false; } private static string MeasurementModeName(bool configuredDynamicMode, bool staticDynamicMeasurement, bool staticPoseLowered, bool scaleChanged, bool poseChanged, bool visualPoseChanged, bool periodicRefresh, bool networkPoseLowered) { if (configuredDynamicMode) { return "dynamicRender"; } if (!staticDynamicMeasurement) { return "staticCached"; } if (networkPoseLowered) { return "staticNetworkPose"; } if (staticPoseLowered || visualPoseChanged) { return "staticDynamicPose"; } if (scaleChanged) { return "staticDynamicScale"; } if (poseChanged) { return "staticDynamicTransition"; } if (periodicRefresh) { return "staticDynamicRefresh"; } return "staticDynamicBurst"; } private float StaticScaleCheckInterval() { return Mathf.Max(4f, _config.RendererRecacheSeconds.Value); } internal bool IsInGracePeriod(CollisionPlayerState state) { return state.IsInGracePeriod || Time.time < _globalGraceUntil; } private string DisabledReason(CollisionPlayerState state, bool sameMap, bool inGrace) { if (!_config.ModEnabled.Value) { return "modOff"; } if (state.IsLocal) { return "local"; } if (!state.CollisionEnabled) { return "collisionOff"; } if (inGrace) { return "grace"; } if (!sameMap) { return "differentMap"; } if (!state.IsWithinRenderDistance) { return "outOfRenderDistance"; } if (!state.IsRenderCapSelected) { return "renderCap"; } if (!state.IsLocalWhitelisted) { return "notWhitelisted"; } if (!state.IsRemoteWhitelisted) { return "remoteWhitelist"; } if (!state.IsWhitelisted) { return "notWhitelisted"; } if (state.IsTinyDisabled) { return "tiny"; } if (!state.IsNearLocalPlayer) { return "outOfRenderDistance"; } return state.ShouldSuppressSolidBody ? "bodySuppressedForRider" : "disabled"; } private void MeasurePoseTarget(CollisionPlayerState state, bool dynamicMode, bool chestBoxMode, bool staticPoseLowered, bool useStaticCalibration, Vector2? observedScale) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: 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) Vector2 val2 = (state.CachedTransformScale = (Vector2)(((??)observedScale) ?? PlayerIdentity.EstimateBodyScale(state.Player))); bool useRendererCalibration = dynamicMode || useStaticCalibration; ComputeTargetDimensions(state, val2, useRendererCalibration, useStaticCalibration, out var width, out var depth, out var height, out var centerY, out var bottomY, out var topY, out var visualTopY, out var visualCenterY, out var visualHeight); state.EffectiveScale = EstimateEffectiveScaleFromDimensions(width, depth, height, val2); state.TinyScale = EstimateTinyScale(state, val2, state.EffectiveScale); float num = ((!dynamicMode && staticPoseLowered) ? (bottomY + height * 0.62f) : topY); float width2; float depth2; float thickness; float centerY2; float topY2; Vector3 platformLocalCenter; if (chestBoxMode) { ComputeTargetChestBox(state, width, depth, num, state.EffectiveScale, dynamicMode, useRendererCalibration, bottomY, height, out width2, out depth2, out thickness, out centerY2, out topY2, out platformLocalCenter); } else { ComputeTargetHeadBox(state, width, depth, num, state.EffectiveScale, dynamicMode || useStaticCalibration, out width2, out depth2, out thickness, out centerY2, out topY2, out platformLocalCenter); } float num2 = SafeMinDimension(_config.MinDimension.Value); if (!chestBoxMode) { float num3 = _config.BodyHeadClearance.Value * Mathf.Max(0.1f, state.EffectiveScale.y); float num4 = Mathf.Min(topY, topY2 - thickness - num3); if (num4 > bottomY + num2) { topY = num4; height = Mathf.Max(num2, topY - bottomY); centerY = bottomY + height * 0.5f; } } state.TargetBoxWidth = width; state.TargetBoxDepth = depth; state.TargetBoxHeight = height; state.TargetCenterY = centerY; state.TargetBottomOffsetY = bottomY; state.TargetTopOffsetY = topY; state.TargetHeadBoxWidth = width2; state.TargetHeadBoxDepth = depth2; state.TargetHeadBoxThickness = thickness; state.TargetHeadBoxCenterY = centerY2; state.TargetHeadBoxTopOffsetY = topY2; state.TargetPlatformLocalCenter = platformLocalCenter; state.HasPoseTarget = true; StoreStaticVisualPoseSample(state, visualTopY, visualCenterY, visualHeight); float num5 = (dynamicMode ? Mathf.Max(0.05f, _config.PoseMeasureIntervalSeconds.Value) : StaticScaleCheckInterval()); state.NextPoseMeasureTime = Time.time + num5; } private void ComputeTargetDimensions(CollisionPlayerState state, Vector2 transformScale, bool useRendererCalibration, bool useStaticCalibration, out float width, out float depth, out float height, out float centerY, out float bottomY, out float topY, out float visualTopY, out float visualCenterY, out float visualHeight) { //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) Player player = state.Player; float minDim = SafeMinDimension(_config.MinDimension.Value); float value = _config.MaxDimension.Value; float num = SafePositiveDimension(_config.BaseBoxWidth.Value); float num2 = SafePositiveDimension(_config.BaseBoxDepth.Value); float num3 = SafePositiveDimension(_config.BaseBoxHeight.Value); float num4 = Mathf.Max(0f, _config.BoxWidthMultiplier.Value); float num5 = Mathf.Max(0f, _config.BoxDepthMultiplier.Value); float num6 = Mathf.Max(0f, _config.BoxHeightMultiplier.Value); float num7 = _config.WidthPadding.Value * 2f; float num8 = _config.HeightPadding.Value * 2f; visualTopY = 0f; visualCenterY = 0f; visualHeight = 0f; if (useRendererCalibration && _config.UseBodyMeshForSize.Value && PlayerIdentity.TryGetBodyMeshBounds(state.CachedRenderers, state.Root, out var bounds)) { float num9 = ClampDimension(((Bounds)(ref bounds)).size.y / num3, minDim, value); float num10 = ClampDimension(Mathf.Max(num9, Mathf.Max(transformScale.x, transformScale.y)), minDim, value); float num11 = num * num10 * 0.28f; float num12 = num2 * num10 * 0.28f; float num13 = num * num10 * 1.45f; float num14 = num2 * num10 * 1.45f; float num15 = Mathf.Clamp(((Bounds)(ref bounds)).size.x * 0.6f, num11, num13); float num16 = Mathf.Clamp(((Bounds)(ref bounds)).size.z * 0.64f, num12, num14); float num17 = Mathf.Max(0.1f, num10); float num18 = Mathf.Max(0.1f, num9); width = ClampDimension(num15 * num4 + num7 + _config.BodyWidthAdjustment.Value * num17, minDim, value); depth = ClampDimension(num16 * num5 + num7 + _config.BodyDepthAdjustment.Value * num17, minDim, value); height = ClampDimension(((Bounds)(ref bounds)).size.y * num6 + num8 + _config.BodyHeightAdjustment.Value * num18, minDim, value); centerY = ((Bounds)(ref bounds)).center.y; visualTopY = ((Bounds)(ref bounds)).max.y; visualCenterY = ((Bounds)(ref bounds)).center.y; visualHeight = ((Bounds)(ref bounds)).size.y; if (useStaticCalibration) { ClampStaticMeasuredDimensions(ref width, ref depth, ref height, ((Bounds)(ref bounds)).size.x, ((Bounds)(ref bounds)).size.z, ((Bounds)(ref bounds)).size.y, minDim, value); } bottomY = centerY - height * 0.5f; topY = centerY + height * 0.5f; return; } width = ClampDimension(num * transformScale.x * num4 + num7 + _config.BodyWidthAdjustment.Value * Mathf.Max(0.1f, transformScale.x), minDim, value); depth = ClampDimension(num2 * transformScale.x * num5 + num7 + _config.BodyDepthAdjustment.Value * Mathf.Max(0.1f, transformScale.x), minDim, value); height = ClampDimension(num3 * transformScale.y * num6 + num8 + _config.BodyHeightAdjustment.Value * Mathf.Max(0.1f, transformScale.y), minDim, value); bottomY = 0f; topY = height; centerY = height * 0.5f; visualTopY = topY; visualCenterY = centerY; visualHeight = height; if (useRendererCalibration && _config.VisualBoundsEnabled.Value && PlayerIdentity.TryGetVisualDimensions(player, out var width2, out var depth2, out var height2, out var centerY2, out var _, out var topY2)) { float num19 = ClampDimension(height2 / num3, minDim, value); float num20 = ClampDimension(Mathf.Max(Mathf.Max(width2 / num, depth2 / num2), Mathf.Max(transformScale.x, transformScale.y)), minDim, value); float num21 = num * num20 * 0.28f; float num22 = num2 * num20 * 0.28f; float num23 = num * num20 * 1.45f; float num24 = num2 * num20 * 1.45f; float num25 = Mathf.Clamp(width2 * 0.6f, num21, num23); float num26 = Mathf.Clamp(depth2 * 0.64f, num22, num24); float num27 = Mathf.Max(0.1f, num20); float num28 = Mathf.Max(0.1f, num19); width = ClampDimension(num25 * num4 + num7 + _config.BodyWidthAdjustment.Value * num27, minDim, value); depth = ClampDimension(num26 * num5 + num7 + _config.BodyDepthAdjustment.Value * num27, minDim, value); height = ClampDimension(height2 * num6 + num8 + _config.BodyHeightAdjustment.Value * num28, minDim, value); centerY = centerY2; visualTopY = topY2; visualCenterY = centerY2; visualHeight = height2; if (useStaticCalibration) { ClampStaticMeasuredDimensions(ref width, ref depth, ref height, width2, depth2, height2, minDim, value); } bottomY = centerY - height * 0.5f; topY = centerY + height * 0.5f; } } private void ComputeTargetHeadBox(CollisionPlayerState state, float bodyWidth, float bodyDepth, float visualTopY, Vector2 effectiveScale, bool dynamicMode, out float width, out float depth, out float thickness, out float centerY, out float topY, out Vector3 platformLocalCenter) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0.1f, effectiveScale.x); float num2 = Mathf.Max(0.1f, effectiveScale.y); thickness = Mathf.Clamp(_config.PlatformThickness.Value * num2, 0.02f, 0.75f); float value = _config.MaxDimension.Value; float minDim = SafeMinDimension(_config.MinDimension.Value); width = ClampDimension(bodyWidth * 0.64f + _config.PlatformExtraWidth.Value * num + _config.HeadWidthAdjustment.Value * num, minDim, value); depth = ClampDimension(bodyDepth * 0.64f + _config.PlatformExtraDepth.Value * num + _config.HeadDepthAdjustment.Value * num, minDim, value); float num3 = _config.PlatformTopOffset.Value * num2; float num4 = _config.HeadHeightAdjustment.Value * num2; topY = visualTopY + num3 + num4; Transform val = (dynamicMode ? state.CachedHeadTransform : null); if ((Object)(object)val != (Object)null && (Object)(object)state.Root != (Object)null) { try { Vector3 val2 = Quaternion.Inverse(state.Root.rotation) * (val.position - state.Root.position); if (val2.y > -1f && val2.y < 1000f) { float num5 = val2.y + _config.HeadBoneTopOffset.Value * num2 + num3 + num4; if (!float.IsNaN(num5) && !float.IsInfinity(num5)) { topY = Mathf.Max(topY, num5); } } } catch { } } centerY = topY - thickness * 0.5f; platformLocalCenter = new Vector3(0f, centerY, 0f); } private void ComputeTargetChestBox(CollisionPlayerState state, float bodyWidth, float bodyDepth, float platformSourceTopY, Vector2 effectiveScale, bool dynamicMode, bool useRendererCalibration, float bodyBottomY, float bodyHeight, out float width, out float depth, out float thickness, out float centerY, out float topY, out Vector3 platformLocalCenter) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) ComputeTargetHeadBox(state, bodyWidth, bodyDepth, platformSourceTopY, effectiveScale, dynamicMode: false, out width, out depth, out thickness, out centerY, out topY, out platformLocalCenter); float num = Mathf.Max(0.1f, effectiveScale.x); float num2 = Mathf.Max(0.1f, effectiveScale.y); float num3 = SafeMinDimension(_config.MinDimension.Value); float value = _config.MaxDimension.Value; float num4 = Mathf.Clamp(_config.ChestBoxWidthMultiplier.Value, 0.1f, 5f); float num5 = Mathf.Clamp(_config.ChestBoxDepthMultiplier.Value, 0.1f, 5f); float num6 = PlayerIdentity.EstimateChestWeight(state.Player); float num7 = (_config.ChestBoxForwardOffset.Value + num6 * 0.04f) * num; float num8 = Mathf.Clamp(_config.ChestBoxHeightRatio.Value, 0.2f, 0.7f); float num9 = Mathf.Clamp(num8 + ((!dynamicMode) ? 0.03f : 0f), 0.2f, 0.7f); bool flag = false; thickness = Mathf.Clamp(_config.ChestBoxThickness.Value * num2, 0.02f, 1f); if (useRendererCalibration && PlayerIdentity.TryGetChestMeshBounds(state.Player, state.Root, out var bounds)) { float num10 = Mathf.Clamp(((Bounds)(ref bounds)).size.x, Mathf.Max(num3, bodyWidth * 0.25f), Mathf.Max(num3, bodyWidth * 0.7f)); float num11 = Mathf.Clamp(((Bounds)(ref bounds)).size.z, Mathf.Max(num3, bodyDepth * 0.2f), Mathf.Max(num3, bodyDepth * 0.65f)); width = ClampDimension(ClampToBodyFraction(num10 * num4, bodyWidth, 0.22f, 0.75f), num3, value); depth = ClampDimension(ClampToBodyFraction(num11 * num5, bodyDepth, 0.18f, 0.7f), num3, value); float num12 = Mathf.Min(((Bounds)(ref bounds)).size.y * 0.08f, 0.025f * num2); float num13 = (dynamicMode ? 0.28f : 0.36f); float num14 = (dynamicMode ? 0.55f : 0.6f); topY = Mathf.Clamp(((Bounds)(ref bounds)).min.y + ((Bounds)(ref bounds)).size.y * num9 + num12, ((Bounds)(ref bounds)).min.y + ((Bounds)(ref bounds)).size.y * num13, ((Bounds)(ref bounds)).min.y + ((Bounds)(ref bounds)).size.y * num14); platformLocalCenter = new Vector3(((Bounds)(ref bounds)).center.x, 0f, ((Bounds)(ref bounds)).center.z + num7); flag = true; } if (!flag) { float num15 = Mathf.Min(bodyHeight * 0.02f, 0.025f * num2); float num16 = (dynamicMode ? num9 : Mathf.Max(num9, 0.4f)); float num17 = (dynamicMode ? 0.28f : 0.4f); topY = Mathf.Clamp(bodyBottomY + bodyHeight * num16 + num15, bodyBottomY + bodyHeight * num17, bodyBottomY + bodyHeight * 0.62f); width = ClampDimension(ClampToBodyFraction(bodyWidth * 0.58f * num4 * (1f + num6 * 0.08f), bodyWidth, 0.22f, 0.7f), num3, value); depth = ClampDimension(ClampToBodyFraction(bodyDepth * 0.58f * num5 * (1f + num6 * 0.12f), bodyDepth, 0.18f, 0.65f), num3, value); platformLocalCenter = new Vector3(0f, 0f, num7); } centerY = topY - thickness * 0.5f; platformLocalCenter = new Vector3(platformLocalCenter.x, centerY, platformLocalCenter.z); } private Vector2 EstimateEffectiveScaleFromDimensions(float width, float depth, float height, Vector2 fallback) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0.01f, Mathf.Max(SafePositiveDimension(_config.BaseBoxWidth.Value), SafePositiveDimension(_config.BaseBoxDepth.Value))); float num2 = SafePositiveDimension(_config.BaseBoxHeight.Value); float num3 = Mathf.Max(width, depth) / num; float num4 = height / num2; if (!IsUsableScale(num3)) { num3 = fallback.x; } if (!IsUsableScale(num4)) { num4 = fallback.y; } return new Vector2(num3, num4); } private static float EstimateTinyScale(CollisionPlayerState state, Vector2 transformScale, Vector2 effectiveScale) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) float tiny = 1f; Consider(transformScale.x); Consider(transformScale.y); Consider(effectiveScale.x); Consider(effectiveScale.y); try { Consider(PlayerIdentity.EstimateTinyVisibleScale(state.Player)); } catch { } return tiny; void Consider(float value) { float num = Mathf.Abs(value); if (!float.IsNaN(num) && !float.IsInfinity(num) && !(num <= 0f) && num < tiny) { tiny = num; } } } private static void ClampStaticMeasuredDimensions(ref float width, ref float depth, ref float height, float measuredWidth, float measuredDepth, float measuredHeight, float minDim, float maxDim) { width = ClampDimension(ClampToMeasuredRange(width, measuredWidth, 0.45f, 0.95f), minDim, maxDim); depth = ClampDimension(ClampToMeasuredRange(depth, measuredDepth, 0.45f, 0.95f), minDim, maxDim); height = ClampDimension(ClampToMeasuredRange(height, measuredHeight, 0.8f, 1.1f), minDim, maxDim); } private static float ClampToMeasuredRange(float value, float measured, float minFactor, float maxFactor) { if (float.IsNaN(measured) || float.IsInfinity(measured) || measured <= 0f) { return value; } float num = measured * minFactor; float num2 = Mathf.Max(num, measured * maxFactor); return Mathf.Clamp(value, num, num2); } private static float ClampToBodyFraction(float value, float bodyDimension, float minFactor, float maxFactor) { if (float.IsNaN(bodyDimension) || float.IsInfinity(bodyDimension) || bodyDimension <= 0f) { return value; } float num = bodyDimension * minFactor; float num2 = Mathf.Max(num, bodyDimension * maxFactor); return Mathf.Clamp(value, num, num2); } private static float ClampDimension(float value, float minDim, float maxDim) { float num = SafeMinDimension(minDim); if (float.IsNaN(value) || float.IsInfinity(value)) { return num; } value = Mathf.Max(num, value); return (maxDim > num) ? Mathf.Min(value, maxDim) : value; } private static float SafeMinDimension(float value) { if (float.IsNaN(value) || float.IsInfinity(value)) { return 0.01f; } return Mathf.Max(0.01f, value); } private static float SafePositiveDimension(float value) { if (float.IsNaN(value) || float.IsInfinity(value)) { return 0.01f; } return Mathf.Max(0.01f, value); } private void ApplyLocalHeadRiderBodySuppression() { CollisionPlayerState localPlayer = LocalPlayer; if (localPlayer == null || (Object)(object)localPlayer.Root == (Object)null || !localPlayer.HasBounds) { return; } float num = Time.time + 0.35f; foreach (CollisionPlayerState value in _states.Values) { if (!value.IsLocal && !((Object)(object)value.Root == (Object)null) && value.HasBounds && value.IsSameMapAsLocal && value.IsNearLocalPlayer && IsStandingOnHeadPlatform(localPlayer, value)) { value.SuppressSolidBodyUntil = Mathf.Max(value.SuppressSolidBodyUntil, num); } } } internal bool TryGetLocalPoseState(out bool isLowered, out bool isSitting, out bool isEmoting) { isLowered = false; isSitting = false; isEmoting = false; CollisionPlayerState localPlayer = LocalPlayer; if (localPlayer == null || (Object)(object)localPlayer.Player == (Object)null) { return false; } ReadPoseState(localPlayer, out isLowered, out isSitting, out isEmoting); return true; } private static bool IsStaticLoweredPose(CollisionPlayerState state) { ReadPoseState(state, out var isLowered, out var _, out var _); return isLowered; } private static void ReadPoseState(CollisionPlayerState state, out bool isLowered, out bool isSitting, out bool isEmoting) { isSitting = IsPlayerSitting(state); bool flag = IsMovementLocked(state); bool flag2 = !state.IsActivePlayer(); isLowered = isSitting || flag || flag2; isEmoting = isLowered && !isSitting; } private static bool IsPlayerSitting(CollisionPlayerState state) { try { object obj = PlayerIsSittingField?.GetValue(state.Player); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return false; } } private static bool IsMovementLocked(CollisionPlayerState state) { try { PlayerMove pMove = state.Player._pMove; if ((Object)(object)pMove == (Object)null || MovementLockTypeField == null) { return false; } string a = MovementLockTypeField.GetValue(pMove)?.ToString() ?? string.Empty; return !string.Equals(a, "NONE", StringComparison.Ordinal); } catch { return false; } } private static bool IsUsableScale(float value) { return !float.IsNaN(value) && !float.IsInfinity(value) && value > 0f && value < 1000f; } internal bool TryRemoveHeadRider(string query, out string message) { message = string.Empty; CollisionPlayerState localPlayer = LocalPlayer; if (localPlayer == null || (Object)(object)localPlayer.Root == (Object)null || !localPlayer.HasBounds) { message = "Your head box is not ready yet. Try again after players finish loading."; return false; } List list = new List(); foreach (CollisionPlayerState value in _states.Values) { if (!value.IsLocal && !((Object)(object)value.Root == (Object)null) && value.HasBounds && IsStandingOnHeadPlatform(localPlayer, value)) { list.Add(value); } } if (string.IsNullOrWhiteSpace(query)) { message = ((list.Count == 0) ? "Nobody is detected on your head box." : ("Detected on your head box: " + JoinPlayerNames(list) + ". Use /remove .")); return false; } CollisionPlayerState collisionPlayerState = FindPlayerByName(list, query); if (collisionPlayerState == null) { CollisionPlayerState collisionPlayerState2 = FindPlayerByNameInRegistry(query); message = ((collisionPlayerState2 == null) ? ("No detected head-box rider matched '" + query + "'. Use /remove to list detected riders.") : (collisionPlayerState2.DisplayName + " was found, but is not detected on your head box.")); return false; } string detail; bool flag = CollisionNetworkBridge.TrySendRemoveRequest(localPlayer, collisionPlayerState, out detail); EjectHeadRider(localPlayer, collisionPlayerState); message = (flag ? ("Removed " + collisionPlayerState.DisplayName + " locally and sent a CodeYapper remove request to their client.") : ("Removed " + collisionPlayerState.DisplayName + " locally. " + detail + " Remote removal requires the rider to run a compatible CodeYapper build.")); return true; } internal bool TryHonorRemoteRemoveRequest(string carrierSteamId, out string reason) { reason = string.Empty; CollisionPlayerState localPlayer = LocalPlayer; if (localPlayer == null || (Object)(object)localPlayer.Root == (Object)null || !localPlayer.HasBounds) { reason = "localNotReady"; return false; } CollisionPlayerState collisionPlayerState = FindPlayerBySteamId(carrierSteamId); if (collisionPlayerState == null || (Object)(object)collisionPlayerState.Root == (Object)null || !collisionPlayerState.HasBounds) { reason = "carrierNotFound"; return false; } bool flag = localPlayer.AnchoredToInstanceId == collisionPlayerState.InstanceId; bool flag2 = IsStandingOnHeadPlatform(collisionPlayerState, localPlayer); if (!flag && !flag2) { reason = "notOnCarrierHead"; return false; } EjectHeadRider(collisionPlayerState, localPlayer); reason = "removed"; return true; } internal static bool IsStandingOnHeadPlatform(CollisionPlayerState carrier, CollisionPlayerState rider) { bool feetNearPlatform; bool rootNearPlatform; return TryGetHeadPlatformContact(carrier, rider, out feetNearPlatform, out rootNearPlatform) && (feetNearPlatform || rootNearPlatform); } internal static bool TryGetHeadPlatformContact(CollisionPlayerState carrier, CollisionPlayerState rider, out bool feetNearPlatform, out bool rootNearPlatform) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) feetNearPlatform = false; rootNearPlatform = false; if ((Object)(object)carrier.Root == (Object)null || (Object)(object)rider.Root == (Object)null) { return false; } if (!carrier.HasBounds || !rider.HasBounds) { return false; } Bounds bounds = rider.Bounds; float y = ((Bounds)(ref bounds)).min.y; Transform root = carrier.Root; bounds = rider.Bounds; Vector3 val = root.InverseTransformPoint(((Bounds)(ref bounds)).center); Vector3 platformLocalCenter = carrier.PlatformLocalCenter; float num = Mathf.Max(0.05f, carrier.HeadBoxWidth * 0.5f); float num2 = Mathf.Max(0.05f, carrier.HeadBoxDepth * 0.5f); bounds = rider.Bounds; float num3 = Mathf.Max(0.05f, ((Bounds)(ref bounds)).extents.x); bounds = rider.Bounds; float num4 = Mathf.Max(0.05f, ((Bounds)(ref bounds)).extents.z); float num5 = platformLocalCenter.x - num; float num6 = platformLocalCenter.x + num; float num7 = platformLocalCenter.z - num2; float num8 = platformLocalCenter.z + num2; float headBoxTopY = carrier.HeadBoxTopY; if (!(val.x + num3 > num5 - 0.2f) || !(val.x - num3 < num6 + 0.2f) || !(val.z + num4 > num7 - 0.2f) || !(val.z - num4 < num8 + 0.2f)) { return false; } float num9 = y - headBoxTopY; float num10 = rider.Root.position.y - headBoxTopY; feetNearPlatform = num9 > -0.65f && num9 < 0.45f; rootNearPlatform = num10 > -0.35f && num10 < Mathf.Max(1.25f, rider.BoxHeight + 0.6f); return true; } private static CollisionPlayerState? FindPlayerByName(List players, string query) { string value = query.Trim(); CollisionPlayerState collisionPlayerState = null; CollisionPlayerState collisionPlayerState2 = null; foreach (CollisionPlayerState player in players) { string text = player.DisplayName ?? string.Empty; if (text.Equals(value, StringComparison.OrdinalIgnoreCase)) { return player; } if (text.StartsWith(value, StringComparison.OrdinalIgnoreCase) && collisionPlayerState == null) { collisionPlayerState = player; } else if (text.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0 && collisionPlayerState2 == null) { collisionPlayerState2 = player; } } return collisionPlayerState ?? collisionPlayerState2; } private CollisionPlayerState? FindPlayerByNameInRegistry(string query) { string value = query.Trim(); CollisionPlayerState collisionPlayerState = null; CollisionPlayerState collisionPlayerState2 = null; foreach (CollisionPlayerState value2 in _states.Values) { if (!value2.IsLocal) { string text = value2.DisplayName ?? string.Empty; if (text.Equals(value, StringComparison.OrdinalIgnoreCase)) { return value2; } if (text.StartsWith(value, StringComparison.OrdinalIgnoreCase) && collisionPlayerState == null) { collisionPlayerState = value2; } else if (text.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0 && collisionPlayerState2 == null) { collisionPlayerState2 = value2; } } } return collisionPlayerState ?? collisionPlayerState2; } private CollisionPlayerState? FindPlayerBySteamId(string steamId) { if (string.IsNullOrWhiteSpace(steamId) || steamId == "0") { return null; } foreach (CollisionPlayerState value in _states.Values) { if (string.Equals(value.SteamId, steamId, StringComparison.Ordinal)) { return value; } } return null; } private static void EjectHeadRider(CollisionPlayerState local, CollisionPlayerState rider) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_0107: Unknown result type (might be due to invalid IL or missing references) Vector3 platformWorldCenter = local.PlatformWorldCenter; Vector3 val = rider.Root.position - platformWorldCenter; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = local.Root.forward; val.y = 0f; } if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); float num = Mathf.Max(local.HeadBoxWidth, local.HeadBoxDepth) * 0.5f; float num2 = Mathf.Max(rider.BoxWidth, rider.BoxDepth) * 0.5f; float num3 = Mathf.Max(1f, num + num2 + 0.8f); Vector3 position = platformWorldCenter + val * num3; float num4 = local.HeadBoxTopY + 0.2f - rider.BottomOffsetY; position.y = Mathf.Max(rider.Root.position.y, num4); try { rider.Root.position = position; } catch { } rider.StandingOnInstanceId = 0; rider.StandingOnUntil = 0f; rider.AnchoredToInstanceId = 0; rider.AnchorOffsetLocal = Vector3.zero; rider.AnchorHeightOffset = 0f; rider.AnchorCarrierRotation = Quaternion.identity; rider.HasAnchorCarrierRotation = false; rider.LastAnchorCarrierHeadTopY = 0f; rider.LastAnchorRiderRootY = 0f; rider.HasAnchorSample = false; rider.SuppressSolidBodyUntil = 0f; rider.IgnoreCollisionUntil = Mathf.Max(rider.IgnoreCollisionUntil, Time.time + 1.25f); } private static string JoinPlayerNames(List players) { if (players.Count == 0) { return string.Empty; } string text = players[0].DisplayName; for (int i = 1; i < players.Count; i++) { text = text + ", " + players[i].DisplayName; } return text; } internal CollisionPlayerState? TryGetByInstanceId(int instanceId) { if (_states.TryGetValue(instanceId, out CollisionPlayerState value)) { return value; } return null; } private static bool IsWithinRange(CollisionPlayerState state, Player? local, float range) { if (range <= 0f) { return true; } float num = HorizontalDistanceToLocal(state, local); return num <= range; } private static float HorizontalDistanceToLocal(CollisionPlayerState state, Player? local) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0081: 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) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)state.Root == (Object)null || (Object)(object)local == (Object)null || (Object)(object)((Component)local).transform == (Object)null) { return float.PositiveInfinity; } Vector3 position = ((Component)local).transform.position; Vector3 val = state.Root.position; if (state.HasBounds) { Bounds bounds = state.Bounds; val = ((Bounds)(ref bounds)).ClosestPoint(position); } float num = val.x - position.x; float num2 = val.z - position.z; return Mathf.Sqrt(num * num + num2 * num2); } private static bool IsLocalPlayer(Player player) { try { return ((NetworkBehaviour)player).isLocalPlayer; } catch { return player == Player._mainPlayer; } } public void Dispose() { foreach (CollisionPlayerState value in _states.Values) { value.Body?.Destroy(); } _states.Clear(); _nextRendererRecache.Clear(); } } internal sealed class CollisionPlayerState { internal Player Player { get; } internal Transform Root { get; } internal int InstanceId { get; } internal string SteamId { get; set; } = "0"; internal string DisplayName { get; set; } = "Player"; internal float NextIdentityRefreshTime { get; set; } internal bool IsLocal { get; set; } internal bool CollisionEnabled { get; set; } = true; internal float IgnoreCollisionUntil { get; set; } internal CollisionBody? Body { get; set; } internal bool IsNearLocalPlayer { get; set; } = true; internal bool IsWithinRenderDistance { get; set; } = true; internal bool IsRenderCapSelected { get; set; } = true; internal float DistanceToLocalPlayer { get; set; } internal bool ShouldRenderDebug { get; set; } = true; internal bool IsSameMapAsLocal { get; set; } = true; internal bool IsTinyDisabled { get; set; } internal bool ExpectsSolidBody { get; set; } internal bool ExpectsPlatform { get; set; } internal bool BodyObjectActive { get; set; } internal bool SolidBodyActive { get; set; } internal bool PlatformActive { get; set; } internal bool WireVisible { get; set; } internal string LastHideReason { get; set; } = "none"; internal float LastShapeUpdateTime { get; set; } internal float SuppressSolidBodyUntil { get; set; } internal bool IsWhitelisted { get; set; } = true; internal bool IsLocalWhitelisted { get; set; } = true; internal bool IsRemoteWhitelisted { get; set; } = true; internal bool HasRemoteWhitelistPolicy { get; set; } internal Vector2 EffectiveScale { get; set; } = Vector2.one; internal float TinyScale { get; set; } = 1f; internal Renderer[] CachedRenderers { get; set; } = Array.Empty(); internal Transform? CachedHeadTransform { get; set; } internal float NextPoseMeasureTime { get; set; } internal bool HasPoseTarget { get; set; } internal Vector2 CachedTransformScale { get; set; } = Vector2.one; internal string BoxSizingMode { get; set; } = "static"; internal string MeasurementMode { get; set; } = "static"; internal bool ChestBoxActive { get; set; } internal bool StaticPoseLowered { get; set; } internal string StaticPoseBucket { get; set; } = "standing"; internal bool HasRemotePoseState { get; set; } internal bool RemotePoseLowered { get; set; } internal bool RemotePoseSitting { get; set; } internal bool RemotePoseEmoting { get; set; } internal float StaticDynamicMeasureUntil { get; set; } internal float NextStaticDynamicRefreshTime { get; set; } internal float NextStaticPoseProbeTime { get; set; } internal float NextStaticScaleCheckTime { get; set; } internal bool HasStaticVisualPoseSample { get; set; } internal float StaticVisualPoseTopY { get; set; } internal float StaticVisualPoseCenterY { get; set; } internal float StaticVisualPoseHeight { get; set; } internal float TargetBoxWidth { get; set; } internal float TargetBoxDepth { get; set; } internal float TargetBoxHeight { get; set; } internal float TargetCenterY { get; set; } internal float TargetBottomOffsetY { get; set; } internal float TargetTopOffsetY { get; set; } internal float TargetHeadBoxWidth { get; set; } internal float TargetHeadBoxDepth { get; set; } internal float TargetHeadBoxThickness { get; set; } internal float TargetHeadBoxCenterY { get; set; } internal float TargetHeadBoxTopOffsetY { get; set; } internal Vector3 TargetPlatformLocalCenter { get; set; } internal Bounds Bounds { get; set; } internal bool HasBounds { get; set; } internal float BoxWidth { get; set; } internal float BoxDepth { get; set; } internal float BoxHeight { get; set; } internal float CenterY { get; set; } internal float BottomOffsetY { get; set; } internal float TopOffsetY { get; set; } internal float HeadBoxWidth { get; set; } internal float HeadBoxDepth { get; set; } internal float HeadBoxThickness { get; set; } internal float HeadBoxCenterY { get; set; } internal float HeadBoxTopOffsetY { get; set; } internal Vector3 PlatformLocalCenter { get; set; } internal int AnchoredToInstanceId { get; set; } internal Vector3 AnchorOffsetLocal { get; set; } internal float AnchorHeightOffset { get; set; } internal Quaternion AnchorCarrierRotation { get; set; } = Quaternion.identity; internal bool HasAnchorCarrierRotation { get; set; } internal float LastAnchorCarrierHeadTopY { get; set; } internal float LastAnchorRiderRootY { get; set; } internal float AnchorPoseSlackUntil { get; set; } internal bool HasAnchorSample { get; set; } internal int StandingOnInstanceId { get; set; } internal float StandingOnUntil { get; set; } internal bool IsInGracePeriod => Time.time < IgnoreCollisionUntil; internal bool IsStandingOnPlatform => StandingOnInstanceId != 0 && Time.time <= StandingOnUntil; internal bool ShouldSuppressSolidBody => Time.time <= SuppressSolidBodyUntil; internal float BottomY { get { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0023: Unknown result type (might be due to invalid IL or missing references) float result; if (!HasBounds) { result = (((Object)(object)Root != (Object)null) ? Root.position.y : 0f); } else { Bounds bounds = Bounds; result = ((Bounds)(ref bounds)).min.y; } return result; } } internal float TopY { get { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) float result; if (!HasBounds) { result = (((Object)(object)Root != (Object)null) ? (Root.position.y + 1.85f) : 0f); } else { Bounds bounds = Bounds; result = ((Bounds)(ref bounds)).max.y; } return result; } } internal Vector3 PlatformWorldCenter => ((Object)(object)Root != (Object)null) ? Root.TransformPoint(PlatformLocalCenter) : Vector3.zero; internal float HeadBoxTopY => ((Object)(object)Root != (Object)null) ? (PlatformWorldCenter.y + HeadBoxThickness * 0.5f) : TopY; internal float HeadBoxBottomY => ((Object)(object)Root != (Object)null) ? (PlatformWorldCenter.y - HeadBoxThickness * 0.5f) : TopY; internal Vector3 CenterXZ { get { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) ? result; if (!HasBounds) { result = (((Object)(object)Root != (Object)null) ? new Vector3(Root.position.x, 0f, Root.position.z) : Vector3.zero); } else { Bounds bounds = Bounds; float x = ((Bounds)(ref bounds)).center.x; bounds = Bounds; result = new Vector3(x, 0f, ((Bounds)(ref bounds)).center.z); } return (Vector3)result; } } internal CollisionPlayerState(Player player) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) Player = player; Root = ((Component)player).transform; InstanceId = ((Object)player).GetInstanceID(); } internal bool IsActivePlayer() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 try { return (Object)(object)Player != (Object)null && (int)Player.Network_currentPlayerCondition == 2; } catch { return (Object)(object)Player != (Object)null; } } } internal static class PlayerIdentity { private const float ScaleSanityLimit = 1000f; private const float BoundsSizeSanityLimit = 1000f; private const float BoundsCenterMinimumSanityLimit = 30f; private static Mesh? _bakedPoseMesh; private static readonly List BakedVertices = new List(16384); private static readonly string[] AccessoryNameFragments = new string[38] { "tail", "tails", "hair", "ear", "ears", "horn", "horns", "wing", "wings", "antler", "antlers", "mane", "hat", "hood", "cap", "helmet", "crown", "headwear", "headgear", "scarf", "cape", "cloak", "mantle", "weapon", "sword", "shield", "staff", "wand", "bow", "arrow", "axe", "mace", "dagger", "knife", "rod", "pickaxe", "tool", "item" }; private static readonly string[] BodyNameFragments = new string[12] { "body", "torso", "chest", "hip", "hips", "pelvis", "spine", "race", "model", "visual", "avatar", "character" }; private static readonly string[] ChestNameFragments = new string[6] { "boob", "boobs", "breast", "breasts", "chest", "torso" }; internal static string GetSteamId(Player player) { try { string network_steamID = player.Network_steamID; if (!string.IsNullOrWhiteSpace(network_steamID)) { return network_steamID; } } catch { } return "0"; } internal static string GetDisplayName(Player player) { try { string network_nickname = player.Network_nickname; if (!string.IsNullOrWhiteSpace(network_nickname)) { return network_nickname; } } catch { } try { if (typeof(Player).GetField("_nickname", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(player) is string text && !string.IsNullOrWhiteSpace(text)) { return text; } } catch { } return "Player"; } internal static bool IsSameMapAsLocal(Player player, Player? local) { if ((Object)(object)player == (Object)null || (Object)(object)local == (Object)null) { return false; } try { MapInstance network_playerMapInstance = player.Network_playerMapInstance; MapInstance network_playerMapInstance2 = local.Network_playerMapInstance; if ((Object)(object)network_playerMapInstance == (Object)null || (Object)(object)network_playerMapInstance2 == (Object)null) { return false; } return network_playerMapInstance == network_playerMapInstance2; } catch { return true; } } internal static Renderer[] CollectRenderers(Player player) { if ((Object)(object)player == (Object)null) { return Array.Empty(); } Renderer[] componentsInChildren; try { componentsInChildren = ((Component)player).GetComponentsInChildren(true); } catch { return Array.Empty(); } if (componentsInChildren == null || componentsInChildren.Length == 0) { return Array.Empty(); } bool flag = PlayerCollisionPlugin.ModConfig?.IncludeAccessoriesInBounds.Value ?? false; List list = new List(componentsInChildren.Length); List list2 = new List(componentsInChildren.Length); List list3 = new List(componentsInChildren.Length); List list4 = new List(componentsInChildren.Length); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if ((Object)(object)val == (Object)null || !IsSupportedBodyRenderer(val) || (!flag && IsAccessoryRenderer(val))) { continue; } SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((val is SkinnedMeshRenderer) ? val : null); if (val2 != null) { try { val2.updateWhenOffscreen = true; } catch { } } bool flag2 = IsActiveRenderer(val); bool flag3 = IsBodyRenderer(val); if (flag2 && flag3) { list.Add(val); } else if (flag2) { list2.Add(val); } else if (flag3) { list3.Add(val); } else { list4.Add(val); } } if (list.Count > 0) { return list.ToArray(); } if (list2.Count > 0) { return list2.ToArray(); } if (list3.Count > 0) { return list3.ToArray(); } return list4.ToArray(); } internal static Transform? FindHeadTransform(Player player) { //IL_0140: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return null; } try { Transform[] componentsInChildren = ((Component)player).GetComponentsInChildren(true); Transform result = null; int num = int.MinValue; float num2 = float.NegativeInfinity; foreach (Transform val in componentsInChildren) { if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)((Component)player).transform) { continue; } string text = ((Object)val).name.ToLowerInvariant(); int num3 = 0; if (text == "head") { num3 = 120; } else if (text.EndsWith(" head") || text.EndsWith("_head") || text.EndsWith(".head")) { num3 = 110; } else if (text.Contains("head")) { num3 = 90; } else { if (!text.Contains("neck")) { continue; } num3 = 45; } if (NameMatchesAccessory(text)) { num3 -= 25; } if ((Object)(object)((Component)val).GetComponent() != (Object)null) { num3 -= 20; } if ((Object)(object)((Component)val).GetComponent() != (Object)null) { num3 -= 20; } float y = val.position.y; if (num3 > num || (num3 == num && y > num2)) { result = val; num = num3; num2 = y; } } return result; } catch { return null; } } private static bool IsAccessoryRenderer(Renderer r) { string name = ((Object)r).name ?? string.Empty; string name2 = (((Object)(object)((Component)r).gameObject != (Object)null) ? ((Object)((Component)r).gameObject).name : string.Empty); return NameMatchesAccessory(name) || NameMatchesAccessory(name2); } private static bool IsBodyRenderer(Renderer r) { string name = ((Object)r).name ?? string.Empty; string name2 = (((Object)(object)((Component)r).gameObject != (Object)null) ? ((Object)((Component)r).gameObject).name : string.Empty); return NameMatchesAny(name, BodyNameFragments) || NameMatchesAny(name2, BodyNameFragments); } private static bool IsSupportedBodyRenderer(Renderer r) { return r is SkinnedMeshRenderer || r is MeshRenderer; } private static bool IsActiveRenderer(Renderer r) { try { return r.enabled && (Object)(object)((Component)r).gameObject != (Object)null && ((Component)r).gameObject.activeInHierarchy; } catch { return false; } } internal static Vector2 EstimateBodyScale(Player player) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return Vector2.one; } float bestH = 1f; float bestV = 1f; try { Transform val = ((Component)player).transform; int num = 0; while ((Object)(object)val != (Object)null && num < 5) { Vector3 localScale = val.localScale; Consider(Mathf.Max(Mathf.Abs(localScale.x), Mathf.Abs(localScale.z)), Mathf.Abs(localScale.y)); val = val.parent; num++; } } catch { } try { string[] array = new string[5] { "_raceModelContainer", "_raceModelObject", "_playerRaceModel", "_pVisual", "_visualContainer" }; Type type = ((object)player).GetType(); string[] array2 = array; foreach (string name in array2) { FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { continue; } object value = field.GetValue(player); Transform val2 = (Transform)((value is Transform) ? value : null); if ((Object)(object)val2 == (Object)null) { GameObject val3 = (GameObject)((value is GameObject) ? value : null); if (val3 != null) { val2 = val3.transform; } } if ((Object)(object)val2 == (Object)null) { Component val4 = (Component)((value is Component) ? value : null); if (val4 != null) { val2 = val4.transform; } } if (!((Object)(object)val2 == (Object)null)) { Vector3 localScale2 = val2.localScale; Consider(Mathf.Max(Mathf.Abs(localScale2.x), Mathf.Abs(localScale2.z)), Mathf.Abs(localScale2.y)); } } } catch { } try { Transform[] componentsInChildren = ((Component)player).GetComponentsInChildren(true); foreach (Transform val5 in componentsInChildren) { if (!((Object)(object)val5 == (Object)null) && !((Object)(object)val5 == (Object)(object)((Component)player).transform)) { string text = ((Object)val5).name.ToLowerInvariant(); if ((text.Contains("race") || text.Contains("model") || text.Contains("visual") || text.Contains("scale") || text.Contains("container")) && !((Object)(object)((Component)val5).GetComponent() != (Object)null) && !((Object)(object)((Component)val5).GetComponent() != (Object)null)) { Vector3 localScale3 = val5.localScale; Consider(Mathf.Max(Mathf.Abs(localScale3.x), Mathf.Abs(localScale3.z)), Mathf.Abs(localScale3.y)); } } } } catch { } return new Vector2(bestH, bestV); void Consider(float h, float v) { if (IsUsableScale(h) && Mathf.Abs(h - 1f) > Mathf.Abs(bestH - 1f)) { bestH = Mathf.Abs(h); } if (IsUsableScale(v) && Mathf.Abs(v - 1f) > Mathf.Abs(bestV - 1f)) { bestV = Mathf.Abs(v); } } } internal static float EstimateTinyVisibleScale(Player player) { //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return 1f; } float minScale = 1f; try { Transform val = ((Component)player).transform; int num = 0; while ((Object)(object)val != (Object)null && num < 5) { Consider(val.localScale.y); val = val.parent; num++; } } catch { } try { string[] array = new string[5] { "_raceModelContainer", "_raceModelObject", "_playerRaceModel", "_pVisual", "_visualContainer" }; Type type = ((object)player).GetType(); string[] array2 = array; foreach (string name in array2) { FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { continue; } object value2 = field.GetValue(player); Transform val2 = (Transform)((value2 is Transform) ? value2 : null); if ((Object)(object)val2 == (Object)null) { GameObject val3 = (GameObject)((value2 is GameObject) ? value2 : null); if (val3 != null) { val2 = val3.transform; } } if ((Object)(object)val2 == (Object)null) { Component val4 = (Component)((value2 is Component) ? value2 : null); if (val4 != null) { val2 = val4.transform; } } if (!((Object)(object)val2 == (Object)null)) { Consider(val2.localScale.y); } } } catch { } try { Transform[] componentsInChildren = ((Component)player).GetComponentsInChildren(true); foreach (Transform val5 in componentsInChildren) { if (!((Object)(object)val5 == (Object)null) && !((Object)(object)val5 == (Object)(object)((Component)player).transform)) { string text = ((Object)val5).name.ToLowerInvariant(); if ((text.Contains("race") || text.Contains("model") || text.Contains("visual") || text.Contains("body") || text.Contains("scale") || text.Contains("container")) && !((Object)(object)((Component)val5).GetComponent() != (Object)null) && !((Object)(object)((Component)val5).GetComponent() != (Object)null)) { Consider(val5.localScale.y); } } } } catch { } try { SkinnedMeshRenderer[] componentsInChildren2 = ((Component)player).GetComponentsInChildren(true); foreach (SkinnedMeshRenderer val6 in componentsInChildren2) { if (!((Object)(object)val6 == (Object)null)) { float num2 = Mathf.Abs(((Component)val6).transform.lossyScale.y); if (!(num2 <= 0f)) { Consider(num2 / 0.011f); } } } } catch { } return minScale; void Consider(float value) { float num3 = Mathf.Abs(value); if (!(num3 <= 0f) && !float.IsNaN(num3) && !float.IsInfinity(num3) && !(num3 >= minScale)) { minScale = num3; } } } private static bool IsUsableScale(float v) { return !float.IsNaN(v) && !float.IsInfinity(v) && Mathf.Abs(v) > 0.01f && Mathf.Abs(v) < 1000f; } private static Bounds Encapsulate(Bounds a, Bounds b) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) ((Bounds)(ref a)).Encapsulate(b); return a; } internal static bool TryGetBodyMeshBounds(Renderer[] renderers, Transform root, out Bounds bounds) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) bounds = default(Bounds); if (renderers == null || renderers.Length == 0 || (Object)(object)root == (Object)null) { return false; } try { Bounds? val = null; bool flag = PlayerCollisionPlugin.ModConfig?.IncludeAccessoriesInBounds.Value ?? false; bool flag2 = PlayerCollisionPlugin.ModConfig?.UseBakedPoseBounds.Value ?? false; foreach (Renderer val2 in renderers) { if ((Object)(object)val2 == (Object)null || !IsSupportedBodyRenderer(val2) || !IsActiveRenderer(val2) || (!flag && IsAccessoryRenderer(val2))) { continue; } SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((val2 is SkinnedMeshRenderer) ? val2 : null); if ((Object)(object)val3 != (Object)null && (Object)(object)val3.sharedMesh == (Object)null) { continue; } if ((Object)(object)val3 != (Object)null) { try { val3.updateWhenOffscreen = true; } catch { } } Bounds bounds2 = default(Bounds); if (((Object)(object)val3 != (Object)null && flag2 && TryGetRootAlignedSkinnedBounds(val3, root, out bounds2)) || TryGetRootAlignedRendererBounds(val2.bounds, root, out bounds2)) { val = (val.HasValue ? Encapsulate(val.Value, bounds2) : bounds2); } } if (!val.HasValue) { return false; } bounds = val.Value; return IsUsableRootAlignedBounds(bounds); } catch { return false; } } private static bool TryGetRootAlignedSkinnedBounds(SkinnedMeshRenderer renderer, Transform root, out Bounds bounds) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0073: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) bounds = default(Bounds); try { object obj = _bakedPoseMesh; if (obj == null) { Mesh val = new Mesh { name = "AtlyssPlayerCollision_BakedBodyMesh" }; _bakedPoseMesh = val; obj = (object)val; } Mesh val2 = (Mesh)obj; val2.Clear(); renderer.BakeMesh(val2); BakedVertices.Clear(); val2.GetVertices(BakedVertices); if (BakedVertices.Count == 0) { return false; } Transform transform = ((Component)renderer).transform; Quaternion inverseRootRotation = Quaternion.Inverse(root.rotation); Vector3 position = root.position; Vector3 val3 = ToRootAlignedWorldMeters(transform.TransformPoint(BakedVertices[0]), inverseRootRotation, position); Bounds val4 = default(Bounds); ((Bounds)(ref val4))..ctor(val3, Vector3.zero); for (int i = 1; i < BakedVertices.Count; i++) { Vector3 val5 = ToRootAlignedWorldMeters(transform.TransformPoint(BakedVertices[i]), inverseRootRotation, position); ((Bounds)(ref val4)).Encapsulate(val5); } if (!IsUsableRootAlignedBounds(val4)) { return false; } bounds = val4; return true; } catch { return false; } } private static bool TryGetRootAlignedRendererBounds(Bounds worldBounds, Transform root, out Bounds bounds) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) bounds = default(Bounds); try { Vector3 min = ((Bounds)(ref worldBounds)).min; Vector3 max = ((Bounds)(ref worldBounds)).max; Quaternion inverseRootRotation = Quaternion.Inverse(root.rotation); Vector3 position = root.position; Bounds bounds2 = default(Bounds); ((Bounds)(ref bounds2))..ctor(ToRootAlignedWorldMeters(new Vector3(min.x, min.y, min.z), inverseRootRotation, position), Vector3.zero); EncapsulateRootAlignedCorner(ref bounds2, max.x, min.y, min.z, inverseRootRotation, position); EncapsulateRootAlignedCorner(ref bounds2, min.x, min.y, max.z, inverseRootRotation, position); EncapsulateRootAlignedCorner(ref bounds2, max.x, min.y, max.z, inverseRootRotation, position); EncapsulateRootAlignedCorner(ref bounds2, min.x, max.y, min.z, inverseRootRotation, position); EncapsulateRootAlignedCorner(ref bounds2, max.x, max.y, min.z, inverseRootRotation, position); EncapsulateRootAlignedCorner(ref bounds2, min.x, max.y, max.z, inverseRootRotation, position); EncapsulateRootAlignedCorner(ref bounds2, max.x, max.y, max.z, inverseRootRotation, position); if (!IsUsableRootAlignedBounds(bounds2)) { return false; } bounds = bounds2; return true; } catch { return false; } } private static void EncapsulateRootAlignedCorner(ref Bounds bounds, float x, float y, float z, Quaternion inverseRootRotation, Vector3 rootPosition) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) ((Bounds)(ref bounds)).Encapsulate(ToRootAlignedWorldMeters(new Vector3(x, y, z), inverseRootRotation, rootPosition)); } private static Vector3 ToRootAlignedWorldMeters(Vector3 worldPoint, Quaternion inverseRootRotation, Vector3 rootPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return inverseRootRotation * (worldPoint - rootPosition); } private static bool IsUsableRootAlignedBounds(Bounds bounds) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) Vector3 size = ((Bounds)(ref bounds)).size; if (size.x < 0.03f || size.y < 0.05f || size.z < 0.03f) { return false; } if (!IsFiniteSize(size) || MaxComponent(size) > 1000f) { return false; } Vector3 center = ((Bounds)(ref bounds)).center; if (!IsFiniteVector(center)) { return false; } float num = CenterSanityLimit(size); Vector2 val = new Vector2(center.x, center.z); if (((Vector2)(ref val)).magnitude > num) { return false; } return Mathf.Abs(center.y) <= num; } internal static bool TryGetVisualDimensions(Player player, out float width, out float depth, out float height, out float centerY, out float bottomY, out float topY) { //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) width = (depth = (height = (centerY = (bottomY = (topY = 0f))))); if ((Object)(object)player == (Object)null) { return false; } try { Renderer[] componentsInChildren = ((Component)player).GetComponentsInChildren(true); bool flag = PlayerCollisionPlugin.ModConfig?.IncludeAccessoriesInBounds.Value ?? false; Vector3 position = ((Component)player).transform.position; Bounds? val = null; Renderer[] array = componentsInChildren; foreach (Renderer val2 in array) { if ((Object)(object)val2 == (Object)null || !val2.enabled || !IsSupportedBodyRenderer(val2) || !IsActiveRenderer(val2) || (!flag && IsAccessoryRenderer(val2))) { continue; } SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((val2 is SkinnedMeshRenderer) ? val2 : null); if (val3 != null) { try { val3.updateWhenOffscreen = true; } catch { } } Bounds bounds = val2.bounds; if (!(((Bounds)(ref bounds)).size.y <= 0f) && IsFiniteSize(((Bounds)(ref bounds)).size) && !(MaxComponent(((Bounds)(ref bounds)).size) > 1000f)) { Vector2 val4 = new Vector2(((Bounds)(ref bounds)).center.x - position.x, ((Bounds)(ref bounds)).center.z - position.z); float magnitude = ((Vector2)(ref val4)).magnitude; float num = CenterSanityLimit(((Bounds)(ref bounds)).size); if (!(magnitude > num) && !(Mathf.Abs(((Bounds)(ref bounds)).center.y - position.y) > num)) { val = (val.HasValue ? Encapsulate(val.Value, bounds) : bounds); } } } if (!val.HasValue) { return false; } Bounds value = val.Value; width = ((Bounds)(ref value)).size.x; depth = ((Bounds)(ref value)).size.z; height = ((Bounds)(ref value)).size.y; centerY = ((Bounds)(ref value)).center.y - position.y; bottomY = ((Bounds)(ref value)).min.y - position.y; topY = ((Bounds)(ref value)).max.y - position.y; if (width < 0.05f || depth < 0.05f || height < 0.2f) { return false; } if (MaxComponent(new Vector3(width, height, depth)) > 1000f) { return false; } return true; } catch { return false; } } internal static bool TryGetChestMeshBounds(Player player, Transform root, out Bounds bounds) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) bounds = default(Bounds); if ((Object)(object)player == (Object)null || (Object)(object)root == (Object)null) { return false; } List list = new List(4); TryAddChestRenderersFromKnownFields(player, list); if (list.Count == 0) { TryAddNamedChestRenderers(player, list); } if (list.Count == 0) { return false; } return TryGetBodyMeshBounds(list.ToArray(), root, out bounds); } internal static float EstimateChestWeight(Player player) { if ((Object)(object)player == (Object)null) { return 0f; } object source = TryGetFieldValue(player, "_pVisual") ?? TryGetFieldValue(player, "_playerVisual") ?? TryGetFieldValue(player, "_visual"); object source2 = TryGetFieldValue(source, "_playerRaceModel") ?? TryGetFieldValue(source, "_raceModel") ?? TryGetFieldValue(player, "_playerRaceModel"); if ((TryGetFieldValue(source2, "_displayBoobs") ?? TryGetFieldValue(source, "_displayBoobs")) is bool flag && !flag) { return 0f; } object obj = TryGetFieldValue(source2, "_boobWeight") ?? TryGetFieldValue(source, "_boobWeight"); if (obj == null) { return 0f; } try { float num = Convert.ToSingle(obj); if (float.IsNaN(num) || float.IsInfinity(num)) { return 0f; } return Mathf.Clamp(num, 0f, 3f); } catch { return 0f; } } private static void TryAddChestRenderersFromKnownFields(Player player, List renderers) { object obj = TryGetFieldValue(player, "_pVisual") ?? TryGetFieldValue(player, "_playerVisual") ?? TryGetFieldValue(player, "_visual"); if (obj != null) { object source = TryGetFieldValue(obj, "_playerRaceModel") ?? TryGetFieldValue(obj, "_raceModel"); object source2 = TryGetFieldValue(obj, "_raceModelED") ?? TryGetFieldValue(source, "_raceModelED"); TryAddRendererFromField(source, "_baseBoobMesh", renderers); TryAddRendererFromField(source2, "_armorBoobMesh", renderers); TryAddRendererFromField(source2, "_chestPieceMeshRender", renderers); TryAddRendererFromField(source2, "_chestPieceHipMeshRender", renderers); } } private static object? TryGetFieldValue(object? source, string fieldName) { if (source == null) { return null; } try { return source.GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(source); } catch { return null; } } private static void TryAddRendererFromField(object? source, string fieldName, List renderers) { object obj = TryGetFieldValue(source, fieldName); Renderer val = (Renderer)((obj is Renderer) ? obj : null); if ((Object)(object)val == (Object)null) { Component val2 = (Component)((obj is Component) ? obj : null); if (val2 != null) { try { val = val2.GetComponent(); } catch { } } } if (!((Object)(object)val == (Object)null) && IsActiveRenderer(val) && (NameMatchesChest(((Object)val).name ?? string.Empty) || !((Object)(object)((Component)val).gameObject != (Object)null) || NameMatchesChest(((Object)((Component)val).gameObject).name ?? string.Empty))) { AddUniqueRenderer(renderers, val); } } private static void TryAddNamedChestRenderers(Player player, List renderers) { try { Renderer[] componentsInChildren = ((Component)player).GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && IsSupportedBodyRenderer(val) && IsActiveRenderer(val)) { string name = ((Object)val).name ?? string.Empty; string name2 = (((Object)(object)((Component)val).gameObject != (Object)null) ? ((Object)((Component)val).gameObject).name : string.Empty); if (NameMatchesChest(name) || NameMatchesChest(name2)) { AddUniqueRenderer(renderers, val); } } } } catch { } } private static void AddUniqueRenderer(List renderers, Renderer renderer) { for (int i = 0; i < renderers.Count; i++) { if (renderers[i] == renderer) { return; } } renderers.Add(renderer); } private static bool NameMatchesChest(string name) { return NameMatchesAny(name, ChestNameFragments); } internal static bool TryGetCapsuleBounds(Player player, out Bounds bounds) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) bounds = default(Bounds); if ((Object)(object)player == (Object)null) { return false; } CharacterController val = null; try { PlayerMove pMove = player._pMove; if ((Object)(object)pMove != (Object)null) { val = pMove._playerController; } } catch { } if ((Object)(object)val == (Object)null) { try { val = ((Component)player).GetComponent(); } catch { } } if ((Object)(object)val == (Object)null) { return false; } Transform transform; try { transform = ((Component)player).transform; } catch { return false; } if ((Object)(object)transform == (Object)null) { return false; } Vector3 lossyScale = transform.lossyScale; float num = Mathf.Max(0.01f, Mathf.Max(Mathf.Abs(lossyScale.x), Mathf.Abs(lossyScale.z))); float num2 = Mathf.Max(0.01f, Mathf.Abs(lossyScale.y)); float num3 = val.radius * num; float num4 = val.height * num2; Vector3 val2; try { val2 = transform.TransformPoint(val.center); } catch { val2 = transform.position; } bounds = new Bounds(val2, new Vector3(num3 * 2f, num4, num3 * 2f)); return true; } private static bool NameMatchesAccessory(string name) { return NameMatchesAny(name, AccessoryNameFragments); } private static bool NameMatchesAny(string name, string[] fragments) { if (string.IsNullOrEmpty(name)) { return false; } string lower = name.ToLowerInvariant(); foreach (string fragment in fragments) { if (NameContainsFragment(lower, fragment)) { return true; } } return false; } private static bool NameContainsFragment(string lower, string fragment) { if (string.IsNullOrEmpty(fragment)) { return false; } for (int num = lower.IndexOf(fragment, StringComparison.Ordinal); num >= 0; num = lower.IndexOf(fragment, num + 1, StringComparison.Ordinal)) { bool flag = num == 0 || !char.IsLetterOrDigit(lower[num - 1]); int num2 = num + fragment.Length; bool flag2 = num2 >= lower.Length || !char.IsLetterOrDigit(lower[num2]); if (fragment.Length <= 3) { if (flag && flag2) { return true; } } else if (flag || flag2 || lower.Length == fragment.Length) { return true; } } return false; } internal static bool TryGetMeshBounds(Renderer[] renderers, out Bounds bounds) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) //IL_00bc: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) bounds = new Bounds(Vector3.zero, Vector3.zero); if (renderers == null || renderers.Length == 0) { return false; } bool flag = false; foreach (Renderer val in renderers) { if ((Object)(object)val == (Object)null || !val.enabled || !((Component)val).gameObject.activeInHierarchy) { continue; } Bounds bounds2; try { bounds2 = val.bounds; } catch { continue; } Vector3 size = ((Bounds)(ref bounds2)).size; if (!(size.x <= 0f) && !(size.y <= 0f) && !(size.z <= 0f) && IsFiniteSize(size) && !(MaxComponent(size) > 1000f)) { if (!flag) { bounds = bounds2; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(((Bounds)(ref bounds2)).min); ((Bounds)(ref bounds)).Encapsulate(((Bounds)(ref bounds2)).max); } } } return flag; } private static bool IsFiniteSize(Vector3 size) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) return !float.IsNaN(size.x) && !float.IsNaN(size.y) && !float.IsNaN(size.z) && !float.IsInfinity(size.x) && !float.IsInfinity(size.y) && !float.IsInfinity(size.z); } private static bool IsFiniteVector(Vector3 value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) return !float.IsNaN(value.x) && !float.IsNaN(value.y) && !float.IsNaN(value.z) && !float.IsInfinity(value.x) && !float.IsInfinity(value.y) && !float.IsInfinity(value.z); } private static float MaxComponent(Vector3 value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) return Mathf.Max(Mathf.Abs(value.x), Mathf.Max(Mathf.Abs(value.y), Mathf.Abs(value.z))); } private static float CenterSanityLimit(Vector3 size) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return Mathf.Max(30f, MaxComponent(size) * 2f + 10f); } } internal static class PlayerLifecyclePatches { [HarmonyPatch(typeof(Player), "Awake")] [HarmonyPostfix] private static void OnPlayerAwake(Player __instance) { try { PlayerCollisionPlugin.Registry?.AddPlayer(__instance); } catch (Exception ex) { PlayerCollisionPlugin.Log.LogError((object)("[PlayerLifecycle] Awake patch failed: " + ex.Message)); } } } internal static class EasySettingsBinding { private static bool _tabBuilt; internal static void Bind(CollisionConfig config, ConfigFile configFile) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown ConfigFile configFile2 = configFile; CollisionConfig config2 = config; Settings.OnApplySettings.AddListener((UnityAction)delegate { try { configFile2.Save(); } catch { } }); Settings.OnInitialized.AddListener((UnityAction)delegate { BuildTab(config2); }); } private static void BuildTab(CollisionConfig config) { CollisionConfig config2 = config; if (_tabBuilt) { return; } try { SettingsTab tab = Settings.GetOrAddCustomTab("Player Collider"); tab.AddHeader("Player Collider"); tab.AddToggle("Local collision", config2.LocalCollisionEnabled); tab.AddToggle("Mod enabled", config2.ModEnabled); tab.AddToggle("Debug wires", config2.DebugCollidersEnabled); tab.AddHeader("Box mode"); AtlyssToggle val = tab.AddToggle("Static boxes", config2.StaticBoxesEnabled); AtlyssToggle val2 = tab.AddToggle("Dynamic boxes", config2.DynamicBoxesEnabled); val.OnValueChanged.AddListener((UnityAction)delegate(bool enabled) { if (enabled) { config2.DynamicBoxesEnabled.Value = false; } else if (!config2.DynamicBoxesEnabled.Value) { config2.StaticBoxesEnabled.Value = true; } }); val2.OnValueChanged.AddListener((UnityAction)delegate(bool enabled) { if (enabled) { config2.StaticBoxesEnabled.Value = false; } else if (!config2.StaticBoxesEnabled.Value) { config2.StaticBoxesEnabled.Value = true; } }); tab.AddHeader("Stick mode"); tab.AddToggle("Stick to carrier", config2.AnchorRiderToCarrier); tab.AddToggle("Rotate with carrier", config2.AnchorRotateWithCarrier); AtlyssToggle val3 = tab.AddToggle("Emote stick", config2.UnsafeStickEnabled); AtlyssToggle val4 = tab.AddToggle("Old strict stick behavior", config2.StrictStickEnabled); val3.OnValueChanged.AddListener((UnityAction)delegate(bool enabled) { if (enabled) { config2.StrictStickEnabled.Value = false; } else if (!config2.StrictStickEnabled.Value) { config2.UnsafeStickEnabled.Value = true; } }); val4.OnValueChanged.AddListener((UnityAction)delegate(bool enabled) { if (enabled) { config2.UnsafeStickEnabled.Value = false; } else if (!config2.UnsafeStickEnabled.Value) { config2.UnsafeStickEnabled.Value = true; } }); tab.AddHeader("Whitelist (only listed players collide)"); tab.AddToggle("Whitelist mode", config2.WhitelistEnabled); tab.AddHeader("Soft push"); tab.AddAdvancedSlider("Push strength", config2.PushStrength, false); tab.AddAdvancedSlider("Max push", config2.MaxPushPerFrame, false); tab.AddHeader("Performance"); tab.AddToggle("Limit boxes by distance", config2.LimitRenderedBoxesByDistance); tab.AddAdvancedSlider("Box render distance", config2.RenderedBoxDistance, false); AtlyssToggle val5 = tab.AddToggle("Reduce rendered boxes", config2.ReduceRenderedBoxes); AtlyssAdvancedSlider maxRenderedBoxes = tab.AddAdvancedSlider("Max rendered boxes", config2.MaxRenderedBoxes, true); val5.OnValueChanged.AddListener((UnityAction)delegate(bool enabled) { SetSliderRowEnabled(maxRenderedBoxes, enabled); }); SetSliderRowEnabled(maxRenderedBoxes, config2.ReduceRenderedBoxes.Value); AddCollapsedGroup(tab, "Body box", "Show body box", "Hide body box", () => new List { (BaseAtlyssElement)(object)tab.AddToggle("Green body box", config2.SolidRemoteBodyEnabled), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Body width", config2.BodyWidthAdjustment, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Body depth", config2.BodyDepthAdjustment, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Body height", config2.BodyHeightAdjustment, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Base width", config2.BaseBoxWidth, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Base depth", config2.BaseBoxDepth, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Base height", config2.BaseBoxHeight, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Width mult", config2.BoxWidthMultiplier, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Depth mult", config2.BoxDepthMultiplier, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Height mult", config2.BoxHeightMultiplier, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Width padding", config2.WidthPadding, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Height padding", config2.HeightPadding, false) }); AddCollapsedGroup(tab, "Head platform", "Show head platform", "Hide head platform", () => new List { (BaseAtlyssElement)(object)tab.AddToggle("Head platform", config2.StandingPlatformEnabled), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Body/head gap", config2.BodyHeadClearance, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Platform thickness", config2.PlatformThickness, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Head top estimate", config2.HeadBoneTopOffset, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Platform clearance", config2.PlatformTopOffset, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Platform extra width", config2.PlatformExtraWidth, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Platform extra depth", config2.PlatformExtraDepth, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Head width", config2.HeadWidthAdjustment, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Head depth", config2.HeadDepthAdjustment, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Head height", config2.HeadHeightAdjustment, false) }); AddCollapsedGroup(tab, "Chest platform", "Show chest platform", "Hide chest platform", () => new List { (BaseAtlyssElement)(object)tab.AddToggle("Chest box", config2.ChestBoxEnabled), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Chest width", config2.ChestBoxWidthMultiplier, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Chest depth", config2.ChestBoxDepthMultiplier, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Chest thickness", config2.ChestBoxThickness, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Chest height", config2.ChestBoxHeightRatio, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Chest forward offset", config2.ChestBoxForwardOffset, false) }); AddCollapsedGroup(tab, "Stick/runtime safety", "Show safety", "Hide safety", () => new List { (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Break distance", config2.AnchorBreakSafetyDistance, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Spawn grace (s)", config2.SpawnGraceSeconds, false) }); AddCollapsedGroup(tab, "Size limits/presets", "Show size limits", "Hide size limits", () => new List { (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Min size", config2.MinDimension, false), (BaseAtlyssElement)(object)tab.AddAdvancedSlider("Max size cap", config2.MaxDimension, false) }); _tabBuilt = true; PlayerCollisionPlugin.Log.LogInfo((object)"[EasySettings] Player Collider tab built."); } catch (Exception ex) { PlayerCollisionPlugin.Log.LogError((object)("[EasySettings] Tab build failed: " + ex.Message)); } } private static void SetSliderRowEnabled(AtlyssAdvancedSlider slider, bool enabled) { try { if ((Object)(object)slider.Slider != (Object)null) { ((Selectable)slider.Slider).interactable = enabled; } if ((Object)(object)slider.ResetButton != (Object)null) { ((Selectable)slider.ResetButton).interactable = enabled; } if ((Object)(object)((BaseAtlyssElement)slider).Root != (Object)null) { CanvasGroup val = ((Component)((BaseAtlyssElement)slider).Root).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)((BaseAtlyssElement)slider).Root).gameObject.AddComponent(); } val.alpha = (enabled ? 1f : 0.45f); val.interactable = enabled; val.blocksRaycasts = enabled; } } catch (Exception ex) { PlayerCollisionPlugin.Log.LogWarning((object)("[EasySettings] Slider enable state failed: " + ex.Message)); } } private static void SetElementGroupVisible(List elements, bool visible) { foreach (BaseAtlyssElement element in elements) { try { if ((Object)(object)element?.Root != (Object)null) { ((Component)element.Root).gameObject.SetActive(visible); } } catch (Exception ex) { PlayerCollisionPlugin.Log.LogWarning((object)("[EasySettings] Advanced fit visibility failed: " + ex.Message)); } } } private static void AddCollapsedGroup(SettingsTab tab, string header, string showLabel, string hideLabel, Func> createElements) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown string hideLabel2 = hideLabel; string showLabel2 = showLabel; tab.AddHeader(header); AtlyssButton toggle = tab.AddButton(showLabel2); List elements = createElements(); bool visible = false; SetElementGroupVisible(elements, visible); toggle.OnClicked.AddListener((UnityAction)delegate { visible = !visible; SetElementGroupVisible(elements, visible); SetButtonLabel(toggle, visible ? hideLabel2 : showLabel2); }); } private static void SetButtonLabel(AtlyssButton button, string label) { try { object obj = typeof(AtlyssButton).GetField("ButtonLabel", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(button); obj?.GetType().GetProperty("text", BindingFlags.Instance | BindingFlags.Public)?.SetValue(obj, label); } catch (Exception ex) { PlayerCollisionPlugin.Log.LogWarning((object)("[EasySettings] Button label update failed: " + ex.Message)); } } } }