Decompiled source of XenoCrawler v1.8.2
Mods/XenoCrawler.dll
Decompiled 12 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BoneLib; using BoneLib.BoneMenu; using BoneLib.Notifications; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Marrow; using Il2CppSLZ.Marrow.AI; using Il2CppSLZ.Marrow.Combat; using Il2CppSLZ.Marrow.Data; using Il2CppSLZ.Marrow.Interaction; using Il2CppSLZ.Marrow.PuppetMasta; using Il2CppSLZ.Marrow.Utilities; using Il2CppSystem.Collections.Generic; using LabFusion.Entities; using LabFusion.Extensions; using LabFusion.Network; using LabFusion.Network.Serialization; using LabFusion.Player; using LabFusion.SDK.Modules; using LabFusion.Senders; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; using XenoCrawler; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Main), "XenoCrawler", "1.8.2", "GamingSpartan", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: MelonOptionalDependencies(new string[] { "LabFusion" })] [assembly: HarmonyDontPatchAll] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 XenoCrawler { internal static class FusionBridge { public static bool IsInServer => NetworkInfo.HasServer; public static void Register() { ModuleManager.RegisterModule<XenoCrawlerFusionModule>(); } public static bool TryGetPlayerId(RigManager rig, out byte id) { id = 0; if (!NetworkInfo.HasServer || (Object)(object)rig == (Object)null) { return false; } NetworkPlayer val = default(NetworkPlayer); if (!NetworkPlayerManager.TryGetPlayer(rig, ref val) || val == null) { return false; } if (val.NetworkEntity != null && val.NetworkEntity.IsOwner) { return false; } if (val.PlayerID == null) { return false; } id = val.PlayerID.SmallID; return true; } public static bool TryNativeGrab(Hand hand, Collider col) { if (!NetworkInfo.HasServer || (Object)(object)hand == (Object)null || (Object)(object)col == (Object)null) { return false; } Grip val = Grip.Cache.Get(((Component)col).gameObject); if ((Object)(object)val == (Object)null) { val = ((Component)col).GetComponentInParent<Grip>(); } if ((Object)(object)val == (Object)null) { return false; } if (val.IsInteractionDisabled || (((HandReciever)val).HasHost && ((HandReciever)val).Host.IsInteractionDisabled)) { return false; } GripExtensions.TryAttach(val, hand, false, (SimpleTransform?)null); return true; } public static bool TryGetPlayerRig(byte id, out RigManager rig) { rig = null; if (!NetworkInfo.HasServer) { return false; } NetworkPlayer val = default(NetworkPlayer); if (!NetworkPlayerManager.TryGetPlayer(id, ref val) || val == null || !val.HasRig) { return false; } rig = val.RigRefs.RigManager; return (Object)(object)rig != (Object)null; } public static bool PlayerHasMod(byte id) { return ModPresence.Has(id); } public static bool IsOwnedLocally(Rigidbody rb) { if (!NetworkInfo.HasServer || (Object)(object)rb == (Object)null) { return true; } MarrowBody val = MarrowBody.Cache.Get(((Component)rb).gameObject); if ((Object)(object)val == (Object)null || (Object)(object)val.Entity == (Object)null) { return true; } NetworkEntity val2 = default(NetworkEntity); if (!IMarrowEntityExtender.Cache.TryGet(val.Entity, ref val2)) { return true; } return val2.IsOwner; } public static void SendLethalBite(byte target, Vector3 origin, Vector3 dir, float damage) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_001b: 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_0022: 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: 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_002b: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown if (NetworkInfo.HasServer) { Attack val = new Attack { damage = damage, attackType = (AttackType)1, origin = origin, direction = dir, normal = -dir, backFacing = false, collider = null, OrderInPool = 0, proxy = null }; PlayerSender.SendPlayerDamage(target, val, (BodyPart)2); } } public static void BroadcastBite(Vector3 origin, Vector3 dir) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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) //IL_0016: 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) if (NetworkInfo.HasServer) { MessageRelay.RelayModule<BiteFxMessage, BiteFxData>(new BiteFxData { Origin = origin, Direction = dir }, CommonMessageRoutes.UnreliableToOtherClients); } } public static void ReleaseNativeGrab(Hand hand) { if ((Object)(object)hand != (Object)null) { HandExtensions.TryDetach(hand); } } public static void SendPlayerGrab(byte target, bool active, Vector3 point, float strength, bool reliable) { //IL_0015: 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_0032: Unknown result type (might be due to invalid IL or missing references) if (NetworkInfo.HasServer) { PlayerGrabData obj = new PlayerGrabData { Active = active, Point = point, Strength = strength }; MessageRoute val = default(MessageRoute); ((MessageRoute)(ref val))..ctor(target, (NetworkChannel)(!reliable)); MessageRelay.RelayModule<PlayerGrabMessage, PlayerGrabData>(obj, val); } } public static void TakeOwnership(Rigidbody rb) { if (!NetworkInfo.HasServer || (Object)(object)rb == (Object)null) { return; } MarrowBody val = MarrowBody.Cache.Get(((Component)rb).gameObject); if (!((Object)(object)val == (Object)null)) { MarrowEntity entity = val.Entity; NetworkEntity val2 = default(NetworkEntity); if (!((Object)(object)entity == (Object)null) && IMarrowEntityExtender.Cache.TryGet(entity, ref val2) && !val2.IsOwner) { NetworkEntityManager.TakeOwnership(val2); } } } } public class XenoCrawlerFusionModule : Module { public override string Name => "XenoCrawler"; public override string Author => "XenoCrawler Authors"; public override Version Version => new Version(1, 8, 0); public override ConsoleColor Color => ConsoleColor.Green; protected override void OnModuleRegistered() { ModuleMessageManager.RegisterHandler<CrawlStateMessage>(); ModuleMessageManager.RegisterHandler<ServerPolicyMessage>(); ModuleMessageManager.RegisterHandler<PlayerGrabMessage>(); ModuleMessageManager.RegisterHandler<BiteFxMessage>(); ModuleMessageManager.RegisterHandler<PresenceMessage>(); } } public class CrawlStateData : INetSerializable { public const int Size = 38; public bool Attached; public bool Clinging; public Vector3 SurfaceUp; public Vector3 SurfacePoint; public float Gravity; public float Clearance; public float Skin; public int? GetSize() { return 38; } public void Serialize(INetSerializer serializer) { serializer.SerializeValue(ref Attached); serializer.SerializeValue(ref Clinging); NetSerializerUnityExtensions.SerializeValue(serializer, ref SurfaceUp); NetSerializerUnityExtensions.SerializeValue(serializer, ref SurfacePoint); serializer.SerializeValue(ref Gravity); serializer.SerializeValue(ref Clearance); serializer.SerializeValue(ref Skin); } } public class CrawlStateMessage : ModuleMessageHandler { protected override void OnHandleMessage(ReceivedMessage received) { CrawlStateData data = ((ReceivedMessage)(ref received)).ReadData<CrawlStateData>(); if (((ReceivedMessage)(ref received)).Sender.HasValue) { ModPresence.Mark(((ReceivedMessage)(ref received)).Sender.Value); RemoteCrawlers.Receive(((ReceivedMessage)(ref received)).Sender.Value, data); } } } internal static class ModPresence { private const float Expiry = 10f; private static readonly Dictionary<byte, float> _seen = new Dictionary<byte, float>(); public static void Mark(byte id) { _seen[id] = Time.time; } public static bool Has(byte id) { if (_seen.TryGetValue(id, out var value)) { return Time.time - value < 10f; } return false; } public static void Clear() { _seen.Clear(); } } public class PresenceData : INetSerializable { public const int Size = 1; public byte Protocol = 1; public int? GetSize() { return 1; } public void Serialize(INetSerializer serializer) { serializer.SerializeValue(ref Protocol); } } public class PresenceMessage : ModuleMessageHandler { protected override void OnHandleMessage(ReceivedMessage received) { ((ReceivedMessage)(ref received)).ReadData<PresenceData>(); if (((ReceivedMessage)(ref received)).Sender.HasValue) { ModPresence.Mark(((ReceivedMessage)(ref received)).Sender.Value); } } } public class BiteFxData : INetSerializable { public const int Size = 24; public Vector3 Origin; public Vector3 Direction; public int? GetSize() { return 24; } public void Serialize(INetSerializer serializer) { NetSerializerUnityExtensions.SerializeValue(serializer, ref Origin); NetSerializerUnityExtensions.SerializeValue(serializer, ref Direction); } } public class BiteFxMessage : ModuleMessageHandler { protected override void OnHandleMessage(ReceivedMessage received) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) BiteFxData biteFxData = ((ReceivedMessage)(ref received)).ReadData<BiteFxData>(); JawFx.Play(biteFxData.Origin, biteFxData.Direction); } } public class PlayerGrabData : INetSerializable { public const int Size = 17; public bool Active; public Vector3 Point; public float Strength; public int? GetSize() { return 17; } public void Serialize(INetSerializer serializer) { serializer.SerializeValue(ref Active); NetSerializerUnityExtensions.SerializeValue(serializer, ref Point); serializer.SerializeValue(ref Strength); } } public class PlayerGrabMessage : ModuleMessageHandler { protected override void OnHandleMessage(ReceivedMessage received) { //IL_0089: 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_0059: 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) PlayerGrabData playerGrabData = ((ReceivedMessage)(ref received)).ReadData<PlayerGrabData>(); if (!((ReceivedMessage)(ref received)).Sender.HasValue || ((ReceivedMessage)(ref received)).Sender.Value == PlayerIDManager.LocalSmallID) { return; } RigManager rigManager = Player.RigManager; if (playerGrabData.Active && (Object)(object)rigManager != (Object)null) { Vector3 val = playerGrabData.Point - ((Rig)rigManager.physicsRig).m_pelvis.position; if (((Vector3)(ref val)).sqrMagnitude > 25f) { return; } } GrabbedBy.Receive(((ReceivedMessage)(ref received)).Sender.Value, playerGrabData.Active, playerGrabData.Point, playerGrabData.Strength); } } public class ServerPolicyData : INetSerializable { public const int Size = 8; public bool AllowCrawl; public bool AllowPounce; public bool AllowNpcStealth; public bool AllowAmbushGrab; public bool AllowPlayerGrab; public bool AllowHeadbite; public byte StaminaRule; public byte LightRule; public int? GetSize() { return 8; } public void Serialize(INetSerializer serializer) { serializer.SerializeValue(ref AllowCrawl); serializer.SerializeValue(ref AllowPounce); serializer.SerializeValue(ref AllowNpcStealth); serializer.SerializeValue(ref AllowAmbushGrab); serializer.SerializeValue(ref AllowPlayerGrab); serializer.SerializeValue(ref AllowHeadbite); serializer.SerializeValue(ref StaminaRule); serializer.SerializeValue(ref LightRule); } } public class ServerPolicyMessage : ModuleMessageHandler { public override ExpectedReceiverType ExpectedReceiver => (ExpectedReceiverType)2; protected override void OnHandleMessage(ReceivedMessage received) { ServerPolicyData serverPolicyData = ((ReceivedMessage)(ref received)).ReadData<ServerPolicyData>(); if (((ReceivedMessage)(ref received)).Sender == 0 && !NetworkInfo.IsHost) { ServerPolicy.ApplyHostPolicy(serverPolicyData.AllowCrawl, serverPolicyData.AllowPounce, serverPolicyData.AllowNpcStealth, serverPolicyData.AllowAmbushGrab, serverPolicyData.AllowPlayerGrab, serverPolicyData.AllowHeadbite, (ServerRule)serverPolicyData.StaminaRule, (ServerRule)serverPolicyData.LightRule); } } } internal static class FusionTick { private const float SendInterval = 0.1f; private const float PolicyInterval = 2f; private const float PresenceInterval = 3f; private static float _presenceTimer; private static float _sendTimer; private static bool _lastAttached; private static bool _lastClinging; private static bool _lastHanging; private static float _policyTimer; private static bool _policySent; private static bool _lastPolicyCrawl; private static bool _lastPolicyPounce; private static bool _lastPolicyStealth; private static bool _lastPolicyGrab; private static bool _lastPolicyPlayerGrab; private static bool _lastPolicyHeadbite; private static ServerRule _lastPolicyStamina; private static ServerRule _lastPolicyLight; public static void Update() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (!NetworkInfo.HasServer) { ServerPolicy.SetRole(ServerRole.Offline); _policySent = false; ModPresence.Clear(); _presenceTimer = 0f; if (_lastAttached || _lastClinging) { Reset(); } return; } ServerPolicy.SetRole(NetworkInfo.IsHost ? ServerRole.Host : ServerRole.Client); _presenceTimer -= Time.deltaTime; if (_presenceTimer <= 0f) { _presenceTimer = 3f; MessageRelay.RelayModule<PresenceMessage, PresenceData>(new PresenceData(), CommonMessageRoutes.UnreliableToOtherClients); } if (NetworkInfo.IsHost) { UpdateHostPolicy(); } bool isAttached = SurfaceCrawler.IsAttached; bool flag = false; _sendTimer -= Time.deltaTime; bool offSurface = SurfaceCrawler.OffSurface; if (isAttached != _lastAttached || flag != _lastClinging || offSurface != _lastHanging) { Send(isAttached, flag, reliable: true); } else if (isAttached && _sendTimer <= 0f) { Send(isAttached, flag, reliable: false); } } private static void Send(bool attached, bool clinging, bool reliable) { //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_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_0077: 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_007c: 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) CrawlStateData obj = new CrawlStateData { Attached = attached, Clinging = clinging, SurfaceUp = SurfaceCrawler.SurfaceUp, SurfacePoint = SurfaceCrawler.SurfacePoint, Gravity = CrawlSettings.SurfaceGravity.Value * SurfaceCrawler.GravityScale, Clearance = StealthCling.Clearance, Skin = (CrawlSettings.LimbAntiClip.Value ? CrawlSettings.LimbSkin.Value : 0f) }; MessageRoute val = (reliable ? CommonMessageRoutes.ReliableToOtherClients : CommonMessageRoutes.UnreliableToOtherClients); MessageRelay.RelayModule<CrawlStateMessage, CrawlStateData>(obj, val); _sendTimer = 0.1f; _lastAttached = attached; _lastClinging = clinging; _lastHanging = SurfaceCrawler.OffSurface; } private static void UpdateHostPolicy() { //IL_011c: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) bool value = CrawlSettings.ServerAllowCrawl.Value; bool value2 = CrawlSettings.ServerAllowPounce.Value; bool value3 = CrawlSettings.ServerAllowNpcStealth.Value; bool value4 = CrawlSettings.ServerAllowAmbushGrab.Value; bool value5 = CrawlSettings.ServerAllowPlayerGrab.Value; bool value6 = CrawlSettings.ServerAllowHeadbite.Value; ServerRule value7 = CrawlSettings.ServerStaminaRule.Value; ServerRule value8 = CrawlSettings.ServerLightRule.Value; bool flag = !_policySent || value != _lastPolicyCrawl || value2 != _lastPolicyPounce || value3 != _lastPolicyStealth || value4 != _lastPolicyGrab || value5 != _lastPolicyPlayerGrab || value6 != _lastPolicyHeadbite || value7 != _lastPolicyStamina || value8 != _lastPolicyLight; _policyTimer -= Time.deltaTime; if (flag || !(_policyTimer > 0f)) { ServerPolicyData obj = new ServerPolicyData { AllowCrawl = value, AllowPounce = value2, AllowNpcStealth = value3, AllowAmbushGrab = value4, AllowPlayerGrab = value5, AllowHeadbite = value6, StaminaRule = (byte)value7, LightRule = (byte)value8 }; MessageRoute val = (flag ? CommonMessageRoutes.ReliableToClients : CommonMessageRoutes.UnreliableToClients); MessageRelay.RelayModule<ServerPolicyMessage, ServerPolicyData>(obj, val); _policySent = true; _policyTimer = 2f; _lastPolicyCrawl = value; _lastPolicyPounce = value2; _lastPolicyStealth = value3; _lastPolicyGrab = value4; _lastPolicyPlayerGrab = value5; _lastPolicyHeadbite = value6; _lastPolicyStamina = value7; _lastPolicyLight = value8; } } public static void FixedUpdate(float dt) { RemoteCrawlers.Apply(dt); } public static void Reset() { _lastAttached = (_lastClinging = (_lastHanging = false)); _sendTimer = 0f; RemoteCrawlers.Clear(); } } internal static class RemoteCrawlers { private class Entry { public CrawlStateData Data; public RigManager Rig; public NetworkPlayer Player; public readonly LegFriction.State Friction = new LegFriction.State(); public float LastHeard; public readonly List<Rigidbody> GravityDisabled = new List<Rigidbody>(); public LimbClearance.LegRest LegRest; public RigBodies Bodies; public readonly HashSet<IntPtr> GravityHandled = new HashSet<IntPtr>(); } private const float Timeout = 1.5f; private const float ClingStiffness = 160f; private static readonly Dictionary<byte, Entry> _entries = new Dictionary<byte, Entry>(); private static readonly List<byte> _toRemove = new List<byte>(); private const float RotStiffness = 400f; private const float MaxAngularAccel = 200f; public static void Receive(byte playerId, CrawlStateData data) { NetworkPlayer val = default(NetworkPlayer); if (!NetworkPlayerManager.TryGetPlayer(playerId, ref val) || !val.HasRig || val.NetworkEntity.IsOwner) { return; } RigManager rigManager = val.RigRefs.RigManager; if (!data.Attached) { Remove(playerId); return; } if (!_entries.TryGetValue(playerId, out var value)) { value = new Entry(); _entries[playerId] = value; value.LegRest = LimbClearance.MeasureLegRest(((Object)(object)rigManager != (Object)null) ? rigManager.physicsRig : null); } else if ((Object)(object)value.Rig != (Object)(object)rigManager) { RestoreGravity(value); value.LegRest = LimbClearance.MeasureLegRest(((Object)(object)rigManager != (Object)null) ? rigManager.physicsRig : null); } value.Data = data; value.Rig = rigManager; value.Player = val; value.LastHeard = Time.time; } public static void Apply(float dt) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0235: 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) if (_entries.Count == 0) { return; } _toRemove.Clear(); foreach (KeyValuePair<byte, Entry> entry in _entries) { Entry value = entry.Value; if ((Object)(object)value.Rig == (Object)null || (Object)(object)value.Rig.physicsRig == (Object)null || Time.time - value.LastHeard > 1.5f) { _toRemove.Add(entry.Key); continue; } PhysicsRig physicsRig = value.Rig.physicsRig; CrawlStateData data = value.Data; Vector3 val = ((((Vector3)(ref data.SurfaceUp)).sqrMagnitude > 0.5f) ? ((Vector3)(ref data.SurfaceUp)).normalized : Vector3.up); Transform transform = ((Component)value.Rig).transform; RigBodies rigBodies = RigBodies.Get(physicsRig, ref value.Bodies); bool flag = data.Clinging || data.Skin > 0f; if (CrawlSettings.SlipperyFeet.Value) { LegFriction.Enable(rigBodies, value.Friction); Rigidbody[] array = (Rigidbody[])(object)new Rigidbody[2] { rigBodies.Feet, rigBodies.Knee }; foreach (Rigidbody val2 in array) { if ((Object)(object)val2 != (Object)null) { val2.AddTorque(-val2.angularVelocity * 15f, (ForceMode)5); } } } else { LegFriction.Disable(value.Friction); } foreach (Rigidbody item in rigBodies.All) { if ((Object)(object)item == (Object)null) { continue; } if (value.GravityHandled.Add(((Il2CppObjectBase)item).Pointer) && item.useGravity) { item.useGravity = false; value.GravityDisabled.Add(item); } item.AddForce(-val * data.Gravity, (ForceMode)5); if (flag && !rigBodies.IsHand(item) && !((Object)(object)item == (Object)(object)rigBodies.Pelvis) && LimbClearance.TryGetGapCached(item, val, transform, dt, out var gap)) { if (data.Clinging) { item.AddForce(LimbClearance.GapSpring(item, val, gap, data.Clearance, 160f, 60f), (ForceMode)5); } if (data.Skin > 0f) { LimbClearance.AntiClip(item, val, gap, data.Skin * 0.5f, dt); } } } } foreach (byte item2 in _toRemove) { Remove(item2); } foreach (Entry value2 in _entries.Values) { if (!((Object)(object)value2.Rig == (Object)null) && !((Object)(object)value2.Rig.physicsRig == (Object)null)) { DrivePelvisRotation(value2); bool flag2 = Vector3.Dot(value2.Data.SurfaceUp, Vector3.down) > 0.5f; LimbClearance.StraightenLegs(value2.Rig.physicsRig, CrawlSettings.LegStraighten.Value, value2.LegRest, flag2 ? CrawlSettings.CeilingLegLock.Value : 0f); } } } private static void DrivePelvisRotation(Entry e) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006a: 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_007b: 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_00cd: 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_00e6: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0107: 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_0111: Unknown result type (might be due to invalid IL or missing references) PhysicsRig physicsRig = e.Rig.physicsRig; if (!physicsRig.ballLocoEnabled) { return; } RigPose val = ((e.Player != null) ? e.Player.RigPose : null); if (val == null || val.PelvisPose == null) { return; } Rigidbody pelvis = RigBodies.Get(physicsRig, ref e.Bodies).Pelvis; if ((Object)(object)pelvis == (Object)null) { return; } Quaternion val2 = val.PelvisPose.Rotation * Quaternion.Inverse(pelvis.rotation); float num = default(float); Vector3 val3 = default(Vector3); ((Quaternion)(ref val2)).ToAngleAxis(ref num, ref val3); if (!float.IsNaN(val3.x) && !float.IsInfinity(val3.x) && !(((Vector3)(ref val3)).sqrMagnitude < 1E-06f)) { if (num > 180f) { num -= 360f; } float num2 = 2f * Mathf.Sqrt(400f); Vector3 val4 = ((Vector3)(ref val3)).normalized * (num * ((float)Math.PI / 180f) * 400f) - (pelvis.angularVelocity - val.PelvisPose.AngularVelocity) * num2; pelvis.AddTorque(Vector3.ClampMagnitude(val4, 200f), (ForceMode)5); } } private static void Remove(byte id) { if (_entries.TryGetValue(id, out var value)) { RestoreGravity(value); _entries.Remove(id); } } private static void RestoreGravity(Entry e) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (e.Bodies != null) { Rigidbody[] array = (Rigidbody[])(object)new Rigidbody[2] { e.Bodies.Feet, e.Bodies.Knee }; foreach (Rigidbody val in array) { if ((Object)(object)val != (Object)null) { val.angularVelocity = Vector3.zero; } } } foreach (Rigidbody item in e.GravityDisabled) { if ((Object)(object)item != (Object)null) { item.useGravity = true; } } e.GravityDisabled.Clear(); e.GravityHandled.Clear(); LegFriction.Disable(e.Friction); } public static void Clear() { foreach (Entry value in _entries.Values) { RestoreGravity(value); } _entries.Clear(); } } internal static class CollisionGuard { private sealed class Pair { public Collider A; public Collider B; public int Refs; public bool Pending; public float PendingTime; } internal sealed class Token { internal readonly List<(IntPtr, IntPtr)> Keys = new List<(IntPtr, IntPtr)>(); public bool IsEmpty => Keys.Count == 0; } private const float CheckInterval = 0.2f; private const float MaxRestoreWait = 4f; private const float BoundsPadding = 0.03f; private static readonly Dictionary<(IntPtr, IntPtr), Pair> _pairs = new Dictionary<(IntPtr, IntPtr), Pair>(); private static readonly List<(IntPtr, IntPtr)> _done = new List<(IntPtr, IntPtr)>(); private static float _checkTimer; public static Token Acquire(List<Collider> mine, List<Collider> theirs) { Token token = new Token(); if (mine == null || theirs == null) { return token; } foreach (Collider item in mine) { if ((Object)(object)item == (Object)null) { continue; } foreach (Collider their in theirs) { if (!((Object)(object)their == (Object)null)) { (IntPtr, IntPtr) tuple = Key(item, their); if (!_pairs.TryGetValue(tuple, out var value)) { value = new Pair { A = item, B = their }; _pairs[tuple] = value; Physics.IgnoreCollision(item, their, true); } value.Refs++; value.Pending = false; token.Keys.Add(tuple); } } } return token; } public static void Release(Token token) { if (token == null) { return; } foreach (var key in token.Keys) { if (_pairs.TryGetValue(key, out var value)) { value.Refs = Mathf.Max(0, value.Refs - 1); if (value.Refs == 0) { value.Pending = true; value.PendingTime = 0f; } } } token.Keys.Clear(); } public static void FixedTick(float dt) { if (_pairs.Count == 0) { return; } foreach (Pair value2 in _pairs.Values) { if (value2.Pending) { value2.PendingTime += dt; } } _checkTimer -= dt; if (_checkTimer > 0f) { return; } _checkTimer = 0.2f; _done.Clear(); foreach (KeyValuePair<(IntPtr, IntPtr), Pair> pair in _pairs) { Pair value = pair.Value; if ((Object)(object)value.A == (Object)null || (Object)(object)value.B == (Object)null) { _done.Add(pair.Key); } else if (value.Pending && (!Overlaps(value.A, value.B) || value.PendingTime > 4f)) { Physics.IgnoreCollision(value.A, value.B, false); _done.Add(pair.Key); } } foreach (var item in _done) { _pairs.Remove(item); } } public static void Clear() { _pairs.Clear(); _checkTimer = 0f; } private static bool Overlaps(Collider a, Collider b) { //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_0028: Unknown result type (might be due to invalid IL or missing references) if (!a.enabled || !b.enabled) { return false; } Bounds bounds = a.bounds; ((Bounds)(ref bounds)).Expand(0.06f); return ((Bounds)(ref bounds)).Intersects(b.bounds); } private static (IntPtr, IntPtr) Key(Collider a, Collider b) { IntPtr pointer = ((Il2CppObjectBase)a).Pointer; IntPtr pointer2 = ((Il2CppObjectBase)b).Pointer; if (pointer.ToInt64() >= pointer2.ToInt64()) { return (pointer2, pointer); } return (pointer, pointer2); } public static void CollectRig(PhysicsRig pr, List<Collider> into) { into.Clear(); if ((Object)(object)pr == (Object)null) { return; } Rigidbody val = (((Object)(object)((Rig)pr).m_handLf != (Object)null) ? ((Component)((Rig)pr).m_handLf).GetComponent<Rigidbody>() : null); Rigidbody val2 = (((Object)(object)((Rig)pr).m_handRt != (Object)null) ? ((Component)((Rig)pr).m_handRt).GetComponent<Rigidbody>() : null); foreach (Collider componentsInChild in ((Component)pr).GetComponentsInChildren<Collider>()) { if (!((Object)(object)componentsInChild == (Object)null) && !componentsInChild.isTrigger) { Rigidbody attachedRigidbody = componentsInChild.attachedRigidbody; if (!((Object)(object)attachedRigidbody != (Object)null) || (!((Object)(object)attachedRigidbody == (Object)(object)val) && !((Object)(object)attachedRigidbody == (Object)(object)val2))) { into.Add(componentsInChild); } } } } public static void CollectUnder(Transform root, List<Collider> into) { into.Clear(); if ((Object)(object)root == (Object)null) { return; } foreach (Collider componentsInChild in ((Component)root).GetComponentsInChildren<Collider>()) { if ((Object)(object)componentsInChild != (Object)null && !componentsInChild.isTrigger && (Object)(object)componentsInChild.attachedRigidbody != (Object)null) { into.Add(componentsInChild); } } } } internal static class OfflineGrab { private static bool _looked; private static MethodInfo _confirm; private static MethodInfo _detach; private static void Look() { if (!_looked) { _looked = true; try { _confirm = typeof(Grip).GetMethod("OnGrabConfirm", new Type[2] { typeof(Hand), typeof(bool) }); _detach = typeof(Hand).GetMethod("DetachObject", Type.EmptyTypes); } catch (Exception ex) { Main.Log.Warning("Offline grab lookup failed: " + ex.Message); } if (_confirm == null) { Main.Log.Warning("Grip.OnGrabConfirm not found - single-player grabs use a soft hold instead."); } if (_detach == null) { Main.Log.Msg("Hand.DetachObject not found - letting go of the grip still releases normally."); } } } public static bool TryAttach(Hand hand, Collider col) { if ((Object)(object)hand == (Object)null || (Object)(object)col == (Object)null) { return false; } Look(); if (_confirm == null) { return false; } try { Grip componentInParent = ((Component)col).GetComponentInParent<Grip>(); if ((Object)(object)componentInParent == (Object)null) { return false; } _confirm.Invoke(componentInParent, new object[2] { hand, false }); return true; } catch (Exception ex) { Main.Log.Warning("Offline grab failed: " + ex.Message); return false; } } public static void TryDetach(Hand hand) { if ((Object)(object)hand == (Object)null) { return; } Look(); if (_detach == null) { return; } try { _detach.Invoke(hand, null); } catch (Exception ex) { Main.Log.Warning("Offline release failed: " + ex.Message); } } } public static class LimbClearance { private struct GapEntry { public int Tick; public float Gap; public bool Valid; public Vector3 Up; } public struct LegRest { public bool Valid; public float Knee; public float Feet; } private const float ProbeLift = 0.35f; private const float ProbeReach = 0.6f; private const float ProbeRadius = 0.04f; private const float MaxPushOut = 2.5f; private static readonly Dictionary<IntPtr, List<Collider>> _colliders = new Dictionary<IntPtr, List<Collider>>(); private static readonly Dictionary<IntPtr, GapEntry> _gaps = new Dictionary<IntPtr, GapEntry>(); public static bool TryGetGapCached(Rigidbody rb, Vector3 up, Transform ignoreRoot, float dt, out float gap) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0086: Unknown result type (might be due to invalid IL or missing references) int tick = PerfTick.Tick; if (CrawlSettings.PerformanceMode.Value && _gaps.TryGetValue(((Il2CppObjectBase)rb).Pointer, out var value) && Vector3.Dot(value.Up, up) > 0.995f) { int num = tick - value.Tick; int num2 = ((value.Valid && value.Gap < 0.4f) ? 2 : 6); if (num >= 0 && num < num2) { gap = (value.Valid ? (value.Gap + Vector3.Dot(rb.velocity, up) * dt * (float)num) : 0f); return value.Valid; } } Vector3 surfacePoint; bool flag = TryGetGap(rb, up, ignoreRoot, out gap, out surfacePoint); _gaps[((Il2CppObjectBase)rb).Pointer] = new GapEntry { Tick = tick, Gap = gap, Valid = flag, Up = up }; return flag; } public static bool TryGetGap(Rigidbody rb, Vector3 up, Transform ignoreRoot, out float gap, out Vector3 surfacePoint) { //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_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_0027: 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_0039: 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_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_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_006f: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_0107: 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_010e: 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_011b: 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_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) gap = 0f; surfacePoint = Vector3.zero; if (!TryGetBounds(rb, out var bounds)) { return false; } Vector3 extents = ((Bounds)(ref bounds)).extents; float num = Mathf.Abs(up.x) * extents.x + Mathf.Abs(up.y) * extents.y + Mathf.Abs(up.z) * extents.z; Vector3 val = ((Bounds)(ref bounds)).center + up * (num + 0.35f); float num2 = num * 2f + 0.35f + 0.6f; RaycastHit val2 = default(RaycastHit); if (!Physics.SphereCast(val, 0.04f, -up, ref val2, num2, SurfaceCrawler.SurfaceMask, (QueryTriggerInteraction)1)) { return false; } if ((Object)(object)((RaycastHit)(ref val2)).collider == (Object)null || ((Object)(object)ignoreRoot != (Object)null && ((Component)((RaycastHit)(ref val2)).collider).transform.IsChildOf(ignoreRoot))) { return false; } if ((Object)(object)((RaycastHit)(ref val2)).rigidbody != (Object)null && !((RaycastHit)(ref val2)).rigidbody.isKinematic) { return false; } surfacePoint = ((RaycastHit)(ref val2)).point; Vector3 val3 = ((Bounds)(ref bounds)).center - up * num; gap = Vector3.Dot(val3 - ((RaycastHit)(ref val2)).point, up); return true; } public static Vector3 GapSpring(Rigidbody rb, Vector3 up, float gap, float targetGap, float stiffness, float maxAccel) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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) //IL_0033: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Dot(rb.velocity, up); float num2 = 1.6f * Mathf.Sqrt(stiffness); float num3 = Mathf.Clamp((0f - stiffness) * (gap - targetGap) - num2 * num, 0f - maxAccel, maxAccel); return up * num3; } public static void AntiClip(Rigidbody rb, Vector3 up, float gap, float skin, float dt) { //IL_0006: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!(gap >= skin)) { float num = Vector3.Dot(rb.velocity, up); float num2 = (skin - gap) * 400f; float num3 = ((num < 0f) ? ((0f - num) / Mathf.Max(dt, 0.0001f) * 0.5f) : 0f); float num4 = Mathf.Min(num2 + num3, 150f); rb.AddForce(up * num4, (ForceMode)5); } } public static LegRest MeasureLegRest(PhysicsRig pr) { //IL_006b: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0082: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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) //IL_00ae: 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_00ca: 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_00d0: 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) LegRest result = default(LegRest); if ((Object)(object)pr == (Object)null || (Object)(object)pr.torso == (Object)null || (Object)(object)pr.torso.rbPelvis == (Object)null || (Object)(object)((Rig)pr).m_head == (Object)null) { return result; } if ((Object)(object)pr.rbKnee == (Object)null || (Object)(object)pr._feetRb == (Object)null) { return result; } Vector3 worldCenterOfMass = pr.torso.rbPelvis.worldCenterOfMass; Vector3 val = ((Rig)pr).m_head.position - worldCenterOfMass; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { return result; } ((Vector3)(ref val)).Normalize(); result.Knee = Vector3.Dot(pr.rbKnee.worldCenterOfMass - worldCenterOfMass, -val); result.Feet = Vector3.Dot(pr._feetRb.worldCenterOfMass - worldCenterOfMass, -val); result.Valid = result.Knee > 0.1f && result.Feet > result.Knee && result.Feet < 1.6f; return result; } public static void StraightenLegs(PhysicsRig pr, float strength, LegRest rest = default(LegRest), float axialLock = 0f) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0057: 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_00b7: 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_00d3: 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) if (strength <= 0f || (Object)(object)pr == (Object)null || (Object)(object)pr.torso == (Object)null) { return; } Rigidbody rbPelvis = pr.torso.rbPelvis; if (!((Object)(object)rbPelvis == (Object)null) && !((Object)(object)((Rig)pr).m_head == (Object)null)) { Vector3 worldCenterOfMass = rbPelvis.worldCenterOfMass; Vector3 axis = ((Rig)pr).m_head.position - worldCenterOfMass; if (!(((Vector3)(ref axis)).sqrMagnitude < 0.0001f)) { ((Vector3)(ref axis)).Normalize(); float num = 80f * strength; float c = 2f * Mathf.Sqrt(num); float num2 = (rest.Valid ? (120f * axialLock) : 0f); float cA = 2f * Mathf.Sqrt(num2); Straighten(pr.rbKnee, rbPelvis, worldCenterOfMass, axis, num, c, strength, rest.Knee, num2, cA); Straighten(pr._feetRb, rbPelvis, worldCenterOfMass, axis, num, c, strength, rest.Feet, num2, cA); } } } private static void Straighten(Rigidbody rb, Rigidbody pelvis, Vector3 p0, Vector3 axis, float k, float c, float strength, float restDist, float kA, float cA) { //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_007b: 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_0081: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_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_00a3: 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_00ab: 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_00b1: 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_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_00d3: 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_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_001b: 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_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_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_0039: 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_0066: 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) if (!((Object)(object)rb == (Object)null)) { if (kA > 0f) { Vector3 val = -axis; float num = Vector3.Dot(rb.worldCenterOfMass - p0, val); float num2 = Vector3.Dot(rb.velocity - pelvis.velocity, val); float num3 = Mathf.Clamp((0f - kA) * (num - restDist) - cA * num2, -60f, 60f); rb.AddForce(val * num3, (ForceMode)5); } Vector3 val2 = Vector3.ProjectOnPlane(rb.worldCenterOfMass - p0, axis); Vector3 val3 = Vector3.ProjectOnPlane(rb.velocity - pelvis.velocity, axis); rb.AddForce(Vector3.ClampMagnitude((0f - k) * val2 - c * val3, 60f), (ForceMode)5); rb.AddTorque((pelvis.angularVelocity - rb.angularVelocity) * (6f * strength), (ForceMode)5); } } public static void ClearCache() { _colliders.Clear(); _gaps.Clear(); } public static List<Collider> CollidersOf(Rigidbody rb) { if (!_colliders.TryGetValue(((Il2CppObjectBase)rb).Pointer, out var value) || value.Count == 0 || (Object)(object)value[0] == (Object)null) { value = new List<Collider>(); foreach (Collider componentsInChild in ((Component)rb).GetComponentsInChildren<Collider>(false)) { if (!((Object)(object)componentsInChild == (Object)null) && !componentsInChild.isTrigger && !((Object)(object)componentsInChild.attachedRigidbody != (Object)(object)rb)) { value.Add(componentsInChild); } } _colliders[((Il2CppObjectBase)rb).Pointer] = value; } return value; } private static bool TryGetBounds(Rigidbody rb, out Bounds bounds) { //IL_0001: 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_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) bounds = default(Bounds); if (!_colliders.TryGetValue(((Il2CppObjectBase)rb).Pointer, out var value) || value.Count == 0 || (Object)(object)value[0] == (Object)null) { value = new List<Collider>(); foreach (Collider componentsInChild in ((Component)rb).GetComponentsInChildren<Collider>(false)) { if (!((Object)(object)componentsInChild == (Object)null) && !componentsInChild.isTrigger && !((Object)(object)componentsInChild.attachedRigidbody != (Object)(object)rb)) { value.Add(componentsInChild); } } _colliders[((Il2CppObjectBase)rb).Pointer] = value; } bool flag = false; foreach (Collider item in value) { if (!((Object)(object)item == (Object)null) && item.enabled) { if (!flag) { bounds = item.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(item.bounds); } } } return flag; } } public enum LatchMode { Grip, Automatic } public enum GrabButtonMode { MoveStickClick, TurnStickClick, BOrY, Off } public enum BiteInputMode { BothTriggers, HeadThrust, TriggersOrThrust } public enum BitePlayerMode { Off, Damage, Kill } public enum BiteButtonMode { EitherTrigger, LeftTrigger, RightTrigger, BOrY, Off } public enum CornerMode { StickAndGrip, GripOnly, StickOnly } public static class CrawlSettings { private static MelonPreferences_Category _cat; public static MelonPreferences_Entry<bool> Enabled; public static MelonPreferences_Entry<float> CrawlSpeed; public static MelonPreferences_Entry<float> CrawlAcceleration; public static MelonPreferences_Entry<float> Stickiness; public static MelonPreferences_Entry<float> SurfaceGravity; public static MelonPreferences_Entry<LatchMode> Latch; public static MelonPreferences_Entry<CornerMode> Corners; public static MelonPreferences_Entry<bool> ReleaseGripToDrop; public static MelonPreferences_Entry<float> ProbeDistance; public static MelonPreferences_Entry<float> WallThreshold; public static MelonPreferences_Entry<float> TurnSpeed; public static MelonPreferences_Entry<bool> SwapSticks; public static MelonPreferences_Entry<bool> HandOverHand; public static MelonPreferences_Entry<float> HandPullStrength; public static MelonPreferences_Entry<bool> LimbAntiClip; public static MelonPreferences_Entry<float> LimbSkin; public static MelonPreferences_Entry<float> LegStraighten; public static MelonPreferences_Entry<bool> SlipperyFeet; public static MelonPreferences_Entry<float> GripReachBeyond; public static MelonPreferences_Entry<float> CeilingLegLock; public static MelonPreferences_Entry<float> TransitionTime; public static MelonPreferences_Entry<bool> InstantSnap; public static MelonPreferences_Entry<float> LatchReach; public static MelonPreferences_Entry<bool> AirLatch; public static MelonPreferences_Entry<bool> PounceEnabled; public static MelonPreferences_Entry<float> PounceMinSpeed; public static MelonPreferences_Entry<float> PounceMaxSpeed; public static MelonPreferences_Entry<float> ScuttleMultiplier; public static MelonPreferences_Entry<float> AmbushBoost; public static MelonPreferences_Entry<float> DropPush; public static MelonPreferences_Entry<bool> AmbushGrab; public static MelonPreferences_Entry<float> DescendReach; public static MelonPreferences_Entry<float> MaxDescend; public static MelonPreferences_Entry<float> DescendSpeed; public static MelonPreferences_Entry<float> GrabContact; public static MelonPreferences_Entry<float> VictimWeight; public static MelonPreferences_Entry<bool> SurfaceLeap; public static MelonPreferences_Entry<float> LeapRange; public static MelonPreferences_Entry<float> LeapSpeed; public static MelonPreferences_Entry<GrabButtonMode> GrabButton; public static MelonPreferences_Entry<bool> RiseWithVictim; public static MelonPreferences_Entry<bool> RiseWithPlayers; public static MelonPreferences_Entry<float> RiseWithVictimSpeed; public static MelonPreferences_Entry<float> AmbushPullStrength; public static MelonPreferences_Entry<bool> GrabFromWalls; public static MelonPreferences_Entry<bool> GrabPlayers; public static MelonPreferences_Entry<bool> CanBeGrabbed; public static MelonPreferences_Entry<bool> HeadbiteEnabled; public static MelonPreferences_Entry<BiteInputMode> BiteInput; public static MelonPreferences_Entry<BiteButtonMode> BiteButton; public static MelonPreferences_Entry<float> ThrustSpeed; public static MelonPreferences_Entry<float> BiteReach; public static MelonPreferences_Entry<float> BiteCooldown; public static MelonPreferences_Entry<float> BiteStaminaCost; public static MelonPreferences_Entry<float> HeadbiteDamage; public static MelonPreferences_Entry<BitePlayerMode> BitePlayers; public static MelonPreferences_Entry<bool> IdleSway; public static MelonPreferences_Entry<float> SwayIntensity; public static MelonPreferences_Entry<bool> ServerAllowCrawl; public static MelonPreferences_Entry<bool> ServerAllowPounce; public static MelonPreferences_Entry<bool> ServerAllowNpcStealth; public static MelonPreferences_Entry<bool> ServerAllowAmbushGrab; public static MelonPreferences_Entry<bool> ServerAllowPlayerGrab; public static MelonPreferences_Entry<bool> ServerAllowHeadbite; public static MelonPreferences_Entry<bool> StaminaEnabled; public static MelonPreferences_Entry<float> StaminaRegen; public static MelonPreferences_Entry<float> ScuttleDrain; public static MelonPreferences_Entry<float> PounceCostMin; public static MelonPreferences_Entry<float> PounceCostMax; public static MelonPreferences_Entry<bool> StaminaBar; public static MelonPreferences_Entry<bool> StaminaBarAutoHide; public static MelonPreferences_Entry<BarPosition> StaminaBarPosition; public static MelonPreferences_Entry<bool> LightEnabled; public static MelonPreferences_Entry<float> DarkThreshold; public static MelonPreferences_Entry<float> BrightThreshold; public static MelonPreferences_Entry<float> DarkSpeed; public static MelonPreferences_Entry<float> BrightSpeed; public static MelonPreferences_Entry<ServerRule> ServerStaminaRule; public static MelonPreferences_Entry<ServerRule> ServerLightRule; public static MelonPreferences_Entry<bool> PerformanceMode; public static MelonPreferences_Entry<bool> DebugRays; public static void Load() { _cat = MelonPreferences.CreateCategory("XenoCrawler"); Enabled = _cat.CreateEntry<bool>("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); CrawlSpeed = _cat.CreateEntry<float>("CrawlSpeed", 2.2f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); CrawlAcceleration = _cat.CreateEntry<float>("CrawlAcceleration", 14f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); Stickiness = _cat.CreateEntry<float>("Stickiness", 25f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); SurfaceGravity = _cat.CreateEntry<float>("SurfaceGravity", 9.81f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); Latch = _cat.CreateEntry<LatchMode>("LatchMode", LatchMode.Grip, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); Corners = _cat.CreateEntry<CornerMode>("CornerMode", CornerMode.StickAndGrip, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ReleaseGripToDrop = _cat.CreateEntry<bool>("ReleaseGripToDrop", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ProbeDistance = _cat.CreateEntry<float>("ProbeDistance", 1.1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); WallThreshold = _cat.CreateEntry<float>("WallThreshold", 0.65f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); TurnSpeed = _cat.CreateEntry<float>("TurnSpeed", 120f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); SwapSticks = _cat.CreateEntry<bool>("SwapSticks", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); HandOverHand = _cat.CreateEntry<bool>("HandOverHand", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); HandPullStrength = _cat.CreateEntry<float>("HandPullStrength", 60f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); LimbAntiClip = _cat.CreateEntry<bool>("LimbAntiClip", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); LimbSkin = _cat.CreateEntry<float>("LimbSkin", 0.03f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); LegStraighten = _cat.CreateEntry<float>("LegStraighten", 1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); SlipperyFeet = _cat.CreateEntry<bool>("SlipperyFeet", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); GripReachBeyond = _cat.CreateEntry<float>("GripReachBeyond", 0.6f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); CeilingLegLock = _cat.CreateEntry<float>("CeilingLegLock", 1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); TransitionTime = _cat.CreateEntry<float>("TransitionTime", 0.6f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); InstantSnap = _cat.CreateEntry<bool>("InstantSnap", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); LatchReach = _cat.CreateEntry<float>("LatchReach", 0.9f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); AirLatch = _cat.CreateEntry<bool>("AirLatch", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PounceEnabled = _cat.CreateEntry<bool>("PounceEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PounceMinSpeed = _cat.CreateEntry<float>("PounceMinSpeed", 4f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PounceMaxSpeed = _cat.CreateEntry<float>("PounceMaxSpeed", 11f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ScuttleMultiplier = _cat.CreateEntry<float>("ScuttleMultiplier", 1.75f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); AmbushBoost = _cat.CreateEntry<float>("AmbushDropBoost", 0f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); DropPush = _cat.CreateEntry<float>("DropPush", 0.4f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); AmbushGrab = _cat.CreateEntry<bool>("AmbushGrab", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); DescendReach = _cat.CreateEntry<float>("GrabDescendReach", 2.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MaxDescend = _cat.CreateEntry<float>("GrabMaxDropDepth", 2.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); DescendSpeed = _cat.CreateEntry<float>("GrabDescendSpeed", 1.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); GrabContact = _cat.CreateEntry<float>("GrabContactGap", 0.05f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); VictimWeight = _cat.CreateEntry<float>("GrabVictimWeight", 0f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); SurfaceLeap = _cat.CreateEntry<bool>("SurfaceLeap", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); LeapRange = _cat.CreateEntry<float>("SurfaceLeapRange", 4f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); LeapSpeed = _cat.CreateEntry<float>("SurfaceLeapSpeed", 4f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); GrabButton = _cat.CreateEntry<GrabButtonMode>("GrabButtonMode", GrabButtonMode.MoveStickClick, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); RiseWithVictim = _cat.CreateEntry<bool>("GrabRiseWithVictim", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); RiseWithPlayers = _cat.CreateEntry<bool>("GrabRiseWithPlayers", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); RiseWithVictimSpeed = _cat.CreateEntry<float>("GrabRiseWithVictimSpeed", 0.6f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); AmbushPullStrength = _cat.CreateEntry<float>("AmbushPullStrength", 120f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); GrabFromWalls = _cat.CreateEntry<bool>("GrabFromWalls", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); GrabPlayers = _cat.CreateEntry<bool>("GrabPlayers", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); CanBeGrabbed = _cat.CreateEntry<bool>("CanBeGrabbed", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); HeadbiteEnabled = _cat.CreateEntry<bool>("HeadbiteEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); BiteInput = _cat.CreateEntry<BiteInputMode>("BiteInput", BiteInputMode.BothTriggers, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); BiteButton = _cat.CreateEntry<BiteButtonMode>("BiteButton", BiteButtonMode.EitherTrigger, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ThrustSpeed = _cat.CreateEntry<float>("ThrustSpeed", 1.6f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); BiteReach = _cat.CreateEntry<float>("HeadbiteReach", 0.6f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); BiteCooldown = _cat.CreateEntry<float>("BiteCooldown", 2f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); BiteStaminaCost = _cat.CreateEntry<float>("BiteStaminaCost", 30f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); HeadbiteDamage = _cat.CreateEntry<float>("HeadbitePlayerDamage", 0.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); BitePlayers = _cat.CreateEntry<BitePlayerMode>("BitePlayers", BitePlayerMode.Off, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); IdleSway = _cat.CreateEntry<bool>("IdleSway", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); SwayIntensity = _cat.CreateEntry<float>("SwayIntensity", 1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ServerAllowCrawl = _cat.CreateEntry<bool>("ServerAllowCrawl", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ServerAllowPounce = _cat.CreateEntry<bool>("ServerAllowPounce", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ServerAllowNpcStealth = _cat.CreateEntry<bool>("ServerAllowNpcStealth", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ServerAllowAmbushGrab = _cat.CreateEntry<bool>("ServerAllowAmbushGrab", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ServerAllowPlayerGrab = _cat.CreateEntry<bool>("ServerAllowPlayerGrab", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ServerAllowHeadbite = _cat.CreateEntry<bool>("ServerAllowHeadbite", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); StaminaEnabled = _cat.CreateEntry<bool>("StaminaEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); StaminaRegen = _cat.CreateEntry<float>("StaminaRegen", 14f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ScuttleDrain = _cat.CreateEntry<float>("ScuttleDrain", 18f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PounceCostMin = _cat.CreateEntry<float>("PounceCostMin", 20f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PounceCostMax = _cat.CreateEntry<float>("PounceCostMax", 45f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); StaminaBar = _cat.CreateEntry<bool>("StaminaBar", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); StaminaBarAutoHide = _cat.CreateEntry<bool>("StaminaBarAutoHide", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); StaminaBarPosition = _cat.CreateEntry<BarPosition>("StaminaBarPosition", BarPosition.Hud, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); LightEnabled = _cat.CreateEntry<bool>("LightEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); DarkThreshold = _cat.CreateEntry<float>("DarkThreshold", 0.08f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); BrightThreshold = _cat.CreateEntry<float>("BrightThreshold", 0.6f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); DarkSpeed = _cat.CreateEntry<float>("DarkSpeed", 1.15f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); BrightSpeed = _cat.CreateEntry<float>("BrightSpeed", 0.75f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ServerStaminaRule = _cat.CreateEntry<ServerRule>("ServerStaminaRule", ServerRule.PlayerChoice, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ServerLightRule = _cat.CreateEntry<ServerRule>("ServerLightRule", ServerRule.PlayerChoice, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PerformanceMode = _cat.CreateEntry<bool>("PerformanceMode", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); DebugRays = _cat.CreateEntry<bool>("DebugRays", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); } public static void Save() { MelonPreferences_Category cat = _cat; if (cat != null) { cat.SaveToFile(false); } } } public class Main : MelonMod { public const string ModName = "XenoCrawler"; public const string ModVersion = "1.8.2"; public static Main Instance { get; private set; } public static Instance Log => ((MelonBase)Instance).LoggerInstance; public static bool FusionPresent { get; private set; } internal static bool IsInServer { get { if (FusionPresent) { return IsInServerFusion(); } return false; } } public override void OnInitializeMelon() { Instance = this; CrawlSettings.Load(); ((MelonBase)this).HarmonyInstance.CreateClassProcessor(typeof(ControllerInputPatch)).Patch(); ((MelonBase)this).HarmonyInstance.CreateClassProcessor(typeof(ControllerRigAlignPatch)).Patch(); Hooking.OnLevelLoaded += delegate { OnLevelChanged(); }; Hooking.OnLevelUnloaded += OnLevelChanged; Hooking.OnPlayerDeath += delegate(RigManager rm) { if ((Object)(object)rm == (Object)(object)Player.RigManager) { SurfaceCrawler.ForceDetach(pushOff: false); } }; BuildBoneMenu(); } public override void OnLateInitializeMelon() { FusionPresent = AppDomain.CurrentDomain.GetAssemblies().Any((Assembly a) => a.GetName().Name == "LabFusion"); if (FusionPresent) { TryRegisterFusion(); } else { ((MelonBase)this).LoggerInstance.Msg("LabFusion not found - running in single-player mode."); } } [MethodImpl(MethodImplOptions.NoInlining)] private void TryRegisterFusion() { try { FusionBridge.Register(); ((MelonBase)this).LoggerInstance.Msg("LabFusion module registered."); } catch (Exception value) { FusionPresent = false; ((MelonBase)this).LoggerInstance.Error($"Failed to register LabFusion module, multiplayer sync disabled: {value}"); } } [MethodImpl(MethodImplOptions.NoInlining)] internal static void TryTakeOwnership(Rigidbody rb) { if (!FusionPresent || (Object)(object)rb == (Object)null) { return; } try { TakeOwnershipFusion(rb); } catch (Exception ex) { Log.Warning("Couldn't take network ownership: " + ex.Message); } } [MethodImpl(MethodImplOptions.NoInlining)] private static void TakeOwnershipFusion(Rigidbody rb) { FusionBridge.TakeOwnership(rb); } internal static bool TryGetPlayerId(RigManager rig, out byte id) { id = 0; if (!FusionPresent || (Object)(object)rig == (Object)null) { return false; } try { return TryGetPlayerIdFusion(rig, out id); } catch (Exception ex) { Log.Warning("Player lookup failed: " + ex.Message); return false; } } [MethodImpl(MethodImplOptions.NoInlining)] private static bool TryGetPlayerIdFusion(RigManager rig, out byte id) { return FusionBridge.TryGetPlayerId(rig, out id); } internal static bool TryNativeGrab(Hand hand, Collider col) { if (IsInServer) { try { return TryNativeGrabFusion(hand, col); } catch (Exception ex) { Log.Warning("Native grab failed: " + ex.Message); return false; } } return OfflineGrab.TryAttach(hand, col); } [MethodImpl(MethodImplOptions.NoInlining)] private static bool TryNativeGrabFusion(Hand hand, Collider col) { return FusionBridge.TryNativeGrab(hand, col); } internal static void ReleaseNativeGrab(Hand hand) { if ((Object)(object)hand == (Object)null) { return; } if (!IsInServer) { OfflineGrab.TryDetach(hand); return; } try { ReleaseNativeGrabFusion(hand); } catch (Exception ex) { Log.Warning("Native release failed: " + ex.Message); } } internal static bool TryGetPlayerRig(byte id, out RigManager rig) { rig = null; if (!FusionPresent) { return false; } try { return TryGetPlayerRigFusion(id, out rig); } catch (Exception ex) { Log.Warning("Player rig lookup failed: " + ex.Message); return false; } } [MethodImpl(MethodImplOptions.NoInlining)] private static bool TryGetPlayerRigFusion(byte id, out RigManager rig) { return FusionBridge.TryGetPlayerRig(id, out rig); } [MethodImpl(MethodImplOptions.NoInlining)] private static void ReleaseNativeGrabFusion(Hand hand) { FusionBridge.ReleaseNativeGrab(hand); } internal static bool PlayerHasMod(byte id) { if (!FusionPresent) { return false; } try { return PlayerHasModFusion(id); } catch { return false; } } [MethodImpl(MethodImplOptions.NoInlining)] private static bool PlayerHasModFusion(byte id) { return FusionBridge.PlayerHasMod(id); } [MethodImpl(MethodImplOptions.NoInlining)] private static bool IsInServerFusion() { return FusionBridge.IsInServer; } internal static bool IsOwnedLocally(Rigidbody rb) { if (!FusionPresent) { return true; } try { return IsOwnedLocallyFusion(rb); } catch { return true; } } [MethodImpl(MethodImplOptions.NoInlining)] private static bool IsOwnedLocallyFusion(Rigidbody rb) { return FusionBridge.IsOwnedLocally(rb); } internal static void SendLethalBite(byte target, Vector3 origin, Vector3 dir) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) float num; switch (CrawlSettings.BitePlayers.Value) { case BitePlayerMode.Off: return; default: num = CrawlSettings.HeadbiteDamage.Value; break; case BitePlayerMode.Kill: num = 1000f; break; } float damage = num; if (!FusionPresent) { return; } try { SendLethalBiteFusion(target, origin, dir, damage); } catch (Exception ex) { Log.Warning("Couldn't send headbite: " + ex.Message); } } [MethodImpl(MethodImplOptions.NoInlining)] private static void SendLethalBiteFusion(byte target, Vector3 origin, Vector3 dir, float damage) { //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) FusionBridge.SendLethalBite(target, origin, dir, damage); } internal static void BroadcastBite(Vector3 origin, Vector3 dir) { //IL_0009: 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) if (!FusionPresent) { return; } try { BroadcastBiteFusion(origin, dir); } catch (Exception ex) { Log.Warning("Couldn't broadcast bite: " + ex.Message); } } [MethodImpl(MethodImplOptions.NoInlining)] private static void BroadcastBiteFusion(Vector3 origin, Vector3 dir) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) FusionBridge.BroadcastBite(origin, dir); } internal static void SendPlayerGrab(byte target, bool active, Vector3 point, float strength, bool reliable) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (!FusionPresent) { return; } try { SendPlayerGrabFusion(target, active, point, strength, reliable); } catch (Exception ex) { Log.Warning("Couldn't send grab: " + ex.Message); } } [MethodImpl(MethodImplOptions.NoInlining)] private static void SendPlayerGrabFusion(byte target, bool active, Vector3 point, float strength, bool reliable) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) FusionBridge.SendPlayerGrab(target, active, point, strength, reliable); } private static void OnLevelChanged() { SurfaceCrawler.ResetState(); AmbushGrab.ResetState(); GrabbedBy.ResetState(); Headbite.ResetState(); JawFx.ClearAll(); IdleSway.ResetState(); Stamina.ResetState(); LightSense.ResetState(); StaminaBar.Destroy(); DebugRays.Clear(); LimbClearance.ClearCache(); SurfaceAssist.ClearCache(); if (FusionPresent) { FusionTick.Reset(); } } public override void OnUpdate() { ServerPolicy.Tick(Time.deltaTime); LightSense.Update(Time.deltaTime); Headbite.Update(Time.deltaTime); JawFx.Update(Time.deltaTime); if (FusionPresent) { FusionTick.Update(); } } public override void OnFixedUpdate() { PerfTick.Advance(); SurfaceCrawler.FixedTick(Time.fixedDeltaTime); AmbushGrab.FixedTick(Time.fixedDeltaTime); GrabbedBy.FixedTick(Time.fixedDeltaTime); IdleSway.FixedTick(Time.fixedDeltaTime); Stamina.FixedTick(Time.fixedDeltaTime, SurfaceCrawler.IsScuttling); if (FusionPresent) { FusionTick.FixedUpdate(Time.fixedDeltaTime); } } public override void OnLateUpdate() { DebugRays.Flush(); StaminaBar.LateUpdate(Time.deltaTime); } private static void BuildBoneMenu() { //IL_0016: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_00ac: 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_0122: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_027a: 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_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_037f: 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_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_06c9: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0753: Unknown result type (might be due to invalid IL or missing references) //IL_0798: Unknown result type (might be due to invalid IL or missing references) //IL_07dd: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_0858: Unknown result type (might be due to invalid IL or missing references) //IL_088e: Unknown result type (might be due to invalid IL or missing references) //IL_08d3: Unknown result type (might be due to invalid IL or missing references) //IL_0918: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) //IL_0989: Unknown result type (might be due to invalid IL or missing references) //IL_09bf: Unknown result type (might be due to invalid IL or missing references) //IL_09f5: Unknown result type (might be due to invalid IL or missing references) //IL_0a3a: Unknown result type (might be due to invalid IL or missing references) //IL_0a7f: Unknown result type (might be due to invalid IL or missing references) //IL_0ac4: Unknown result type (might be due to invalid IL or missing references) //IL_0b09: Unknown result type (might be due to invalid IL or missing references) //IL_0b4e: Unknown result type (might be due to invalid IL or missing references) //IL_0b84: Unknown result type (might be due to invalid IL or missing references) //IL_0bba: Unknown result type (might be due to invalid IL or missing references) //IL_0bff: Unknown result type (might be due to invalid IL or missing references) //IL_0c44: Unknown result type (might be due to invalid IL or missing references) //IL_0c79: Unknown result type (might be due to invalid IL or missing references) //IL_0cd4: Unknown result type (might be due to invalid IL or missing references) //IL_0ce3: Unknown result type (might be due to invalid IL or missing references) //IL_0d1a: Unknown result type (might be due to invalid IL or missing references) //IL_0d56: Unknown result type (might be due to invalid IL or missing references) //IL_0d92: Unknown result type (might be due to invalid IL or missing references) //IL_0dd8: Unknown result type (might be due to invalid IL or missing references) //IL_0e1e: Unknown result type (might be due to invalid IL or missing references) //IL_0e64: Unknown result type (might be due to invalid IL or missing references) //IL_0eaa: Unknown result type (might be due to invalid IL or missing references) //IL_0ee5: Unknown result type (might be due to invalid IL or missing references) //IL_0f41: Unknown result type (might be due to invalid IL or missing references) //IL_0f50: Unknown result type (might be due to invalid IL or missing references) //IL_0f87: Unknown result type (might be due to invalid IL or missing references) //IL_0fbe: Unknown result type (might be due to invalid IL or missing references) //IL_0ffa: Unknown result type (might be due to invalid IL or missing references) //IL_1031: Unknown result type (might be due to invalid IL or missing references) //IL_1077: Unknown result type (might be due to invalid IL or missing references) //IL_10bd: Unknown result type (might be due to invalid IL or missing references) //IL_1103: Unknown result type (might be due to invalid IL or missing references) //IL_1149: Unknown result type (might be due to invalid IL or missing references) //IL_1180: Unknown result type (might be due to invalid IL or missing references) //IL_11c6: Unknown result type (might be due to invalid IL or missing references) //IL_120c: Unknown result type (might be due to invalid IL or missing references) //IL_1252: Unknown result type (might be due to invalid IL or missing references) //IL_1297: Unknown result type (might be due to invalid IL or missing references) //IL_12da: Unknown result type (might be due to invalid IL or missing references) //IL_12e9: Unknown result type (might be due to invalid IL or missing references) //IL_1320: Unknown result type (might be due to invalid IL or missing references) //IL_1357: Unknown result type (might be due to invalid IL or missing references) //IL_1393: Unknown result type (might be due to invalid IL or missing references) //IL_13cf: Unknown result type (might be due to invalid IL or missing references) //IL_1406: Unknown result type (might be due to invalid IL or missing references) //IL_143d: Unknown result type (might be due to invalid IL or missing references) //IL_1473: Unknown result type (might be due to invalid IL or missing references) //IL_149f: Unknown result type (might be due to invalid IL or missing references) //IL_14b1: Unknown result type (might be due to invalid IL or missing references) //IL_14eb: Unknown result type (might be due to invalid IL or missing references) //IL_1524: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); ((Color)(ref val))..ctor(0.45f, 1f, 0.55f); Color white = Color.white; Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.75f, 0.3f); Page obj = Page.Root.CreatePage("Xeno Crawler", val, 0, true); obj.CreateBool("Enabled", val, CrawlSettings.Enabled.Value, (Action<bool>)delegate(bool v) { CrawlSettings.Enabled.Value = v; if (!v) { SurfaceCrawler.ForceDetach(pushOff: false); } CrawlSettings.Save(); }); obj.CreateFunction("Drop From Surface", val2, (Action)delegate { SurfaceCrawler.ForceDetach(pushOff: true, 0f, calm: true); }); obj.CreateEnum("Latch Mode", val, (Enum)CrawlSettings.Latch.Value, (Action<Enum>)delegate(Enum v) { Set(CrawlSettings.Latch, (LatchMode)(object)v); }); obj.CreateEnum("Corner Transitions", val, (Enum)CrawlSettings.Corners.Value, (Action<Enum>)delegate(Enum v) { Set(CrawlSettings.Corners, (CornerMode)(object)v); }); obj.CreateBool("Release Grip To Drop", val, CrawlSettings.ReleaseGripToDrop.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.ReleaseGripToDrop, v); }); Page obj2 = obj.CreatePage("Crawl Locomotion", white, 0, true); obj2.CreateFloat("Crawl Speed", white, CrawlSettings.CrawlSpeed.Value, 0.25f, 0.25f, 10f, (Action<float>)delegate(float v) { Set(CrawlSettings.CrawlSpeed, v); }); obj2.CreateFloat("Acceleration", white, CrawlSettings.CrawlAcceleration.Value, 1f, 2f, 60f, (Action<float>)delegate(float v) { Set(CrawlSettings.CrawlAcceleration, v); }); obj2.CreateFloat("Stickiness Force", white, CrawlSettings.Stickiness.Value, 5f, 0f, 150f, (Action<float>)delegate(float v) { Set(CrawlSettings.Stickiness, v); }); obj2.CreateFloat("Surface Gravity", white, CrawlSettings.SurfaceGravity.Value, 0.5f, 1f, 30f, (Action<float>)delegate(float v) { Set(CrawlSettings.SurfaceGravity, v); }); obj2.CreateFloat("Probe Distance", white, CrawlSettings.ProbeDistance.Value, 0.1f, 0.4f, 3f, (Action<float>)delegate(float v) { Set(CrawlSettings.ProbeDistance, v); }); obj2.CreateFloat("Wall Threshold", white, CrawlSettings.WallThreshold.Value, 0.05f, 0.1f, 0.95f, (Action<float>)delegate(float v) { Set(CrawlSettings.WallThreshold, v); }); obj2.CreateFloat("Turn Speed", white, CrawlSettings.TurnSpeed.Value, 10f, 0f, 360f, (Action<float>)delegate(float v) { Set(CrawlSettings.TurnSpeed, v); }); obj2.CreateBool("Swap Sticks", white, CrawlSettings.SwapSticks.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.SwapSticks, v); }); obj2.CreateBool("Hand-Over-Hand", white, CrawlSettings.HandOverHand.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.HandOverHand, v); }); obj2.CreateFloat("Hand Pull Strength", white, CrawlSettings.HandPullStrength.Value, 5f, 0f, 200f, (Action<float>)delegate(float v) { Set(CrawlSettings.HandPullStrength, v); }); obj2.CreateBool("Limb Anti-Clip", white, CrawlSettings.LimbAntiClip.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.LimbAntiClip, v); }); obj2.CreateBool("Slippery Feet (Latched)", white, CrawlSettings.SlipperyFeet.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.SlipperyFeet, v); }); obj2.CreateFloat("Grip Reach Past Hand", white, CrawlSettings.GripReachBeyond.Value, 0.05f, 0.1f, 2f, (Action<float>)delegate(float v) { Set(CrawlSettings.GripReachBeyond, v); }); obj2.CreateFloat("Leg Straighten", white, CrawlSettings.LegStraighten.Value, 0.1f, 0f, 3f, (Action<float>)delegate(float v) { Set(CrawlSettings.LegStraighten, v); }); obj2.CreateFloat("Ceiling Leg Lock", white, CrawlSettings.CeilingLegLock.Value, 0.1f, 0f, 3f, (Action<float>)delegate(float v) { Set(CrawlSettings.CeilingLegLock, v); }); obj2.CreateFloat("Limb Skin Gap", white, CrawlSettings.LimbSkin.Value, 0.005f, 0f, 0.15f, (Action<float>)delegate(float v) { Set(CrawlSettings.LimbSkin, v); }); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.6f, 0.35f, 1f); Page obj3 = obj.CreatePage("Xenomorph", val3, 0, true); obj3.CreateFloat("Transition Time (s)", val3, CrawlSettings.TransitionTime.Value, 0.05f, 0.1f, 2f, (Action<float>)delegate(float v) { Set(CrawlSettings.TransitionTime, v); }); obj3.CreateBool("Instant Snap", val3, CrawlSettings.InstantSnap.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.InstantSnap, v); }); obj3.CreateFloat("Latch Reach", val3, CrawlSettings.LatchReach.Value, 0.1f, 0.3f, 2f, (Action<float>)delegate(float v) { Set(CrawlSettings.LatchReach, v); }); obj3.CreateBool("Air Latch (Automatic mode)", val3, CrawlSettings.AirLatch.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.AirLatch, v); }); obj3.CreateBool("Pounce (hold A)", val3, CrawlSettings.PounceEnabled.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.PounceEnabled, v); }); obj3.CreateFloat("Pounce Min Speed", val3, CrawlSettings.PounceMinSpeed.Value, 0.5f, 1f, 20f, (Action<float>)delegate(float v) { Set(CrawlSettings.PounceMinSpeed, v); }); obj3.CreateFloat("Pounce Max Speed", val3, CrawlSettings.PounceMaxSpeed.Value, 0.5f, 2f, 30f, (Action<float>)delegate(float v) { Set(CrawlSettings.PounceMaxSpeed, v); }); obj3.CreateFloat("Scuttle Multiplier", val3, CrawlSettings.ScuttleMultiplier.Value, 0.05f, 1f, 3f, (Action<float>)delegate(float v) { Set(CrawlSettings.ScuttleMultiplier, v); }); obj3.CreateFloat("Drop Push", val3, CrawlSettings.DropPush.Value, 0.1f, 0f, 3f, (Action<float>)delegate(float v) { Set(CrawlSettings.DropPush, v); }); obj3.CreateFloat("Ceiling Ambush Boost", val3, CrawlSettings.AmbushBoost.Value, 0.5f, 0f, 15f, (Action<float>)delegate(float v) { Set(CrawlSettings.AmbushBoost, v); }); obj3.CreateBool("Ceiling Ambush Grab", val3, CrawlSettings.AmbushGrab.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.AmbushGrab, v); }); obj3.CreateBool("Surface Leap (click move stick)", val3, CrawlSettings.SurfaceLeap.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.SurfaceLeap, v); }); obj3.CreateFloat("Leap Range", val3, CrawlSettings.LeapRange.Value, 0.5f, 1f, 10f, (Action<float>)delegate(float v) { Set(CrawlSettings.LeapRange, v); }); obj3.CreateFloat("Leap Speed", val3, CrawlSettings.LeapSpeed.Value, 0.5f, 1f, 12f, (Action<float>)delegate(float v) { Set(CrawlSettings.LeapSpeed, v); }); obj3.CreateEnum("Grab Button", val3, (Enum)CrawlSettings.GrabButton.Value, (Action<Enum>)delegate(Enum v) { Set(CrawlSettings.GrabButton, (GrabButtonMode)(object)v); }); obj3.CreateBool("Grab From Walls", val3, CrawlSettings.GrabFromWalls.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.GrabFromWalls, v); }); obj3.CreateBool("Grab Players", val3, CrawlSettings.GrabPlayers.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.GrabPlayers, v); }); obj3.CreateBool("Players Can Grab Me", val3, CrawlSettings.CanBeGrabbed.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.CanBeGrabbed, v); if (!v) { GrabbedBy.Release(); } }); obj3.CreateFloat("Grab Descend Reach", val3, CrawlSettings.DescendReach.Value, 0.25f, 0.5f, 4f, (Action<float>)delegate(float v) { Set(CrawlSettings.DescendReach, v); }); obj3.CreateFloat("Max Drop Depth", val3, CrawlSettings.MaxDescend.Value, 0.1f, 0.2f, 3f, (Action<float>)delegate(float v) { Set(CrawlSettings.MaxDescend, v); }); obj3.CreateFloat("Descend Speed", val3, CrawlSettings.DescendSpeed.Value, 0.1f, 0.3f, 4f, (Action<float>)delegate(float v) { Set(CrawlSettings.DescendSpeed, v); }); obj3.CreateFloat("Grab Contact Gap", val3, CrawlSettings.GrabContact.Value, 0.01f, 0f, 0.3f, (Action<float>)delegate(float v) { Set(CrawlSettings.GrabContact, v); }); obj3.CreateFloat("Held NPC Weight", val3, CrawlSettings.VictimWeight.Value, 0.1f, 0f, 1f, (Action<float>)delegate(float v) { Set(CrawlSettings.VictimWeight, v); }); obj3.CreateBool("Rise With Victim", val3, CrawlSettings.RiseWithVictim.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.RiseWithVictim, v); }); obj3.CreateBool("Rise With Players", val3, CrawlSettings.RiseWithPlayers.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.RiseWithPlayers, v); }); obj3.CreateFloat("Rise With Victim Speed", val3, CrawlSettings.RiseWithVictimSpeed.Value, 0.1f, 0.1f, 2f, (Action<float>)delegate(float v) { Set(CrawlSettings.RiseWithVictimSpeed, v); }); obj3.CreateFloat("No-Grip Hold Strength", val3, CrawlSettings.AmbushPullStrength.Value, 10f, 20f, 400f, (Action<float>)delegate(float v) { Set(CrawlSettings.AmbushPullStrength, v); }); obj3.CreateBool("Idle Sway", val3, CrawlSettings.IdleSway.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.IdleSway, v); }); obj3.CreateFloat("Sway Intensity", val3, CrawlSettings.SwayIntensity.Value, 0.1f, 0f, 3f, (Action<float>)delegate(float v) { Set(CrawlSettings.SwayIntensity, v); }); Color val4 = default(Color); ((Color)(ref val4))..ctor(0.9f, 0.3f, 0.35f); Page obj4 = obj.CreatePage("Headbite", val4, 0, true); obj4.CreateBool("Headbite", val4, CrawlSettings.HeadbiteEnabled.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.HeadbiteEnabled, v); }); obj4.CreateEnum("Bite Input", val4, (Enum)CrawlSettings.BiteInput.Value, (Action<Enum>)delegate(Enum v) { Set(CrawlSettings.BiteInput, (BiteInputMode)(object)v); }); obj4.CreateEnum("Bite Button", val4, (Enum)CrawlSettings.BiteButton.Value, (Action<Enum>)delegate(Enum v) { Set(CrawlSettings.BiteButton, (BiteButtonMode)(object)v); }); obj4.CreateFloat("Thrust Speed (m/s)", val4, CrawlSettings.ThrustSpeed.Value, 0.1f, 0.6f, 5f, (Action<float>)delegate(float v) { Set(CrawlSettings.ThrustSpeed, v); }); obj4.CreateFloat("Bite Reach", val4, CrawlSettings.BiteReach.Value, 0.05f, 0.15f, 1.2f, (Action<float>)delegate(float v) { Set(CrawlSettings.BiteReach, v); }); obj4.CreateFloat("Cooldown (s)", val4, CrawlSettings.BiteCooldown.Value, 0.25f, 0.25f, 10f, (Action<float>)delegate(float v) { Set(CrawlSettings.BiteCooldown, v); }); obj4.CreateFloat("Stamina Cost", val4, CrawlSettings.BiteStaminaCost.Value, 5f, 0f, 100f, (Action<float>)delegate(float v) { Set(CrawlSettings.BiteStaminaCost, v); }); obj4.CreateEnum("Bite Players", val4, (Enum)CrawlSettings.BitePlayers.Value, (Action<Enum>)delegate(Enum v) { Set(CrawlSettings.BitePlayers, (BitePlayerMode)(object)v); }); obj4.CreateFloat("Player Damage", val4, CrawlSettings.HeadbiteDamage.Value, 0.05f, 0.05f, 100f, (Action<float>)delegate(float v) { Set(CrawlSettings.HeadbiteDamage, v); }); Color val5 = default(Color); ((Color)(ref val5))..ctor(1f, 0.85f, 0.3f); Page obj5 = obj.CreatePage("Stamina & Light", val5, 0, true); obj5.CreateBool("Stamina", val5, CrawlSettings.StaminaEnabled.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.StaminaEnabled, v); }); obj5.CreateBool("Stamina Bar", val5, CrawlSettings.StaminaBar.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.StaminaBar, v); }); obj5.CreateEnum("Bar Position", val5, (Enum)CrawlSettings.StaminaBarPosition.Value, (Action<Enum>)delegate(Enum v) { Set(CrawlSettings.StaminaBarPosition, (BarPosition)(object)v); }); obj5.CreateBool("Auto-Hide When Full", val5, CrawlSettings.StaminaBarAutoHide.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.StaminaBarAutoHide, v); }); obj5.CreateFloat("Stamina Regen /s", val5, CrawlSettings.StaminaRegen.Value, 1f, 1f, 60f, (Action<float>)delegate(float v) { Set(CrawlSettings.StaminaRegen, v); }); obj5.CreateFloat("Scuttle Drain /s", val5, CrawlSettings.ScuttleDrain.Value, 1f, 0f, 60f, (Action<float>)delegate(float v) { Set(CrawlSettings.ScuttleDrain, v); }); obj5.CreateFloat("Pounce Cost Min", val5, CrawlSettings.PounceCostMin.Value, 5f, 0f, 100f, (Action<float>)delegate(float v) { Set(CrawlSettings.PounceCostMin, v); }); obj5.CreateFloat("Pounce Cost Max", val5, CrawlSettings.PounceCostMax.Value, 5f, 0f, 100f, (Action<float>)delegate(float v) { Set(CrawlSettings.PounceCostMax, v); }); obj5.CreateBool("Light Sensitivity", val5, CrawlSettings.LightEnabled.Value, (Action<bool>)delegate(bool v) { Set(CrawlSettings.LightEnabled, v); }); obj5.CreateFloat("Dark Threshold", val5, CrawlSettings.DarkThreshold.Value, 0.01f, 0f, 2f, (Action<float>)delegate(float v) { Set(CrawlSettings.DarkThreshold, v); }); obj5.CreateFloat("Bright Threshold", val5, CrawlSettings.BrightThreshold.Value, 0.05f, 0.05f, 5f, (Action<float>)delegate(float v) { Set(CrawlSettings.BrightThreshold, v); }); obj5.CreateFloat("Speed In Dark", val5, CrawlSettings.DarkSpeed.Value, 0.05f, 0.5f, 2f, (Action<float>)delegate(float v) { Set(CrawlSettings.DarkSpeed, v); }); obj5.CreateFloat("Speed In Light", val5, CrawlSettings.BrightSpeed.Value, 0.05f, 0.2f, 1.5f, (Action<float>)delegate(float v) { Set(CrawlSettings.BrightSpeed, v); }); obj5.CreateFunction("Show Stamina & Light", val5, (Action)delegate { string text = $"Stamina {(Stamina.Enabled ? $"{Stamina.Value:F0}/{100f:F0}{(Stamina.Exhausted ? " (exhausted)" : "")}" : "off")} | Light {(LightSense.Enabled ? $"{LightSense.Luminance:F3} (darkness {LightSense.Darkness:P0})" : "off")}"; Log.Msg(text); S