From c1f7d510e58abe3ce4c3fe27364b1677ed5f2315 Mon Sep 17 00:00:00 2001 From: AlexCube Date: Tue, 13 Oct 2026 16:17:21 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D1=83=D0=BA=D0=B8=20=D0=BE=D0=B4=D0=B5?= =?UTF-8?q?=D1=80=D0=B6=D0=B8=D0=BC=D0=BE=D0=B3=D0=BE:=20=D1=81=D0=BA?= =?UTF-8?q?=D1=80=D0=B8=D0=BF=D1=82=20=D1=83=D0=B4=D0=B0=D1=80=D0=B0=20?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=BC=D0=B0=D1=82=D0=BE=D1=80=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=BF=D1=83=D1=81=D0=BA=D0=B0=D0=B5=D1=82=D1=81?= =?UTF-8?q?=D1=8F=20=D1=83=20=D1=80=D1=83=D0=BA=20=D0=B1=D0=B5=D0=B7=20Ani?= =?UTF-8?q?mationEventBridge=20(NRE=20=D0=BD=D0=B0=20=D0=BA=D0=B0=D0=B6?= =?UTF-8?q?=D0=B4=D0=BE=D0=BC=20=D1=83=D0=B4=D0=B0=D1=80=D0=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- HarmonySrc/FpArms.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/HarmonySrc/FpArms.cs b/HarmonySrc/FpArms.cs index add7835..e3c2418 100644 --- a/HarmonySrc/FpArms.cs +++ b/HarmonySrc/FpArms.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using HarmonyLib; using System.Globalization; using UnityEngine; using UnityEngine.Scripting; @@ -448,4 +449,23 @@ namespace NecromancerTome Out(FpArms.Dump()); } } + + /// Скрипт состояния удара в аниматоре рук (AnimatorMeleeAttackState) берёт персонажа через + /// AnimationEventBridge и бьёт предметом в его руке. У рук одержимого моста нет (FpArms снимает скрипты) - без этой + /// заплатки NullReferenceException на каждом ударе (тест 13.10), а с мостом руки зомби били бы предметом тела. + /// У рук персонажа мост есть всегда - их не трогаем. + [HarmonyPatch(typeof(AnimatorMeleeAttackState))] + public static class Patch_AnimatorMeleeAttackState_FpArms + { + static bool Ours(Animator _a) => _a != null && _a.GetComponent() == null; + + [HarmonyPrefix, HarmonyPatch(nameof(AnimatorMeleeAttackState.OnStateEnter))] + public static bool Enter(Animator animator) => !Ours(animator); + + [HarmonyPrefix, HarmonyPatch(nameof(AnimatorMeleeAttackState.OnStateUpdate))] + public static bool Update(Animator animator) => !Ours(animator); + + [HarmonyPrefix, HarmonyPatch(nameof(AnimatorMeleeAttackState.OnStateExit))] + public static bool Exit(Animator animator) => !Ours(animator); + } }