Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Physics Items v0.1.22
Physics_Items.dll
Decompiled 2 years agousing System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AdvancedCompany.Objects; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalConfig.AutoConfig; using LethalConfig.ConfigItems; using LethalThings; using Microsoft.CodeAnalysis; using MoreShipUpgrades.UpgradeComponents.Items.Wheelbarrow; using NeedyCats; using On; using On.GameNetcodeStuff; using Physics_Items.ItemPhysics; using Physics_Items.ItemPhysics.Environment; using Physics_Items.ModCompatFixes; using Physics_Items.NamedMessages; using Physics_Items.Properties; using Physics_Items.Utils; using ThrowEverything.Models; using Unity.Collections; using Unity.Netcode; using Unity.Netcode.Components; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AdvancedCompany")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("LethalConfig")] [assembly: IgnoresAccessChecksTo("LethalThings")] [assembly: IgnoresAccessChecksTo("MoreShipUpgrades")] [assembly: IgnoresAccessChecksTo("NeedyCats")] [assembly: IgnoresAccessChecksTo("Spantle.ThrowEverything")] [assembly: AssemblyCompany("Physics_Items")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Lethal Company Physics wooo!!")] [assembly: AssemblyFileVersion("0.1.22.0")] [assembly: AssemblyInformationalVersion("0.1.22")] [assembly: AssemblyProduct("Physics_Items")] [assembly: AssemblyTitle("Physics_Items")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.22.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Physics_Items { [BepInPlugin("Physics_Items", "Physics_Items", "0.1.22")] [BepInProcess("lethal company.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; internal static Plugin Instance; internal bool Initialized = false; internal bool ServerHasMod = false; internal HashSet<Type> manualSkipList = new HashSet<Type>(); internal HashSet<Type> blockList = new HashSet<Type>(); private string configDirectory = Paths.ConfigPath; internal ConfigEntry<bool> useSourceSounds; internal ConfigEntry<bool> physicsOnPickup; internal ConfigEntry<bool> disablePlayerCollision; internal ConfigEntry<float> maxCollisionVolume; internal ConfigEntry<bool> overrideAllItemPhysics; internal ConfigEntry<bool> InitializeConfigs; internal ConfigEntry<bool> DebuggingStuff; internal ConfigFile customBlockList; internal Dictionary<string, GrabbableObject> allItemsDictionary = new Dictionary<string, GrabbableObject>(); internal Assembly myAssembly; internal readonly Harmony Harmony = new Harmony("Physics_Items"); internal HashSet<GrabbableObject> skipObject = new HashSet<GrabbableObject>(); private void Awake() { //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Expected O, but got Unknown //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Expected O, but got Unknown //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Expected O, but got Unknown //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin Physics_Items is loaded!"); AssetLoader.LoadAssetBundles(); if (ThrowEverythingCompatibility.enabled) { ThrowEverythingCompatibility.ApplyFixes(); } if (AdvancedCompanyCompatibility.enabled) { AdvancedCompanyCompatibility.ApplyFixes(); } if (NeedyCatsCompatibility.enabled) { NeedyCatsCompatibility.ApplyFixes(); } if (LateGameUpgradesCompatibility.enabled) { LateGameUpgradesCompatibility.ApplyFixes(); } if (LethalConfigCompatibility.enabled) { LethalConfigCompatibility.ApplyFixes(); } Harmony.PatchAll(typeof(ModCheck)); Harmony.PatchAll(typeof(OnCollision)); myAssembly = Assembly.GetExecutingAssembly(); manualSkipList.Add(typeof(ExtensionLadderItem)); manualSkipList.Add(typeof(RadarBoosterItem)); InitializeConfigs = ((BaseUnityPlugin)this).Config.Bind<bool>("Technical", "Initialize Configs", true, "Re-Initializes all configs when set to true"); customBlockList = new ConfigFile(Path.Combine(configDirectory, "physicsItems_CustomBlockList.cfg"), true); useSourceSounds = ((BaseUnityPlugin)this).Config.Bind<bool>("Fun", "Use Source Engine Collision Sounds", false, "Use source rigidbody sounds."); overrideAllItemPhysics = ((BaseUnityPlugin)this).Config.Bind<bool>("Fun", "Override all Item Physics", false, "ALL Items will have physics, regardless of blocklist."); physicsOnPickup = ((BaseUnityPlugin)this).Config.Bind<bool>("Physics Behaviour", "Physics On Pickup", false, "Only enable item physisc when it has been picked up at least once."); disablePlayerCollision = ((BaseUnityPlugin)this).Config.Bind<bool>("Physics Behaviour", "Disable Player Collision", false, "Set if Physical Items can collide with players."); maxCollisionVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Physics Behaviour", "Max Collision Volume", 4f, "Sets the max volume each collision should have."); DebuggingStuff = ((BaseUnityPlugin)this).Config.Bind<bool>("Technical", "Debug", false, "Debug mode"); customBlockList.SettingChanged += CustomBlockList_SettingChanged; ((BaseUnityPlugin)this).Config.SettingChanged += Config_SettingChanged; if (InitializeConfigs.Value) { if (File.Exists(((BaseUnityPlugin)this).Config.ConfigFilePath)) { File.Delete(((BaseUnityPlugin)this).Config.ConfigFilePath); } ((BaseUnityPlugin)this).Config.Save(); Logger.Log((LogLevel)63, (object)"Initializing Configs.."); } Landmine.Init(); GrabbablePatches.Init(); PlayerControllerB.PlaceGrabbableObject += new hook_PlaceGrabbableObject(PlayerControllerB_PlaceGrabbableObject); PlayerControllerB.SetObjectAsNoLongerHeld += new hook_SetObjectAsNoLongerHeld(PlayerControllerB_SetObjectAsNoLongerHeld); PlayerControllerB.DropAllHeldItems += new hook_DropAllHeldItems(PlayerControllerB_DropAllHeldItems); MenuManager.Awake += new hook_Awake(MenuManager_Awake); } private void Config_SettingChanged(object sender, SettingChangedEventArgs e) { Logger.LogWarning((object)("Changed: " + e.ChangedSetting.Definition.Key + " to " + e.ChangedSetting.GetSerializedValue())); } private void CustomBlockList_SettingChanged(object sender, SettingChangedEventArgs e) { if (overrideAllItemPhysics.Value) { return; } Logger.LogWarning((object)("Changed Blocklist: " + e.ChangedSetting.Definition.Section + " to " + e.ChangedSetting.GetSerializedValue())); GrabbableObject val = allItemsDictionary[e.ChangedSetting.Definition.Section]; List<GrabbableObject> list = Object.FindObjectsByType<GrabbableObject>((FindObjectsInactive)0, (FindObjectsSortMode)0).ToList(); if (e.ChangedSetting.GetSerializedValue() == "true") { foreach (GrabbableObject item in list) { if (((object)item).GetType() == ((object)val).GetType()) { skipObject.Add(item); blockList.Add(((object)item).GetType()); } } return; } foreach (GrabbableObject item2 in list) { if (((object)item2).GetType() == ((object)val).GetType()) { skipObject.Remove(item2); blockList.Remove(((object)item2).GetType()); } } } private void InitializeNetworkTransformAndBlocklistConfig() { if (Initialized) { return; } GrabbableObject[] array = Resources.FindObjectsOfTypeAll<GrabbableObject>(); foreach (GrabbableObject val in array) { InitializeBlocklistConfig(val); if (!manualSkipList.Contains(((object)val).GetType()) && (Object)(object)((Component)val).gameObject.GetComponent<NetworkTransform>() == (Object)null) { NetworkTransform val2 = ((Component)val).gameObject.AddComponent<NetworkTransform>(); ((Behaviour)val2).enabled = false; } } Initialized = true; InitializeConfigs.Value = false; } private void InitializeBlocklistConfig(GrabbableObject grabbableObject) { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown bool flag = false; if ((Object)(object)grabbableObject == (Object)null) { return; } if ((Object)(object)grabbableObject.itemProperties == (Object)null) { Logger.LogWarning((object)"Skipping item with no item properties"); return; } if (Utility.IsNullOrWhiteSpace(grabbableObject.itemProperties.itemName)) { Logger.LogWarning((object)"Skipping item with no item name"); return; } if (manualSkipList.Contains(((object)grabbableObject).GetType()) || (Object)(object)((Component)grabbableObject).GetComponent<Rigidbody>() != (Object)null) { flag = true; } allItemsDictionary[grabbableObject.itemProperties.itemName] = grabbableObject; ConfigDefinition val = new ConfigDefinition(grabbableObject.itemProperties.itemName, "Add to blocklist"); customBlockList.Bind<bool>(val, flag, new ConfigDescription("If check/true, adds to blocklist. [REQUIRES RESTART]", (AcceptableValueBase)null, Array.Empty<object>())); if (InitializeConfigs.Value) { customBlockList[val].BoxedValue = flag; } if (customBlockList[val].GetSerializedValue() == "true") { skipObject.Add(grabbableObject); blockList.Add(((object)grabbableObject).GetType()); } Logger.LogInfo((object)$"Added: {grabbableObject.itemProperties.itemName} to config (Default: {flag}, current: {customBlockList[val].GetSerializedValue()})"); } private void PlayerControllerB_DropAllHeldItems(orig_DropAllHeldItems orig, PlayerControllerB self, bool itemsFall, bool disconnecting) { List<GrabbableObject> list = new List<GrabbableObject>(self.ItemSlots); orig.Invoke(self, itemsFall, disconnecting); if ((Object)(object)Physics.GetPhysicsComponent(((Component)self).gameObject) == (Object)null) { return; } for (int i = 0; i < list.Count; i++) { GrabbableObject val = list[i]; if (val != null && Physics.GetPhysicsComponent(((Component)val).gameObject, out var physicsComponent)) { skipObject.Add(val); physicsComponent.physicsHelperRef.why = true; physicsComponent.alreadyPickedUp = false; ((Behaviour)physicsComponent).enabled = false; } } } private void PlayerControllerB_PlaceGrabbableObject(orig_PlaceGrabbableObject orig, PlayerControllerB self, Transform parentObject, Vector3 positionOffset, bool matchRotationOfParent, GrabbableObject placeObject) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, parentObject, positionOffset, matchRotationOfParent, placeObject); Logger.LogWarning((object)"placing object"); if (!skipObject.Contains(placeObject)) { Physics.GetPhysicsComponent(((Component)placeObject).gameObject, out var physicsComponent); if (!((Object)(object)physicsComponent == (Object)null)) { physicsComponent.isPlaced = true; physicsComponent.rigidbody.isKinematic = true; ((Component)placeObject).gameObject.transform.rotation = Quaternion.Euler(placeObject.itemProperties.restingRotation.x, (float)(placeObject.floorYRot + placeObject.itemProperties.floorYOffset) + 90f, placeObject.itemProperties.restingRotation.z); ((Component)placeObject).gameObject.transform.localPosition = positionOffset; } } } private void PlayerControllerB_SetObjectAsNoLongerHeld(orig_SetObjectAsNoLongerHeld orig, PlayerControllerB self, bool droppedInElevator, bool droppedInShipRoom, Vector3 targetFloorPosition, GrabbableObject dropObject, int floorYRot) { //IL_0005: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, droppedInElevator, droppedInElevator, targetFloorPosition, dropObject, floorYRot); if (!skipObject.Contains(dropObject)) { Physics.GetPhysicsComponent(((Component)dropObject).gameObject, out var physicsComponent); if (!((Object)(object)physicsComponent == (Object)null)) { Vector3 val = dropObject.startFallingPosition - dropObject.targetFloorPosition; float magnitude = ((Vector3)(ref val)).magnitude; val = dropObject.targetFloorPosition - dropObject.startFallingPosition; Vector3 normalized = ((Vector3)(ref val)).normalized; Logger.LogWarning((object)$"Normalized: {normalized}"); bool flag = normalized + Vector3.up != Vector3.zero; float num = (flag ? Mathf.Min(physicsComponent.throwForce, 36f) : 0f); float num2 = ((num == 0f) ? 0f : Mathf.Min(magnitude * num, physicsComponent.rigidbody.mass * 10f)); Vector3 val2 = ((num2 == 0f) ? Vector3.zero : (normalized * num2)); Logger.LogWarning((object)$"Throwing with force: {val2}, {flag}, {num}, {physicsComponent.throwForce}, {physicsComponent.rigidbody.mass}"); physicsComponent.rigidbody.AddForce(val2, (ForceMode)1); } } } private void MenuManager_Awake(orig_Awake orig, MenuManager self) { orig.Invoke(self); InitializeNetworkTransformAndBlocklistConfig(); } } public static class PluginInfo { public const string PLUGIN_GUID = "Physics_Items"; public const string PLUGIN_NAME = "Physics_Items"; public const string PLUGIN_VERSION = "0.1.22"; } } namespace Physics_Items.Utils { internal class AssetLoader { internal static List<AudioClip> allAudioList { get; private set; } = new List<AudioClip>(); internal static AssetBundle bundle { get; private set; } internal static void LoadAssetBundles() { bundle = AssetBundle.LoadFromMemory(Resources.physicsitems); if ((Object)(object)bundle == (Object)null) { Plugin.Logger.LogWarning((object)"Assetbundle could not be loaded!"); return; } string[] allAssetNames = bundle.GetAllAssetNames(); foreach (string text in allAssetNames) { Object val = bundle.LoadAsset<Object>(text); if (val == (Object)null) { Plugin.Logger.LogWarning((object)("Asset " + text + " could not be loaded because it is not an Object!")); continue; } Plugin.Logger.LogWarning((object)("Loaded: " + text)); AudioClip val2 = (AudioClip)(object)((val is AudioClip) ? val : null); if (val2 != null && !allAudioList.Contains(val2)) { allAudioList.Add(val2); Plugin.Logger.LogInfo((object)("Added custom audio clip: " + ((Object)val2).name)); } } } } internal class ListUtil { public static T GetRandomElement<T>(List<T> objects, ref int index) { if (objects.Count == 0) { index = -1; return default(T); } index = Random.Range(0, objects.Count); return objects[index]; } public static T GetRandomElement<T>(List<T> objects) { int index = 0; return GetRandomElement(objects, ref index); } public static string[] GetLayersFromMask(int layerMask) { List<string> list = new List<string>(); for (int i = 0; i < 32; i++) { int num = 1 << i; if ((layerMask & num) == num) { list.Add(LayerMask.LayerToName(i)); } } return list.ToArray(); } } internal class Physics { internal static Dictionary<GameObject, PhysicsComponent> physicsComponents = new Dictionary<GameObject, PhysicsComponent>(); internal static List<PlayerControllerB> playerControllerBs = new List<PlayerControllerB>(); internal static PhysicsComponent GetPhysicsComponent(GameObject gameObj) { if (physicsComponents.ContainsKey(gameObj)) { return physicsComponents[gameObj]; } return gameObj.GetComponent<PhysicsComponent>(); } internal static bool GetPhysicsComponent(GameObject gameObj, out PhysicsComponent physicsComponent) { if (physicsComponents.ContainsKey(gameObj)) { physicsComponent = physicsComponents[gameObj]; } else { physicsComponent = gameObj.GetComponent<PhysicsComponent>(); physicsComponents[gameObj] = physicsComponent; } return (Object)(object)physicsComponent != (Object)null; } internal static bool RemovePhysicsComponent(GameObject gameObj) { if (!physicsComponents.ContainsKey(gameObj)) { return false; } physicsComponents.Remove(gameObj); return true; } } } namespace Physics_Items.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("Physics_Items.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] physicsitems { get { object @object = ResourceManager.GetObject("physicsitems", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace Physics_Items.NamedMessages { internal class ModCheck { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequest; public static HandleNamedMessageDelegate <1>__OnReceive; } public static bool hasSameModVersion = false; internal static string RequestModCheck = "PhysicsItemsRequestModCheck"; internal static string ReceiveModCheck = "PhysicsItemsReceiveModCheck"; [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPrefix] public static void STARTOFROUNDAWAKE() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown if (NetworkManager.Singleton.IsServer) { hasSameModVersion = true; CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; string requestModCheck = RequestModCheck; object obj = <>O.<0>__OnRequest; if (obj == null) { HandleNamedMessageDelegate val = OnRequest; <>O.<0>__OnRequest = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler(requestModCheck, (HandleNamedMessageDelegate)obj); Plugin.Logger.LogInfo((object)"Setting up Server CustomMessagingManager"); SyncOnLocalClient(); } else { CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager; string receiveModCheck = ReceiveModCheck; object obj2 = <>O.<1>__OnReceive; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceive; <>O.<1>__OnReceive = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler(receiveModCheck, (HandleNamedMessageDelegate)obj2); Plugin.Logger.LogInfo((object)"Setting up Client CustomMessagingManager"); SendRequestToServer(); } } private static void SendRequestToServer() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsClient) { Plugin.Logger.LogInfo((object)"Sending request to server."); string text = "0.1.22"; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(FastBufferWriter.GetWriteSize(text, false), (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe(text, false); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(RequestModCheck, 0uL, val, (NetworkDelivery)3); } else { Plugin.Logger.LogError((object)"Server cannot use method SendRequestToServer because you're already the server."); } } private static void SyncOnLocalClient() { Plugin.Instance.ServerHasMod = hasSameModVersion; } private static void OnReceive(ulong senderClientId, FastBufferReader messagePayload) { //IL_0007: 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) bool flag = default(bool); ((FastBufferReader)(ref messagePayload)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); hasSameModVersion = flag; Plugin.Logger.LogInfo((object)$"Received mod check: {hasSameModVersion} from server!"); SyncOnLocalClient(); } private static void OnRequest(ulong senderClientId, FastBufferReader messagePayload) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { Plugin.Logger.LogInfo((object)$"Player_ID: {senderClientId} Requested for Mod Check."); string text = default(string); ((FastBufferReader)(ref messagePayload)).ReadValueSafe(ref text, false); bool flag = text.Equals("0.1.22"); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(FastBufferWriter.GetWriteSize<bool>(ref flag, default(ForStructs)), (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(ReceiveModCheck, senderClientId, val, (NetworkDelivery)3); } } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPrefix] public static void OnDestroy() { if ((Object)(object)NetworkManager.Singleton != (Object)null) { if (NetworkManager.Singleton.IsServer) { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(RequestModCheck); Plugin.Logger.LogInfo((object)"Destroying Server CustomMessagingManager"); } else { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(ReceiveModCheck); Plugin.Logger.LogInfo((object)"Destroying Client CustomMessagingManager"); } } hasSameModVersion = false; } } internal class OnCollision { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnReceive; } internal static string CollisionCheck = "PhysicsItemsCollisionCheck"; [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPrefix] public static void StartOfRound_Awake() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; string collisionCheck = CollisionCheck; object obj = <>O.<0>__OnReceive; if (obj == null) { HandleNamedMessageDelegate val = OnReceive; <>O.<0>__OnReceive = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler(collisionCheck, (HandleNamedMessageDelegate)obj); } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPrefix] public static void OnDestroy() { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(CollisionCheck); Physics.physicsComponents.Clear(); } private static void OnReceive(ulong senderClientId, FastBufferReader messagePayload) { //IL_0007: 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) NetworkObjectReference val = default(NetworkObjectReference); ((FastBufferReader)(ref messagePayload)).ReadValueSafe<NetworkObjectReference>(ref val, default(ForNetworkSerializable)); NetworkObject val2 = default(NetworkObject); if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null)) { PhysicsComponent physicsComponent = Physics.GetPhysicsComponent(((Component)((Component)val2).transform).gameObject); if ((Object)(object)physicsComponent != (Object)null) { physicsComponent.PlayDropSFX(); } } } } } namespace Physics_Items.ModCompatFixes { internal static class AdvancedCompanyCompatibility { private static bool? _enabled; private static string modGUID = "com.potatoepet.AdvancedCompany"; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey(modGUID); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void ApplyFixes() { Plugin.Logger.LogInfo((object)("Applying compatibility fixes to: " + modGUID)); Plugin.Instance.manualSkipList.Add(typeof(LightningRod)); } } internal static class LateGameUpgradesCompatibility { private static bool? _enabled; private static string modGUID = "com.malco.lethalcompany.moreshipupgrades"; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey(modGUID); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void ApplyFixes() { Plugin.Logger.LogInfo((object)("Applying compatibility fixes to: " + modGUID)); Plugin.Instance.manualSkipList.Add(typeof(StoreWheelbarrow)); Plugin.Instance.manualSkipList.Add(typeof(ScrapWheelbarrow)); } } internal static class LethalConfigCompatibility { private static bool? _enabled; private static string modGUID = "ainavt.lc.lethalconfig"; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey(modGUID); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void ApplyFixes() { Plugin.Logger.LogInfo((object)("Applying compatibility fixes to: " + modGUID)); Plugin.Instance.Harmony.PatchAll(typeof(LethalConfigCompatibility)); } [HarmonyPatch(typeof(AutoConfigGenerator), "AutoGenerateConfigs")] [HarmonyPostfix] public static void AutoGenerateConfigs(ref AutoConfigItem[] __result) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> customBlock in Plugin.Instance.customBlockList) { BaseConfigItem val = AutoConfigGenerator.GenerateConfigForEntry(customBlock.Value); val.IsAutoGenerated = false; List<AutoConfigItem> list = __result.ToList(); AutoConfigItem item = default(AutoConfigItem); ((AutoConfigItem)(ref item)).ConfigItem = val; ((AutoConfigItem)(ref item)).Assembly = Plugin.Instance.myAssembly; list.Add(item); __result = list.ToArray(); } } } internal class LethalThingsCompatibility { [CompilerGenerated] private static class <>O { public static hook_SetObjectAsNoLongerHeld <0>__PlayerControllerB_SetObjectAsNoLongerHeld; } private static bool? _enabled; private static string modGUID = "evaisa.lethalthings"; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey(modGUID); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void ApplyFixes(PhysicsComponent comp) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown GrabbableObject grabbableObjectRef = comp.grabbableObjectRef; GrabbableObject val = grabbableObjectRef; GrabbableObject val2 = val; Dingus val3 = (Dingus)(object)((val2 is Dingus) ? val2 : null); if (val3 != null) { comp.rigidbody.constraints = (RigidbodyConstraints)112; comp.SetRotation(); } object obj = <>O.<0>__PlayerControllerB_SetObjectAsNoLongerHeld; if (obj == null) { hook_SetObjectAsNoLongerHeld val4 = PlayerControllerB_SetObjectAsNoLongerHeld; <>O.<0>__PlayerControllerB_SetObjectAsNoLongerHeld = val4; obj = (object)val4; } PlayerControllerB.SetObjectAsNoLongerHeld += (hook_SetObjectAsNoLongerHeld)obj; } private static void PlayerControllerB_SetObjectAsNoLongerHeld(orig_SetObjectAsNoLongerHeld orig, PlayerControllerB self, bool droppedInElevator, bool droppedInShipRoom, Vector3 targetFloorPosition, GrabbableObject dropObject, int floorYRot) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, droppedInElevator, droppedInShipRoom, targetFloorPosition, dropObject, floorYRot); Dingus val = (Dingus)(object)((dropObject is Dingus) ? dropObject : null); if (val != null) { Physics.GetPhysicsComponent(((Component)val).gameObject, out var physicsComponent); if (!((Object)(object)physicsComponent == (Object)null) && physicsComponent.alreadyPickedUp) { physicsComponent.SetRotation(); } } } } internal class NeedyCatsCompatibility { private static bool? _enabled; private static string modGUID = "Jordo.NeedyCats"; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey(modGUID); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void ApplyFixes() { Plugin.Logger.LogInfo((object)("Applying compatibility fixes to: " + modGUID)); Plugin.Instance.manualSkipList.Add(typeof(NeedyCatProp)); } } internal static class ThrowEverythingCompatibility { private static bool? _enabled; private static string modGUID = "Spantle.ThrowEverything"; private static Collider colliderCache; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey(modGUID); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void ApplyFixes() { Plugin.Logger.LogInfo((object)("Applying compatibility fixes to: " + modGUID)); Plugin.Instance.Harmony.PatchAll(typeof(ThrowEverythingCompatibility)); } [HarmonyPatch(typeof(ChargingThrow), "DrawLandingCircle")] [HarmonyPostfix] private static void DrawLandingCircle(ChargingThrow __instance) { if ((Object)(object)colliderCache == (Object)null) { colliderCache = __instance.preview.GetComponent<Collider>(); } colliderCache.isTrigger = true; } [HarmonyPatch(typeof(ChargingThrow), "Stop")] [HarmonyPostfix] private static void Stop() { colliderCache = null; } } } namespace Physics_Items.ItemPhysics { internal class DestroyHelper : MonoBehaviour { public GrabbableObject grabbableObjectRef; private void Start() { grabbableObjectRef = ((Component)this).GetComponent<GrabbableObject>(); } private void OnDestroy() { if ((Object)(object)grabbableObjectRef == (Object)null) { Plugin.Logger.LogWarning((object)"Grabbable object ref is null."); } else if (Plugin.Instance.skipObject.Contains(grabbableObjectRef)) { Plugin.Instance.skipObject.Remove(grabbableObjectRef); } } } internal class GrabbablePatches { [CompilerGenerated] private static class <>O { public static hook_Start <0>__GrabbableObject_Start; public static hook_Update <1>__GrabbableObject_Update; public static hook_EquipItem <2>__GrabbableObject_EquipItem; public static hook_EnablePhysics <3>__GrabbableObject_EnablePhysics; public static hook_OnPlaceObject <4>__GrabbableObject_OnPlaceObject; public static hook_ItemActivate <5>__GrabbableObject_ItemActivate; public static hook_GrabItem <6>__GrabbableObject_GrabItem; } public static void Init() { //IL_0011: 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_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00b6: 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_00c1: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown object obj = <>O.<0>__GrabbableObject_Start; if (obj == null) { hook_Start val = GrabbableObject_Start; <>O.<0>__GrabbableObject_Start = val; obj = (object)val; } GrabbableObject.Start += (hook_Start)obj; object obj2 = <>O.<1>__GrabbableObject_Update; if (obj2 == null) { hook_Update val2 = GrabbableObject_Update; <>O.<1>__GrabbableObject_Update = val2; obj2 = (object)val2; } GrabbableObject.Update += (hook_Update)obj2; object obj3 = <>O.<2>__GrabbableObject_EquipItem; if (obj3 == null) { hook_EquipItem val3 = GrabbableObject_EquipItem; <>O.<2>__GrabbableObject_EquipItem = val3; obj3 = (object)val3; } GrabbableObject.EquipItem += (hook_EquipItem)obj3; object obj4 = <>O.<3>__GrabbableObject_EnablePhysics; if (obj4 == null) { hook_EnablePhysics val4 = GrabbableObject_EnablePhysics; <>O.<3>__GrabbableObject_EnablePhysics = val4; obj4 = (object)val4; } GrabbableObject.EnablePhysics += (hook_EnablePhysics)obj4; object obj5 = <>O.<4>__GrabbableObject_OnPlaceObject; if (obj5 == null) { hook_OnPlaceObject val5 = GrabbableObject_OnPlaceObject; <>O.<4>__GrabbableObject_OnPlaceObject = val5; obj5 = (object)val5; } GrabbableObject.OnPlaceObject += (hook_OnPlaceObject)obj5; object obj6 = <>O.<5>__GrabbableObject_ItemActivate; if (obj6 == null) { hook_ItemActivate val6 = GrabbableObject_ItemActivate; <>O.<5>__GrabbableObject_ItemActivate = val6; obj6 = (object)val6; } GrabbableObject.ItemActivate += (hook_ItemActivate)obj6; object obj7 = <>O.<6>__GrabbableObject_GrabItem; if (obj7 == null) { hook_GrabItem val7 = GrabbableObject_GrabItem; <>O.<6>__GrabbableObject_GrabItem = val7; obj7 = (object)val7; } GrabbableObject.GrabItem += (hook_GrabItem)obj7; } internal static PhysicsComponent AddPhysicsComponent(GrabbableObject grabbableObject) { if ((Object)(object)((Component)grabbableObject).gameObject.GetComponent<NetworkObject>() == (Object)null) { return null; } if (Plugin.Instance.blockList.Contains(((object)grabbableObject).GetType())) { if (Plugin.Instance.overrideAllItemPhysics.Value) { return null; } Plugin.Logger.LogWarning((object)$"Skipping Blocked Item: {((Component)grabbableObject).gameObject}"); ((Component)grabbableObject).gameObject.AddComponent<DestroyHelper>(); Plugin.Instance.skipObject.Add(grabbableObject); return null; } PhysicsComponent physicsComponent = default(PhysicsComponent); if (!((Component)grabbableObject).gameObject.TryGetComponent<PhysicsComponent>(ref physicsComponent)) { physicsComponent = ((Component)grabbableObject).gameObject.AddComponent<PhysicsComponent>(); } if ((Object)(object)physicsComponent == (Object)null) { Plugin.Logger.LogError((object)$"Physics Component of {((Component)grabbableObject).gameObject} is null! This shouldn't happen!"); return null; } Plugin.Logger.LogInfo((object)$"Successfully added Physics Component to {((Component)grabbableObject).gameObject}."); Collider val = default(Collider); if (((Component)grabbableObject).TryGetComponent<Collider>(ref val)) { val.isTrigger = false; } return physicsComponent; } private static void GrabbableObject_EnablePhysics(orig_EnablePhysics orig, GrabbableObject self, bool enable) { PhysicsComponent physicsComponent; if (Plugin.Instance.skipObject.Contains(self)) { orig.Invoke(self, enable); } else if (Physics.GetPhysicsComponent(((Component)self).gameObject, out physicsComponent)) { physicsComponent.EnableColliders(enable); physicsComponent.rigidbody.isKinematic = !enable; if (enable) { physicsComponent.isPlaced = false; } } } private static void GrabbableObject_EquipItem(orig_EquipItem orig, GrabbableObject self) { orig.Invoke(self); if (!Plugin.Instance.skipObject.Contains(self)) { ((Component)self).transform.parent = null; self.EnablePhysics(false); } } private static void GrabbableObject_Start(orig_Start orig, GrabbableObject self) { if ((Object)(object)Physics.GetPhysicsComponent(((Component)self).gameObject) != (Object)null) { orig.Invoke(self); return; } PhysicsComponent physicsComponent = AddPhysicsComponent(self); if (Plugin.Instance.physicsOnPickup.Value && (Object)(object)physicsComponent != (Object)null) { ((Behaviour)physicsComponent).enabled = false; Plugin.Instance.skipObject.Add(self); } orig.Invoke(self); } private static void GrabbableObject_GrabItem(orig_GrabItem orig, GrabbableObject self) { orig.Invoke(self); if (Physics.GetPhysicsComponent(((Component)self).gameObject, out var physicsComponent)) { physicsComponent.alreadyPickedUp = true; if (physicsComponent.slow) { GameNetworkManager.Instance.localPlayerController.isMovementHindered = 0; physicsComponent.slow = false; } } } private static void GrabbableObject_ItemActivate(orig_ItemActivate orig, GrabbableObject self, bool used, bool buttonDown) { orig.Invoke(self, used, buttonDown); } private static void GrabbableObject_OnPlaceObject(orig_OnPlaceObject orig, GrabbableObject self) { orig.Invoke(self); if (!Plugin.Instance.skipObject.Contains(self)) { Physics.GetPhysicsComponent(((Component)self).gameObject, out var physicsComponent); if (!((Object)(object)physicsComponent == (Object)null)) { physicsComponent.EnableColliders(enable: true); physicsComponent.isPlaced = true; physicsComponent.rigidbody.isKinematic = true; } } } private static void GrabbableObject_Update(orig_Update orig, GrabbableObject self) { if (Plugin.Instance.skipObject.Contains(self)) { orig.Invoke(self); } else if (!((Object)(object)self == (Object)null)) { self.fallTime = 1f; self.reachedFloorTarget = true; bool isHeld = self.isHeld; self.isHeld = true; orig.Invoke(self); self.isHeld = isHeld; } } } [RequireComponent(typeof(GrabbableObject))] public class PhysicsComponent : MonoBehaviour, IHittable { public GrabbableObject grabbableObjectRef; public Collider collider; public Rigidbody rigidbody; public NetworkTransform networkTransform; public NetworkObject networkObject; public NetworkRigidbody networkRigidbody; public PhysicsHelper physicsHelperRef; public bool isPlaced = false; public Rigidbody scanNodeRigid; public float terminalVelocity; public float gravity = 9.8f; public float throwForce; public float oldVolume; public bool alreadyPickedUp = false; public Vector3 up; public AudioSource audioSource; public LungProp apparatusRef; public int gridSize = 5; public float cellSize = 2f; public Collider[] results = (Collider[])(object)new Collider[3]; private Vector3 lastVelocity; public float threshold = 0.1f; private bool oldValue = false; private Transform parent; private Vector3? relativePosition; private Vector3 oldPos; private Vector3 oldRelativePosition; private float magnitude; private static bool firstHit; private static Vector3 velocity; private static float velocityMag; public bool slow; public bool isHit = false; public Vector3 hitDir = Vector3.zero; private bool IsHostOrServer => NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer; private void Awake() { //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) string text = (IsHostOrServer ? "Host" : "Client"); Plugin.Logger.LogWarning((object)("Awake called by: " + text)); grabbableObjectRef = ((Component)this).gameObject.GetComponent<GrabbableObject>(); if ((Object)(object)grabbableObjectRef == (Object)null) { Plugin.Logger.LogError((object)$"GrabbableObject component does not exist for Game Object {((Component)this).gameObject}. This is not allowed!"); return; } if (!((Component)this).TryGetComponent<Rigidbody>(ref rigidbody)) { rigidbody = ((Component)this).gameObject.AddComponent<Rigidbody>(); rigidbody.collisionDetectionMode = (CollisionDetectionMode)1; } networkObject = ((Component)this).GetComponent<NetworkObject>(); ScanNodeProperties componentInChildren = ((Component)this).GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren != (Object)null && !((Component)componentInChildren).gameObject.TryGetComponent<Rigidbody>(ref scanNodeRigid)) { scanNodeRigid = ((Component)componentInChildren).gameObject.AddComponent<Rigidbody>(); Plugin.Logger.LogInfo((object)$"Added Rigidbody to {((Component)this).gameObject} ScanNode"); } if (!((Component)this).TryGetComponent<NetworkTransform>(ref networkTransform) && (Object)(object)networkObject != (Object)null) { networkTransform = ((Component)this).gameObject.AddComponent<NetworkTransform>(); Plugin.Logger.LogWarning((object)$"Successfully added NetworkTransform to {((Component)this).gameObject}"); } if (!((Component)this).TryGetComponent<NetworkRigidbody>(ref networkRigidbody) && (Object)(object)networkObject != (Object)null) { networkRigidbody = ((Component)this).gameObject.AddComponent<NetworkRigidbody>(); } GrabbableObject obj = grabbableObjectRef; LungProp val = (LungProp)(object)((obj is LungProp) ? obj : null); if (val != null && (Object)(object)val != (Object)null) { apparatusRef = val; } audioSource = ((Component)this).gameObject.GetComponent<AudioSource>(); physicsHelperRef = ((Component)this).gameObject.AddComponent<PhysicsHelper>(); collider = ((Component)this).gameObject.GetComponent<Collider>(); oldVolume = audioSource.volume; throwForce = rigidbody.mass * 10f; up = grabbableObjectRef.itemProperties.verticalOffset * Vector3.up; grabbableObjectRef.itemProperties.syncDiscardFunction = true; if (LethalThingsCompatibility.enabled) { LethalThingsCompatibility.ApplyFixes(this); } } public void FixPosition() { //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_0070: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_0408: 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_0105: 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_010f: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0474: 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_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) if (rigidbody.isKinematic) { return; } Dictionary<Vector3, GameObject> dictionary = new Dictionary<Vector3, GameObject>(); Vector3 val = Vector3.zero; float num = float.PositiveInfinity; Vector3 val3 = default(Vector3); for (int i = 0; i < gridSize; i++) { for (int j = 0; j < gridSize; j++) { Vector3 val2 = new Vector3((float)(i - gridSize / 2) * cellSize / 2f, 0f, (float)(j - gridSize / 2) * cellSize / 2f) + new Vector3(cellSize, 0f, cellSize) * 0.5f; if (val2 == new Vector3(cellSize, 0f, cellSize) * 0.5f) { val2 = Vector3.zero; } ((Vector3)(ref val3))..ctor(cellSize / 2f, cellSize / 2f, cellSize / 2f); val2 += ((Component)this).transform.position; Material val4 = null; if (Plugin.Instance.DebuggingStuff.Value) { dictionary[val2] = GameObject.CreatePrimitive((PrimitiveType)3); dictionary[val2].layer = 6; dictionary[val2].transform.position = val2; dictionary[val2].transform.localScale = val3; dictionary[val2].GetComponent<Collider>().isTrigger = true; dictionary[val2].GetComponent<Collider>().enabled = false; Plugin.Logger.LogInfo((object)$"Found cell: {val2}"); val4 = dictionary[val2].GetComponent<Renderer>().material; val4.shader = Shader.Find("HDRP/Lit"); } int num2 = Physics.OverlapBoxNonAlloc(val2, val3, results, Quaternion.identity, 2318, (QueryTriggerInteraction)1); if (num2 > 1 && num2 > 0) { continue; } if (Plugin.Instance.DebuggingStuff.Value) { Plugin.Logger.LogWarning((object)$"Found free spot at: {val2}"); } if ((Object)(object)val4 != (Object)null) { val4.color = Color.yellow; } float num3 = Vector3.Distance(val2, ((Component)this).transform.position); if (num3 < num) { if (Plugin.Instance.DebuggingStuff.Value) { Plugin.Logger.LogWarning((object)$"Found closer distance at: {val2}"); } num = num3; val = val2; if (val == ((Component)this).transform.position) { break; } } } } if (num != float.PositiveInfinity) { if (Plugin.Instance.DebuggingStuff.Value) { Plugin.Logger.LogWarning((object)$"Moving item to closest free spot at: {val}"); GameObject val5 = GameObject.CreatePrimitive((PrimitiveType)3); val5.layer = 6; val5.transform.position = ((Component)this).transform.position; val5.transform.localScale = new Vector3(cellSize / 2f, cellSize / 2f, cellSize / 2f); Material material = val5.GetComponent<Renderer>().material; material.shader = Shader.Find("HDRP/Lit"); material.color = Color.blue; material.color = new Color(material.color.r, material.color.g, material.color.b, 0.5f); val5.GetComponent<Collider>().isTrigger = true; val5.GetComponent<Collider>().enabled = false; } ((Component)this).transform.position = val; if (Plugin.Instance.DebuggingStuff.Value && dictionary.ContainsKey(val)) { Material material2 = dictionary[val].GetComponent<Renderer>().material; material2.color = Color.green; } } } public void SetPosition() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0031: Unknown result type (might be due to invalid IL or missing references) Transform val = GetParent(); if ((Object)(object)val != (Object)(object)((Component)this).transform) { Vector3 localPosition = val.InverseTransformPoint(((Component)this).transform.position); ((Component)this).transform.localPosition = localPosition; } } public void SetRotation() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (grabbableObjectRef.floorYRot == -1) { ((Component)this).transform.rotation = Quaternion.Euler(grabbableObjectRef.itemProperties.restingRotation.x, ((Component)grabbableObjectRef).transform.eulerAngles.y, grabbableObjectRef.itemProperties.restingRotation.z); } else { ((Component)this).transform.rotation = Quaternion.Euler(grabbableObjectRef.itemProperties.restingRotation.x, (float)(grabbableObjectRef.floorYRot + grabbableObjectRef.itemProperties.floorYOffset) + 90f, grabbableObjectRef.itemProperties.restingRotation.z); } } private void InitializeVariables() { //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) alreadyPickedUp = !Plugin.Instance.physicsOnPickup.Value; grabbableObjectRef.itemProperties.itemSpawnsOnGround = Plugin.Instance.physicsOnPickup.Value; rigidbody.collisionDetectionMode = (CollisionDetectionMode)2; rigidbody.drag = 0.1f; if ((Object)(object)apparatusRef != (Object)null) { rigidbody.isKinematic = apparatusRef.isLungDocked || apparatusRef.isLungDockedInElevator || isPlaced; } else { rigidbody.isKinematic = isPlaced; } networkTransform.SyncScaleX = false; networkTransform.SyncScaleY = false; networkTransform.SyncScaleZ = false; ((Behaviour)networkTransform).enabled = Plugin.Instance.ServerHasMod; grabbableObjectRef.fallTime = 1f; grabbableObjectRef.reachedFloorTarget = true; Plugin.Instance.skipObject.Remove(grabbableObjectRef); if ((Object)(object)scanNodeRigid != (Object)null) { scanNodeRigid.isKinematic = true; scanNodeRigid.useGravity = false; } rigidbody.velocity = Vector3.zero; FixPosition(); rigidbody.velocity = Vector3.zero; } private void UninitializeVariables() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) Plugin.Logger.LogWarning((object)"disable"); grabbableObjectRef.EnablePhysics(false); Plugin.Instance.skipObject.Add(grabbableObjectRef); EnableColliders(enable: true); grabbableObjectRef.fallTime = 0f; grabbableObjectRef.reachedFloorTarget = false; audioSource.volume = oldVolume; ((Behaviour)networkTransform).enabled = false; firstHit = false; hitDir = Vector3.zero; oldValue = false; } private void OnEnable() { InitializeVariables(); } private void OnDisable() { UninitializeVariables(); } private bool HasRequiredComponents() { if ((Object)(object)rigidbody == (Object)null) { Plugin.Logger.LogError((object)$"Rigidbody doesn't exist for Game Object {((Component)this).gameObject}"); return false; } if ((Object)(object)networkTransform == (Object)null) { Plugin.Logger.LogError((object)$"Network transform doesn't exist for Game Object {((Component)this).gameObject}"); return false; } if ((Object)(object)((Component)this).GetComponent<NetworkObject>() == (Object)null) { Plugin.Logger.LogError((object)$"{((Component)this).gameObject} has Network Transform even though its not a network object."); return false; } if ((Object)(object)grabbableObjectRef == (Object)null) { Plugin.Logger.LogError((object)$"{((Component)this).gameObject} Does not have a valid grabbable object component to reference from."); return false; } return true; } private void Start() { if (HasRequiredComponents()) { rigidbody.useGravity = false; float num = grabbableObjectRef.itemProperties.weight * 105f - 105f; rigidbody.mass = Mathf.Max(num, 1f); terminalVelocity = MathF.Sqrt(2f * rigidbody.mass * gravity); grabbableObjectRef.itemProperties.itemSpawnsOnGround = false; if (StartOfRound.Instance.inShipPhase) { grabbableObjectRef.fallTime = 1f; grabbableObjectRef.hasHitGround = true; grabbableObjectRef.scrapPersistedThroughRounds = true; grabbableObjectRef.isInElevator = true; grabbableObjectRef.isInShipRoom = true; } } } protected virtual void FixedUpdate() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (IsHostOrServer || !Plugin.Instance.ServerHasMod) { if (!rigidbody.isKinematic && !grabbableObjectRef.isHeld) { rigidbody.useGravity = false; rigidbody.AddForce(Vector3.down * gravity, (ForceMode)5); } else { rigidbody.AddForce(Vector3.zero, (ForceMode)2); } } } public void EnableColliders(bool enable) { for (int i = 0; i < grabbableObjectRef.propColliders.Length; i++) { if (!((Object)(object)grabbableObjectRef.propColliders[i] == (Object)null) && !((Component)grabbableObjectRef.propColliders[i]).gameObject.CompareTag("InteractTrigger") && !((Component)grabbableObjectRef.propColliders[i]).gameObject.CompareTag("DoNotSet")) { grabbableObjectRef.propColliders[i].enabled = enable; } } } private void MoveWithParent() { } protected virtual void Update() { if (slow) { GameNetworkManager.Instance.localPlayerController.isMovementHindered = (int)(rigidbody.mass / 1f) - 1; } if (oldValue != Plugin.Instance.ServerHasMod) { oldValue = Plugin.Instance.ServerHasMod; Plugin.Logger.LogWarning((object)$"Setting {((Component)this).gameObject} Network Transform enabled to {Plugin.Instance.ServerHasMod}"); ((Behaviour)networkTransform).enabled = Plugin.Instance.ServerHasMod; } if ((Object)(object)apparatusRef != (Object)null) { bool flag = apparatusRef.isLungDocked || apparatusRef.isLungDockedInElevator || (!StartOfRound.Instance.shipHasLanded && !StartOfRound.Instance.inShipPhase) || isPlaced; if (rigidbody.isKinematic == flag) { return; } rigidbody.isKinematic = flag; } else { rigidbody.isKinematic = ((grabbableObjectRef.isInShipRoom || grabbableObjectRef.isInElevator) && !StartOfRound.Instance.shipHasLanded && !StartOfRound.Instance.inShipPhase) || isPlaced; } if ((grabbableObjectRef.isInShipRoom || grabbableObjectRef.isInElevator) && rigidbody.isKinematic && !isPlaced) { alreadyPickedUp = false; SetPosition(); ((Behaviour)this).enabled = false; } } public static float FastInverseSqrt(float number) { float num = number * 0.5f; float value = number; int num2 = BitConverter.ToInt32(BitConverter.GetBytes(value), 0); num2 = 1597463007 - (num2 >> 1); value = BitConverter.ToSingle(BitConverter.GetBytes(num2), 0); value *= 1.5f - num * value * value; return 1f / value; } public Transform GetParent() { if ((Object)(object)grabbableObjectRef.parentObject != (Object)null) { parent = grabbableObjectRef.parentObject; } else if ((Object)(object)((Component)this).transform.parent != (Object)null) { parent = ((Component)this).transform.parent; } else { parent = ((Component)this).transform; } return parent; } public void PlayDropSFX() { //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_0043: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; if (isHit) { isHit = false; float num = Mathf.Min(throwForce, 36f); float num2 = Mathf.Min(num, rigidbody.mass * 10f); val = hitDir * num2; rigidbody.velocity = val; } if ((Object)(object)grabbableObjectRef.itemProperties.dropSFX != (Object)null) { AudioClip val2 = grabbableObjectRef.itemProperties.dropSFX; if (Plugin.Instance.useSourceSounds.Value) { val2 = ListUtil.GetRandomElement(AssetLoader.allAudioList); } if ((Object)(object)audioSource != (Object)null) { float volume; if (val != Vector3.zero) { volume = Mathf.Min(((Vector3)(ref val)).magnitude, Plugin.Instance.maxCollisionVolume.Value); Plugin.Logger.LogWarning((object)"wat"); } else { volume = Mathf.Clamp(velocityMag, 0.2f, Plugin.Instance.maxCollisionVolume.Value); } audioSource.volume = volume; audioSource.PlayOneShot(val2, audioSource.volume); } if (((NetworkBehaviour)grabbableObjectRef).IsOwner) { RoundManager.Instance.PlayAudibleNoise(((Component)this).gameObject.transform.position, 8f, 0.5f, 0, grabbableObjectRef.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 941); } } grabbableObjectRef.hasHitGround = true; } protected virtual void OnCollisionExit(Collision collision) { if (collision.gameObject.layer == 26) { slow = false; GameNetworkManager.Instance.localPlayerController.isMovementHindered = 0; } } protected virtual void OnCollisionEnter(Collision collision) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00f5: Unknown result type (might be due to invalid IL or missing references) if (collision.gameObject.layer == 26 && Plugin.Instance.disablePlayerCollision.Value) { Physics.IgnoreCollision(collider, collision.gameObject.GetComponent<Collider>(), true); return; } if (collision.gameObject.layer == 26) { slow = true; } if (!firstHit) { firstHit = true; return; } if (IsHostOrServer) { NetworkObjectReference val = NetworkObjectReference.op_Implicit(networkObject); FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(FastBufferWriter.GetWriteSize<NetworkObjectReference>(ref val, default(ForStructs)), (Allocator)2, -1); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref val, default(ForNetworkSerializable)); foreach (NetworkClient connectedClients in NetworkManager.Singleton.ConnectedClientsList) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(OnCollision.CollisionCheck, connectedClients.ClientId, val2, (NetworkDelivery)3); } } else if (!Plugin.Instance.ServerHasMod) { PlayDropSFX(); } velocity = rigidbody.velocity; velocityMag = FastInverseSqrt(((Vector3)(ref velocity)).sqrMagnitude); } private void OnDestroy() { Physics.RemovePhysicsComponent(((Component)this).gameObject); } protected virtual void LateUpdate() { //IL_0073: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_00c3: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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) if ((Object)(object)grabbableObjectRef == (Object)null) { Plugin.Logger.LogError((object)$"{((Component)this).gameObject} Does not have a valid grabbable object component to reference from. Destroying script."); Object.Destroy((Object)(object)this); return; } if ((Object)(object)grabbableObjectRef.parentObject != (Object)null && grabbableObjectRef.isHeld) { ((Component)this).transform.rotation = grabbableObjectRef.parentObject.rotation; Vector3 rotationOffset = grabbableObjectRef.itemProperties.rotationOffset; ((Component)this).transform.Rotate(rotationOffset); ((Component)this).transform.position = grabbableObjectRef.parentObject.position; Vector3 positionOffset = grabbableObjectRef.itemProperties.positionOffset; positionOffset = grabbableObjectRef.parentObject.rotation * positionOffset; Transform transform = ((Component)this).transform; transform.position += positionOffset; } if ((Object)(object)grabbableObjectRef.radarIcon != (Object)null) { grabbableObjectRef.radarIcon.position = ((Component)this).transform.position; } } public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0048: 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_008a: Unknown result type (might be due to invalid IL or missing references) hitDir = hitDirection; isHit = true; if (IsHostOrServer) { NetworkObjectReference val = NetworkObjectReference.op_Implicit(networkObject); FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(FastBufferWriter.GetWriteSize<NetworkObjectReference>(ref val, default(ForStructs)), (Allocator)2, -1); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref val, default(ForNetworkSerializable)); foreach (NetworkClient connectedClients in NetworkManager.Singleton.ConnectedClientsList) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(OnCollision.CollisionCheck, connectedClients.ClientId, val2, (NetworkDelivery)3); } } else if (!Plugin.Instance.ServerHasMod) { PlayDropSFX(); } return true; } } public class PhysicsHelper : MonoBehaviour { private PhysicsComponent physicsComponentRef; private GrabbableObject grabbableObjectRef; private Type cachedType; public bool why = false; private void Awake() { if (!((Component)this).TryGetComponent<PhysicsComponent>(ref physicsComponentRef)) { Plugin.Logger.LogWarning((object)"Tried to add Physics Helper to an object without Physics Component. Destroying component"); Object.Destroy((Object)(object)this); } else { grabbableObjectRef = physicsComponentRef.grabbableObjectRef; cachedType = ((object)physicsComponentRef).GetType(); } } private void Update() { if ((!grabbableObjectRef.isHeld && Plugin.Instance.physicsOnPickup.Value) || !physicsComponentRef.alreadyPickedUp) { return; } if (!physicsComponentRef.alreadyPickedUp && !physicsComponentRef.alreadyPickedUp != Plugin.Instance.physicsOnPickup.Value && physicsComponentRef.grabbableObjectRef.hasHitGround && why) { physicsComponentRef.alreadyPickedUp = true; ((Behaviour)physicsComponentRef).enabled = true; why = false; physicsComponentRef.SetRotation(); } if (!physicsComponentRef.alreadyPickedUp) { return; } if (physicsComponentRef.rigidbody.isKinematic && !StartOfRound.Instance.shipHasLanded && !StartOfRound.Instance.inShipPhase && (physicsComponentRef.grabbableObjectRef.isInShipRoom || physicsComponentRef.grabbableObjectRef.isInElevator) && !physicsComponentRef.isPlaced) { if (((Behaviour)physicsComponentRef).enabled) { ((Behaviour)physicsComponentRef).enabled = false; } } else if (!((Behaviour)physicsComponentRef).enabled) { ((Behaviour)physicsComponentRef).enabled = true; } } } } namespace Physics_Items.ItemPhysics.Environment { internal class Landmine { [CompilerGenerated] private static class <>O { public static hook_SpawnExplosion <0>__Landmine_SpawnExplosion; } private static Vector3 previousExplosion = Vector3.zero; public static void Init() { //IL_0011: 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_001c: Expected O, but got Unknown object obj = <>O.<0>__Landmine_SpawnExplosion; if (obj == null) { hook_SpawnExplosion val = Landmine_SpawnExplosion; <>O.<0>__Landmine_SpawnExplosion = val; obj = (object)val; } Landmine.SpawnExplosion += (hook_SpawnExplosion)obj; } private static void Landmine_SpawnExplosion(orig_SpawnExplosion orig, Vector3 explosionPosition, bool spawnExplosionEffect, float killRange, float damageRange) { //IL_0002: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(explosionPosition, spawnExplosionEffect, killRange, damageRange); previousExplosion = explosionPosition; List<Collider> list = Physics.OverlapSphere(explosionPosition, 6f, 64, (QueryTriggerInteraction)2).ToList(); for (int i = 0; i < list.Count; i++) { Vector3 val = explosionPosition + Vector3.up - ((Component)list[i]).transform.position; float num = PhysicsComponent.FastInverseSqrt(((Vector3)(ref val)).sqrMagnitude); Vector3 normalized = ((Vector3)(ref val)).normalized; if (Physics.GetPhysicsComponent(((Component)list[i]).gameObject, out var physicsComponent)) { physicsComponent.alreadyPickedUp = true; physicsComponent.grabbableObjectRef.EnablePhysics(true); physicsComponent.rigidbody.velocity = val * 80f / num; } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }