Нож: хват для нитей - пункт в прежнем меню ножа (человек/змея/чертоги вернулись); хват стриппера убран - держится как обычный нож

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AlexCube
2026-10-16 20:53:15 +03:00
co-authored by Claude Opus 5.5
parent 0290a73477
commit f5be0e7f43
3 changed files with 37 additions and 60 deletions
+2 -56
View File
@@ -15,7 +15,8 @@ namespace NecromancerTome
/// ящики - любые. Урна с нитями - «логист»: её дух только перевозит, глазницы черепов светятся зелёным.
///
/// Инструмент - нож некроманта «хватом для нитей»: отдельный предмет necroWpnBladeNecroKnifeThread (класс ножа в сейве
/// менять нельзя), переключение - меню по зажатому R, как у черепа (SkullDecorPlace); качество и моды переносятся
/// менять нельзя), переключение - пункт в меню ножа по R (то же меню, что «человек/змея/чертоги», SnakeMode.cs; 16.10:
/// своё меню по R перекрывало его - «ты убрал хваты чертогов памяти и духа змеи»); качество и моды переносятся
/// (ItemValue.Clone со сменой типа). Как у стриппера: ПКМ - начать нить и закончить её (порядок = направление: ящик, потом
/// урна - «откуда»; урна, потом ящик - «куда»), ЛКМ по урне или ящику - снять его нити.
/// Первая версия - одиночная игра и хост (связи меняются на месте, клиентам сети - позже).
@@ -58,37 +59,6 @@ namespace NecromancerTome
Cancel();
}
public static void OnMenu(XUiC_Radial _sender, int _commandIndex, XUiC_Radial.RadialContextAbs _context)
{
EntityPlayerLocal pl = _sender?.xui?.playerUI?.entityPlayer;
if (_commandIndex == GripNormal)
{
Convert(pl, KnifeName);
}
else if (_commandIndex == GripThread)
{
Convert(pl, ThreadKnifeName);
}
}
public static void OpenMenu(PlayerMoveController _pmc, EntityPlayerLocal _pl)
{
XUiC_Radial r = _pmc.playerUI?.xui?.RadialWindow;
if (r == null)
{
return;
}
bool thread = IsThreadKnife(_pl.inventory.holdingItem);
r.Open();
r.ResetRadialEntries();
r.CreateRadialEntry(GripNormal, "NecromancersKnife", "ItemIconAtlas", "", Localization.Get("necroKnifeGripNormal"), !thread);
// 16.10: «Есть в игре пиктограмма ниток, катушки?» - набор для шитья (катушка с иглой).
r.CreateRadialEntry(GripThread, "resourceSewingKit", "ItemIconAtlas", "", Localization.Get("necroKnifeGripThread"), thread);
r.SetCommonData(UIUtils.GetButtonIconForAction(_pmc.playerInput.Reload), OnMenu,
new XUiC_Radial.RadialContextHoldingSlotIndex(_pl.inventory.holdingItemIdx), thread ? GripThread : GripNormal, false,
XUiC_Radial.RadialValidSameHoldingSlotIndex);
}
// ------------------------------------------------------------------
// Соединение.
// ------------------------------------------------------------------
@@ -414,28 +384,4 @@ namespace NecromancerTome
return false;
}
}
/// <summary>R с ножом некроманта (любым хватом) - меню хвата. Игра ножу по R ничего не открывает.</summary>
[HarmonyPatch(typeof(PlayerMoveController), nameof(PlayerMoveController.Update))]
public static class Patch_PlayerMoveController_Update_KnifeGrip
{
public static void Postfix(PlayerMoveController __instance)
{
EntityPlayerLocal pl = __instance.entityPlayerLocal;
if (pl == null || pl.inventory == null || !CinerariumThreads.IsKnife(pl.inventory.holdingItem) || pl.IsDead())
{
return;
}
PlayerActionsLocal inp = __instance.playerInput;
if (inp == null || !(inp.Reload.WasPressed || inp.PermanentActions.Reload.WasPressed) || pl.inventory.IsHandSwitching())
{
return;
}
if (__instance.playerUI == null || __instance.playerUI.windowManager.IsModalWindowOpen())
{
return;
}
CinerariumThreads.OpenMenu(__instance, pl);
}
}
}