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 ClearDrops v1.0.2
ClearDrops.dll
Decompiled 2 days agousing System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace LimpaDrop; [BepInPlugin("yuri.ClearDrops", "Clear Drops", "1.0.0")] public class Plugin : BaseUnityPlugin { private ConfigEntry<bool> Ligado; private ConfigEntry<KeyboardShortcut> Tecla; private ConfigEntry<float> Raio; private void Awake() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) Ligado = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Clears ground items near you. Only your own game needs this mod."); Tecla = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Key", new KeyboardShortcut((KeyCode)290, (KeyCode[])(object)new KeyCode[0]), "Key that clears nearby drops."); Raio = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Radius", 12f, "Distance in meters. From 3 to 40."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Clear Drops 1.0.1"); } private void Update() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!Ligado.Value) { return; } KeyboardShortcut value = Tecla.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Character)localPlayer).IsDead() && PodeAgir(localPlayer)) { Limpar(localPlayer); } } } private void Limpar(Player jogador) { //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_00aa: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) float num = Raio.Value; if (num < 3f) { num = 3f; } if (num > 40f) { num = 40f; } float num2 = num * num; Vector3 position = ((Component)jogador).transform.position; ItemDrop[] array = Object.FindObjectsOfType<ItemDrop>(); int num3 = 0; if (array != null) { foreach (ItemDrop val in array) { if (!((Object)(object)val == (Object)null) && !val.IsPiece() && !EhProtegido((Component)(object)val)) { Vector3 val2 = ((Component)val).transform.position - position; if (!(((Vector3)(ref val2)).sqrMagnitude > num2) && Apagar(((Component)val).gameObject)) { num3++; } } } } if (num3 == 0) { ((Character)jogador).Message((MessageType)2, "No drops nearby.", 0, (Sprite)null, true); } else { ((Character)jogador).Message((MessageType)2, "Nearby drops cleared. " + num3 + ".", 0, (Sprite)null, true); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Drops cleared " + num3)); } private static bool PodeAgir(Player jogador) { MethodInfo method = typeof(Player).GetMethod("TakeInput", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { return true; } object obj = method.Invoke(jogador, null); return obj is bool && (bool)obj; } private static bool EhProtegido(Component coisa) { if ((Object)(object)coisa == (Object)null) { return true; } if ((Object)(object)coisa.GetComponentInParent<TombStone>() != (Object)null) { return true; } if ((Object)(object)coisa.GetComponentInParent<ItemStand>() != (Object)null) { return true; } if ((Object)(object)coisa.GetComponentInParent<ArmorStand>() != (Object)null) { return true; } Transform val = coisa.transform; while ((Object)(object)val != (Object)null) { string name = ((Object)val).name; if (name != null && name.ToLower().IndexOf("tomb") >= 0) { return true; } val = val.parent; } return false; } private static bool Apagar(GameObject go) { if ((Object)(object)go == (Object)null) { return false; } ZNetView component = go.GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsValid()) { if (!component.IsOwner()) { component.ClaimOwnership(); } component.Destroy(); return true; } Object.Destroy((Object)(object)go); return true; } }