Логист: меню формы по зажатию R - пункт ставится до того, как игра выполнит единственный поворот (#77); диагностика R убрана
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
321f5d4337
commit
aaf22f891c
@@ -61,18 +61,39 @@ namespace NecromancerTome
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Меню блока с урной логиста в руке: к пунктам игры - второй вид (подставка / у стены).</summary>
|
||||
/// <summary>Меню блока с урной логиста в руке: к пунктам игры - второй вид (подставка / у стены).
|
||||
/// 23.10 (#77, «зажимаю R - только вращает»): у блока с одним простым поворотом игра в конце SetupBlockShapeData зовёт
|
||||
/// SetCommonData с одним пунктом - и сразу выполняет его (поворот) и закрывает меню; пункт, добавленный после (постфикс),
|
||||
/// попадал в уже закрытое меню. Поэтому наш пункт и наш обработчик ставятся в самом SetCommonData этого вызова - до
|
||||
/// подсчёта пунктов. Короткое нажатие R по-прежнему поворачивает (пункт «-1» уходит игре).</summary>
|
||||
[HarmonyPatch(typeof(XUiC_Radial), nameof(XUiC_Radial.SetupBlockShapeData))]
|
||||
public static class Patch_XUiC_Radial_SetupBlockShapeData_LogistForm
|
||||
{
|
||||
public static void Postfix(XUiC_Radial __instance)
|
||||
/// <summary>Идёт сборка меню блока с урной логиста в руке.</summary>
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Диагностика #77 (23.10.2026: «зажимаю R - меню не открывается, только поворот»): на нажатие R с урной-логистом в
|
||||
/// руке - что видит игра (блок ли в руке, не считает ли предмет оружием). Убрать, когда причина найдена.</summary>
|
||||
[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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user