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 MagneticPickups v1.2.0
MagneticPickups.dll
Decompiled 2 years agousing System; using System.Collections.ObjectModel; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using On.RoR2; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MagneticPickups")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+8437fd6ce29098385886d29a11ed9bc81ab71a38")] [assembly: AssemblyProduct("MagneticPickups")] [assembly: AssemblyTitle("MagneticPickups")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] namespace MagneticPickups; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.blappole.magneticpickups", "Magnetic Pickups", "1.1.1")] public class MagneticPickups : BaseUnityPlugin { public static ConfigEntry<float> PickupSpeed { get; set; } public static ConfigEntry<float> PickupMoveUpwardsSpeed { get; set; } public static ConfigEntry<float> PickupRadius { get; set; } public static ConfigFile MagneticPickupsConfigFile { get; set; } public void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0029: 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_0048: Expected O, but got Unknown //IL_0048: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_007b: Expected O, but got Unknown //IL_008f: 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_00ae: Expected O, but got Unknown //IL_00ae: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown MagneticPickupsConfigFile = new ConfigFile(Paths.ConfigPath + "\\MagneticPickups.cfg", true); PickupSpeed = MagneticPickupsConfigFile.Bind<float>(new ConfigDefinition("Pickups", "PickupSpeed"), 25f, new ConfigDescription("The speed with which the pickups will move towards players", (AcceptableValueBase)null, Array.Empty<object>())); PickupMoveUpwardsSpeed = MagneticPickupsConfigFile.Bind<float>(new ConfigDefinition("Pickups", "PickupMoveUpwardsSpeed"), 1.25f, new ConfigDescription("The upwards velocity to add to the pickups before they start moving towards a player", (AcceptableValueBase)null, Array.Empty<object>())); PickupRadius = MagneticPickupsConfigFile.Bind<float>(new ConfigDefinition("Pickups", "PickupRadius"), 50f, new ConfigDescription("How close a pickup must be before it will begin to move towards a player", (AcceptableValueBase)null, Array.Empty<object>())); ((BaseUnityPlugin)this).Logger.LogMessage((object)"Loaded Magnetic Pickups!"); GravitatePickup.FixedUpdate += (hook_FixedUpdate)delegate(orig_FixedUpdate orig, GravitatePickup self) { //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_0020: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)1); Vector3 closestPlayerLocation = GetClosestPlayerLocation(teamMembers, ((Component)self).transform.position); if (Vector3.Distance(self.rigidbody.position, closestPlayerLocation) < PickupRadius.Value) { MovePickupTowardsPlayer(self, closestPlayerLocation); } }; } private void MovePickupTowardsPlayer(GravitatePickup pickup, Vector3 playerLocation) { //IL_0006: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) pickup.rigidbody.velocity = Vector3.zero; RaycastHit val = default(RaycastHit); bool num = Physics.Raycast(pickup.rigidbody.position, ((Component)pickup.rigidbody).transform.up, ref val); RaycastHit val2 = default(RaycastHit); bool flag = Physics.Raycast(pickup.rigidbody.position, -((Component)pickup.rigidbody).transform.up, ref val2); bool num2 = !num || ((RaycastHit)(ref val)).distance > 10f; bool flag2 = flag && ((RaycastHit)(ref val2)).distance < 250f; if (num2 && flag2) { Rigidbody rigidbody = pickup.rigidbody; rigidbody.velocity += Vector3.up * PickupMoveUpwardsSpeed.Value; } Vector3 velocity = pickup.rigidbody.velocity; Vector3 val3 = ((Component)pickup).transform.position - playerLocation; Vector3 val4 = Vector3.MoveTowards(velocity, ((Vector3)(ref val3)).normalized * 100f, PickupSpeed.Value); Rigidbody rigidbody2 = pickup.rigidbody; rigidbody2.velocity += -val4; } private Vector3 GetClosestPlayerLocation(ReadOnlyCollection<TeamComponent> players, Vector3 location) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0069: 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_0051: Unknown result type (might be due to invalid IL or missing references) Vector3 result = Vector3.positiveInfinity; float num = float.MaxValue; foreach (TeamComponent player in players) { if (Object.op_Implicit((Object)(object)Util.LookUpBodyNetworkUser(((Component)player).gameObject))) { float num2 = Vector3.Distance(player.body.footPosition, location); if (num2 < num) { result = player.body.footPosition; num = num2; } } } return result; } }