Нож-для-нитей у тела: хват лука, кисть +20 к ладони, нож в кулаке (подбор necrobody)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a447ba1bbc
commit
e0411ce3e5
@@ -449,6 +449,7 @@ namespace NecromancerTome
|
|||||||
HeldTweak.Apply();
|
HeldTweak.Apply();
|
||||||
NecroView.Update();
|
NecroView.Update();
|
||||||
NecroBody.LateUpdate();
|
NecroBody.LateUpdate();
|
||||||
|
ThreadKnifeBody.LateUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -12,7 +13,64 @@ namespace NecromancerTome
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class ThreadKnifeBody
|
public static class ThreadKnifeBody
|
||||||
{
|
{
|
||||||
public static int TpHold = 36;
|
/// <summary>0 - тело держит хватом предмета (68, лук). 16.10 в игре (necrobody) пользователь выбрал именно его: нож в левой
|
||||||
|
/// руке тела, «Нож был нормальным», нужна только поправка кисти и места ножа (ниже). Подмена на 36 - на пробу командой.</summary>
|
||||||
|
public static int TpHold = 0;
|
||||||
|
|
||||||
|
/// <summary>Поправка тела, подобранная 16.10 командами necrobody: левая кисть к ладони на 20° («лучезапястный сустав
|
||||||
|
/// выгнуло... словно перелом»: LeftHand Z 302 -> 322), нож в кулаке - item pos 3 -4 -2 см («Вот так идеально»).</summary>
|
||||||
|
public static float WristBend = 20f;
|
||||||
|
public static Vector3 ItemPos = new Vector3(0.03f, -0.04f, -0.02f);
|
||||||
|
static readonly Dictionary<Animator, Transform> _leftHand = new Dictionary<Animator, Transform>();
|
||||||
|
|
||||||
|
/// <summary>Из HandPoseDriver.LateUpdate: у всех игроков в мире с ножом-для-нитей, кроме своего вида от первого лица.</summary>
|
||||||
|
public static void LateUpdate()
|
||||||
|
{
|
||||||
|
World w = GameManager.Instance?.World;
|
||||||
|
if (w?.Players?.list == null || TpHold > 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach (EntityPlayer p in w.Players.list)
|
||||||
|
{
|
||||||
|
if (p == null || p.inventory?.holdingItem?.Name != CinerariumThreads.ThreadKnifeName || p.emodel == null ||
|
||||||
|
p.emodel.IsFPV && !p.isEntityRemote)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
AvatarCharacterController ac = p.emodel.avatarController as AvatarCharacterController;
|
||||||
|
Animator a = ac?.CharacterBody?.Animator;
|
||||||
|
if (a == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!_leftHand.TryGetValue(a, out Transform lh) || lh == null)
|
||||||
|
{
|
||||||
|
lh = null;
|
||||||
|
foreach (Transform t in a.GetComponentsInChildren<Transform>(true))
|
||||||
|
{
|
||||||
|
if (t.name == "LeftHand")
|
||||||
|
{
|
||||||
|
lh = t;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_leftHand.Count > 16)
|
||||||
|
{
|
||||||
|
_leftHand.Clear();
|
||||||
|
}
|
||||||
|
_leftHand[a] = lh;
|
||||||
|
}
|
||||||
|
if (lh != null)
|
||||||
|
{
|
||||||
|
lh.localRotation *= Quaternion.Euler(0f, 0f, WristBend);
|
||||||
|
}
|
||||||
|
if (ac.heldItemTransform != null && !NecroBody.ItemPos.HasValue)
|
||||||
|
{
|
||||||
|
ac.heldItemTransform.localPosition = ItemPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static bool Applies(EntityAlive _e)
|
public static bool Applies(EntityAlive _e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user