using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("Antro.HardMode")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Antro.HardMode")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0.0")] [assembly: AssemblyProduct("Antro.HardMode")] [assembly: AssemblyTitle("Antro.HardMode")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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 PermanentDismembermentMod { [BepInPlugin("com.modder.permanentdismemberment", "Permanent Dismemberment", "1.0.0")] public class PermanentDismembermentPlugin : BaseUnityPlugin { public const string ModGUID = "com.modder.permanentdismemberment"; public const string ModName = "Permanent Dismemberment"; public const string ModVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("com.modder.permanentdismemberment"); private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[Permanent Dismemberment] Загрузка мода..."); try { harmony.PatchAll(typeof(LimbPatches)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[Permanent Dismemberment] Все патчи успешно применились!"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("[Permanent Dismemberment] Ошибка при инициализации Harmony патчей: " + ex.Message)); } } } [HarmonyPatch] public class LimbPatches { [HarmonyPatch(typeof(DismembermentController), "FixRpc")] [HarmonyPrefix] public static bool PreventFixRpc() { Debug.Log((object)"[PermanentDismemberment] Попытка восстановления конечности через FixRpc заблокирована."); return false; } [HarmonyPatch(typeof(DismembermentController), "TryRegrowLimbs")] [HarmonyPrefix] public static bool PreventTryRegrowLimbs() { return false; } [HarmonyPatch(typeof(PlayerHealth), "OnRespawned")] [HarmonyPostfix] public static void RestoreLimbsOnRespawn(PlayerHealth __instance) { if (((NetworkBehaviour)__instance).IsServer) { PlayerNetworking component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.Dismemberment != (Object)null) { Debug.Log((object)"[PermanentDismemberment] Игрок возродился. Запускаем ResetAllRpc для восстановления тела."); component.Dismemberment.ResetAllRpc(); } } } } }