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 NoGroundBranches v1.0.1
NoGroundBranches.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("NoGroundBranches")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NoGroundBranches")] [assembly: AssemblyTitle("NoGroundBranches")] [assembly: AssemblyVersion("1.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 NoGroundBranches { [BepInPlugin("choico007.NoGroundBranches", "NoGroundBranches", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string GUID = "choico007.NoGroundBranches"; public const string Name = "NoGroundBranches"; public const string Version = "1.0.0"; internal static ConfigEntry<bool> ModEnabled; internal static ConfigEntry<string> PrefabNames; internal static ConfigEntry<bool> RemoveExisting; internal static ConfigEntry<bool> LogPrefabNames; internal static ManualLogSource Log; private void Awake() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "모드 활성화 여부"); PrefabNames = ((BaseUnityPlugin)this).Config.Bind<string>("General", "PrefabNames", "Pickable_Branch", "생성을 막을 프리팹 이름 (쉼표로 구분). 예: Pickable_Branch,Branch"); RemoveExisting = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RemoveExisting", true, "이미 월드에 생성되어 있는 가지도 제거할지 여부"); LogPrefabNames = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "LogPrefabNames", false, "true면 월드 생성 목록의 모든 Pickable 프리팹 이름을 로그에 출력 (이름 확인용)"); new Harmony("choico007.NoGroundBranches").PatchAll(); } internal static bool IsTarget(string rawName) { if (string.IsNullOrEmpty(rawName)) { return false; } string n = rawName.Replace("(Clone)", "").Trim(); return (from s in PrefabNames.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim()).Any((string s) => string.Equals(s, n, StringComparison.OrdinalIgnoreCase)); } } [HarmonyPatch(typeof(ZoneSystem), "Start")] internal static class ZoneSystem_Start_Patch { private static void Postfix(ZoneSystem __instance) { if (!Plugin.ModEnabled.Value) { return; } foreach (ZoneVegetation item in __instance.m_vegetation) { if (!((Object)(object)item.m_prefab == (Object)null)) { if (Plugin.LogPrefabNames.Value) { Plugin.Log.LogInfo((object)("Vegetation prefab: " + ((Object)item.m_prefab).name)); } if (Plugin.IsTarget(((Object)item.m_prefab).name)) { item.m_enable = false; Plugin.Log.LogInfo((object)("Disabled spawn: " + ((Object)item.m_prefab).name)); } } } } } [HarmonyPatch(typeof(Pickable), "Start")] internal static class Pickable_Start_Patch { private static void Postfix(Pickable __instance) { if (Plugin.ModEnabled.Value && Plugin.RemoveExisting.Value && Plugin.IsTarget(((Object)((Component)__instance).gameObject).name)) { ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsValid()) { component.ClaimOwnership(); component.Destroy(); } } } } }