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 StonecutterRangeExtender v1.0.4
plugins/StonecutterRangeExtender/StonecutterRangeExtender.dll
Decompiled 4 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; 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("StonecutterRangeExtender")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3")] [assembly: AssemblyProduct("StonecutterRangeExtender")] [assembly: AssemblyTitle("StonecutterRangeExtender")] [assembly: AssemblyVersion("1.0.3.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 StonecutterRangeExtender { [BepInPlugin("cz.valheim.stonecutterrange", "Stonecutter Range Extender", "1.0.3")] public class Plugin : BaseUnityPlugin { internal static ConfigEntry<bool> ModEnabled; internal static ConfigEntry<float> Range; private Harmony harmony; private void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Zapne nebo vypne rozsireni dosahu Lamace kamene."); Range = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Range", 40f, new ConfigDescription("Pracovni polomer Lamace kamene v metrech.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 200f), Array.Empty<object>())); harmony = new Harmony("cz.valheim.stonecutterrange"); harmony.PatchAll(typeof(Plugin).Assembly); ModEnabled.SettingChanged += OnSettingChanged; Range.SettingChanged += OnSettingChanged; RefreshLoadedMarkers(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Stonecutter Range Extender 1.0.3 loaded"); } internal static bool IsStonecutter(CraftingStation station) { if ((Object)(object)station == (Object)null) { return false; } string name = ((Object)((Component)station).gameObject).name; if (!string.Equals(name, "piece_stonecutter", StringComparison.OrdinalIgnoreCase)) { return string.Equals(name, "piece_stonecutter(Clone)", StringComparison.OrdinalIgnoreCase); } return true; } internal static float EffectiveRange(float original) { if (ModEnabled == null || !ModEnabled.Value || Range == null) { return original; } return Range.Value; } internal static void SetMarker(CircleProjector marker, float radius) { if ((Object)(object)marker != (Object)null) { marker.m_radius = radius; } } private void OnSettingChanged(object sender, EventArgs args) { RefreshLoadedMarkers(); } private static void RefreshLoadedMarkers() { CraftingStation[] array = Object.FindObjectsOfType<CraftingStation>(); foreach (CraftingStation val in array) { if (IsStonecutter(val) && !((Object)(object)val.m_areaMarker == (Object)null)) { SetMarker(val.m_areaMarker.GetComponentInChildren<CircleProjector>(true), val.GetStationBuildRange()); } } } private void OnDestroy() { if (ModEnabled != null) { ModEnabled.SettingChanged -= OnSettingChanged; } if (Range != null) { Range.SettingChanged -= OnSettingChanged; } Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } RefreshLoadedMarkers(); ModEnabled = null; Range = null; } } [HarmonyPatch(typeof(CraftingStation), "GetStationBuildRange")] internal static class StationRangePatch { private static void Postfix(CraftingStation __instance, ref float __result, CircleProjector ___m_areaMarkerCircle) { if (Plugin.IsStonecutter(__instance)) { __result = Plugin.EffectiveRange(__result); Plugin.SetMarker(___m_areaMarkerCircle, __result); } } } [HarmonyPatch(typeof(CraftingStation), "GetExtensions")] internal static class StationExtensionsPatch { private static void Postfix(CraftingStation __instance, float ___m_buildRange, CircleProjector ___m_areaMarkerCircle) { if (Plugin.IsStonecutter(__instance)) { Plugin.SetMarker(___m_areaMarkerCircle, Plugin.EffectiveRange(___m_buildRange)); } } } [HarmonyPatch(typeof(CraftingStation), "ShowAreaMarker")] internal static class StationShowMarkerPatch { private static void Postfix(CraftingStation __instance, CircleProjector ___m_areaMarkerCircle) { if (Plugin.IsStonecutter(__instance)) { Plugin.SetMarker(___m_areaMarkerCircle, __instance.GetStationBuildRange()); } } } }