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 SmoothBuildRepair v1.0.0
plugins/SmoothBuildRepair/SmoothBuildRepair.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; 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: AssemblyVersion("0.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 SmoothBuildRepair { [BepInPlugin("morda.SmoothBuildRepair", "SmoothBuildRepair", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "morda.SmoothBuildRepair"; private ConfigEntry<bool> isEnabled; private ConfigEntry<float> radius; private ConfigEntry<float> interval; private ConfigEntry<int> perTick; private ConfigEntry<bool> respectWards; private float timer; private void Awake() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown isEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Auto-repair on/off."); radius = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Radius", 50f, "Repair radius around the player in meters."); interval = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Interval", 1f, "Seconds between repair steps."); perTick = ((BaseUnityPlugin)this).Config.Bind<int>("General", "PiecesPerStep", 2, new ConfigDescription("Pieces repaired per step (1-50). Keeps lag away.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50), Array.Empty<object>())); respectWards = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RespectWards", true, "Do not repair inside foreign wards."); } private void Update() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00f6: Unknown result type (might be due to invalid IL or missing references) if (!isEnabled.Value) { return; } timer += Time.deltaTime; if (timer < interval.Value) { return; } timer = 0f; Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead()) { return; } Vector3 position = ((Component)localPlayer).transform.position; float num = radius.Value * radius.Value; int num2 = Mathf.Clamp(perTick.Value, 1, 50); List<WearNTear> allInstances = WearNTear.GetAllInstances(); for (int i = 0; i < allInstances.Count; i++) { if (num2 <= 0) { break; } WearNTear val = allInstances[i]; if ((Object)(object)val == (Object)null) { continue; } Vector3 val2 = ((Component)val).transform.position - position; if (((Vector3)(ref val2)).sqrMagnitude > num || val.GetHealthPercentage() >= 0.999f || (respectWards.Value && !PrivateArea.CheckAccess(((Component)val).transform.position, 0f, false, false))) { continue; } ZNetView component = ((Component)val).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid()) { if (!component.IsOwner()) { component.ClaimOwnership(); } if (val.Repair()) { num2--; } } } } } }