From aaf22f891cdf786b9aa3f5da0764fa7df84f88f7 Mon Sep 17 00:00:00 2001 From: AlexCube Date: Fri, 23 Oct 2026 12:53:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=BE=D0=B3=D0=B8=D1=81=D1=82:=20=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=8E=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D0=B7=D0=B0=D0=B6=D0=B0=D1=82=D0=B8=D1=8E=20R=20-=20?= =?UTF-8?q?=D0=BF=D1=83=D0=BD=D0=BA=D1=82=20=D1=81=D1=82=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=81=D1=8F=20=D0=B4=D0=BE=20=D1=82=D0=BE=D0=B3=D0=BE,?= =?UTF-8?q?=20=D0=BA=D0=B0=D0=BA=20=D0=B8=D0=B3=D1=80=D0=B0=20=D0=B2=D1=8B?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8=D1=82=20=D0=B5=D0=B4=D0=B8=D0=BD?= =?UTF-8?q?=D1=81=D1=82=D0=B2=D0=B5=D0=BD=D0=BD=D1=8B=D0=B9=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B2=D0=BE=D1=80=D0=BE=D1=82=20(#77);=20=D0=B4=D0=B8=D0=B0?= =?UTF-8?q?=D0=B3=D0=BD=D0=BE=D1=81=D1=82=D0=B8=D0=BA=D0=B0=20R=20=D1=83?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- HarmonySrc/CinerariumLogist.cs | 56 ++++++++++++++++------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/HarmonySrc/CinerariumLogist.cs b/HarmonySrc/CinerariumLogist.cs index ffdf499..bbdf03e 100644 --- a/HarmonySrc/CinerariumLogist.cs +++ b/HarmonySrc/CinerariumLogist.cs @@ -61,18 +61,39 @@ namespace NecromancerTome } } - /// Меню блока с урной логиста в руке: к пунктам игры - второй вид (подставка / у стены). + /// Меню блока с урной логиста в руке: к пунктам игры - второй вид (подставка / у стены). + /// 23.10 (#77, «зажимаю R - только вращает»): у блока с одним простым поворотом игра в конце SetupBlockShapeData зовёт + /// SetCommonData с одним пунктом - и сразу выполняет его (поворот) и закрывает меню; пункт, добавленный после (постфикс), + /// попадал в уже закрытое меню. Поэтому наш пункт и наш обработчик ставятся в самом SetCommonData этого вызова - до + /// подсчёта пунктов. Короткое нажатие R по-прежнему поворачивает (пункт «-1» уходит игре). [HarmonyPatch(typeof(XUiC_Radial), nameof(XUiC_Radial.SetupBlockShapeData))] public static class Patch_XUiC_Radial_SetupBlockShapeData_LogistForm { - public static void Postfix(XUiC_Radial __instance) + /// Идёт сборка меню блока с урной логиста в руке. + public static bool Building; + + public static void Prefix(XUiC_Radial __instance) { - EntityPlayerLocal pl = __instance.xui?.playerUI?.entityPlayer; - ItemClass held = pl?.inventory?.holdingItem; - if (!CinerariumLogistForm.IsLogistItem(held)) + Building = CinerariumLogistForm.IsLogistItem(__instance.xui?.playerUI?.entityPlayer?.inventory?.holdingItem); + } + + public static void Postfix() + { + Building = false; + } + } + + [HarmonyPatch(typeof(XUiC_Radial), nameof(XUiC_Radial.SetCommonData))] + public static class Patch_XUiC_Radial_SetCommonData_LogistForm + { + public static void Prefix(XUiC_Radial __instance, ref XUiC_Radial.CommandHandlerDelegate _commandHandlerFunc) + { + if (!Patch_XUiC_Radial_SetupBlockShapeData_LogistForm.Building) { return; } + Patch_XUiC_Radial_SetupBlockShapeData_LogistForm.Building = false; + ItemClass held = __instance.xui.playerUI.entityPlayer.inventory.holdingItem; bool wall = held.Name == TEFeatureCinerarium.LogistWallBlockName || held.Name == TEFeatureCinerarium.LogistWallSkullBlockName; if (wall) { @@ -82,30 +103,7 @@ namespace NecromancerTome { __instance.CreateRadialEntry(CinerariumLogistForm.MenuWall, TEFeatureCinerarium.LogistWallBlockName, "ItemIconAtlas", "", Localization.Get("necroCinerariumLogistFormWall")); } - __instance.SetCommonData(UIUtils.GetButtonIconForAction(__instance.xui.playerUI.playerInput.Activate), CinerariumLogistForm.OnBlockMenu, - new XUiC_Radial.RadialContextHoldingSlotIndex(pl.inventory.holdingItemIdx), -1, true, XUiC_Radial.RadialValidSameHoldingSlotIndex); - Debug.Log("[NecromancerTome] LogistForm: меню блока - " + held.Name + ", пунктов " + __instance.currentEnabledEntriesCount()); - } - } - - /// Диагностика #77 (23.10.2026: «зажимаю R - меню не открывается, только поворот»): на нажатие R с урной-логистом в - /// руке - что видит игра (блок ли в руке, не считает ли предмет оружием). Убрать, когда причина найдена. - [HarmonyPatch(typeof(PlayerMoveController), nameof(PlayerMoveController.Update))] - public static class Patch_PlayerMoveController_Update_LogistFormDiag - { - public static void Postfix(PlayerMoveController __instance) - { - EntityPlayerLocal pl = __instance.entityPlayerLocal; - PlayerActionsLocal inp = __instance.playerInput; - if (pl?.inventory == null || inp == null || !CinerariumLogistForm.IsLogistItem(pl.inventory.holdingItem) || - !(inp.Reload.WasPressed || inp.PermanentActions.Reload.WasPressed)) - { - return; - } - XUiC_Radial r = __instance.playerUI?.xui?.RadialWindow; - Debug.Log("[NecromancerTome] LogistForm: R - " + pl.inventory.holdingItem.Name + ", блок " + (pl.inventory.GetHoldingBlock() != null) + - ", оружие " + pl.inventory.IsHoldingGun() + "/" + pl.inventory.IsHoldingDynamicMelee() + ", смена руки " + pl.inventory.IsHandSwitching() + - ", меню " + (r != null && r.IsOpen) + ", модальное " + (__instance.playerUI?.windowManager?.IsModalWindowOpen() ?? false)); + _commandHandlerFunc = CinerariumLogistForm.OnBlockMenu; } }