From cee33368be77f0755581ba995bd594fc3af89e8b Mon Sep 17 00:00:00 2001 From: Vigers Ray Date: Mon, 29 Dec 2025 21:06:38 +0100 Subject: [PATCH] =?UTF-8?q?=D1=8B=D1=8B=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Server/Ani/PatchManager.cs | 37 +++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/Content.Server/Ani/PatchManager.cs b/Content.Server/Ani/PatchManager.cs index 0a2fc47e81..7fd21ad9b7 100644 --- a/Content.Server/Ani/PatchManager.cs +++ b/Content.Server/Ani/PatchManager.cs @@ -1,3 +1,4 @@ +using System; using System.Reflection; using HarmonyLib; @@ -21,7 +22,41 @@ public sealed class PatchManager var harmony = new Harmony("sussy.sus"); var assembly = Assembly.GetExecutingAssembly(); - harmony.PatchAll(assembly); + try + { + // Применяем патчи только к типам из текущей сборки + var types = assembly.GetTypes(); + var patchedCount = 0; + var failedCount = 0; + + foreach (var type in types) + { + try + { + // Проверяем, что тип из текущей сборки и имеет атрибуты Harmony + if (type.Assembly != assembly) + continue; + + // Применяем патчи к типу + harmony.CreateClassProcessor(type).Patch(); + patchedCount++; + } + catch (Exception ex) + { + // Логируем ошибку, но продолжаем применять патчи к другим типам + sawmill.Warning($"Failed to patch type {type.FullName}: {ex.Message}"); + failedCount++; + } + } + + sawmill.Info($"Patches applied: {patchedCount} successful, {failedCount} failed"); + } + catch (Exception ex) + { + sawmill.Error($"Critical error during patching: {ex}"); + throw; + } + PatchApplied = true; } }