diff --git a/HarmonySrc/CinerariumGenie.cs b/HarmonySrc/CinerariumGenie.cs index f09c78c..e4c428d 100644 --- a/HarmonySrc/CinerariumGenie.cs +++ b/HarmonySrc/CinerariumGenie.cs @@ -54,6 +54,11 @@ namespace NecromancerTome public static float ArmOut = 12f; public static float ArmFwd = 15f; public static float Elbow = 35f; + /// Покой (17.10: «в покое руки нужно скрестить на груди»): плечо вниз-вперёд на CrossFwd, предплечье поперёк + /// груди к другому боку, одно на CrossLift выше другого, чтобы не проходили друг сквозь друга. Жест - из этой позы и назад. + public static bool Cross = true; + public static float CrossFwd = 25f; + public static float CrossLift = 0.12f; static GameObject _prefab; static bool _tried; @@ -272,10 +277,11 @@ namespace NecromancerTome /// поворот - от текущего направления кости к нужному, так что оси самих костей значения не имеют. public void Pose() { - Pose(CinerariumGenie.ArmFwd, CinerariumGenie.Elbow, CinerariumGenie.Elbow); + Pose(CinerariumGenie.ArmFwd, CinerariumGenie.Elbow, CinerariumGenie.Elbow, CinerariumGenie.Cross ? 1f : 0f); } - void Pose(float _fwd, float _elbowL, float _elbowR) + /// _cross - доля скрещённой позы (1 - руки на груди, 0 - опущены/жест), направления смешиваются. + void Pose(float _fwd, float _elbowL, float _elbowR, float _cross) { if (_arm == null) { @@ -322,6 +328,14 @@ namespace NecromancerTome float o = CinerariumGenie.ArmOut * Mathf.Deg2Rad, f = _fwd * Mathf.Deg2Rad; Vector3 upDir = new Vector3(sign * Mathf.Sin(o), -Mathf.Cos(o) * Mathf.Cos(f), Mathf.Sin(f)).normalized; Vector3 foreDir = Vector3.RotateTowards(upDir, Vector3.forward, (side == 0 ? _elbowL : _elbowR) * Mathf.Deg2Rad, 0f); + if (_cross > 0f) + { + float cf = CinerariumGenie.CrossFwd * Mathf.Deg2Rad; + Vector3 crossUp = new Vector3(sign * 0.12f, -Mathf.Cos(cf), Mathf.Sin(cf)).normalized; + Vector3 crossFore = new Vector3(-sign * 0.85f, side == 0 ? CinerariumGenie.CrossLift : -CinerariumGenie.CrossLift, 0.45f).normalized; + upDir = Vector3.Slerp(upDir, crossUp, _cross); + foreDir = Vector3.Slerp(foreDir, crossFore, _cross); + } up.rotation = Quaternion.FromToRotation(fore.position - up.position, transform.TransformDirection(upDir)) * up.rotation; fore.rotation = Quaternion.FromToRotation(hand.position - fore.position, transform.TransformDirection(foreDir)) * fore.rotation; } @@ -379,7 +393,8 @@ namespace NecromancerTome if (_w > 0f) { float wave = Mathf.Sin(_t * Mathf.PI * 2f * 1.5f) * GestureWave * _w; - Pose(Mathf.Lerp(CinerariumGenie.ArmFwd, GestureFwd, _w), CinerariumGenie.Elbow + 15f * _w + wave, CinerariumGenie.Elbow + 15f * _w - wave); + Pose(Mathf.Lerp(CinerariumGenie.ArmFwd, GestureFwd, _w), CinerariumGenie.Elbow + 15f * _w + wave, CinerariumGenie.Elbow + 15f * _w - wave, + CinerariumGenie.Cross ? 1f - _w : 0f); _gesturing = true; } else if (_gesturing) @@ -545,6 +560,7 @@ namespace NecromancerTome "necrogenie glow <0-1> - body's own glow (visible at night)\n" + "necrogenie tint - body colour\n" + "necrogenie arms - arm pose, degrees: upper arm from vertical sideways and forward, elbow bend\n" + + "necrogenie cross <0|1> [fwd] [lift] - arms crossed on the chest at rest (1) or hanging (0); upper arm forward, degrees; forearm height offset\n" + "necrogenie sleep - spirits and threads freeze when the player is farther (work goes on)\n" + "necrogenie hide|show - hide all spirits (weak PCs, video), work goes on"; } @@ -602,6 +618,21 @@ namespace NecromancerTome m.Pose(); } break; + case "cross": + CinerariumGenie.Cross = v != 0f; + if (_params.Count >= 3 && float.TryParse(_params[2], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out float cf)) + { + CinerariumGenie.CrossFwd = cf; + } + if (_params.Count >= 4 && float.TryParse(_params[3], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out float cl)) + { + CinerariumGenie.CrossLift = cl; + } + foreach (CinerariumGenieMotion m in CinerariumGenie.Live) + { + m.Pose(); + } + break; case "tint": if (_params.Count >= 4 && float.TryParse(_params[2], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out float g) && diff --git a/HarmonySrc/DecorColliderTagPatch.cs b/HarmonySrc/DecorColliderTagPatch.cs index 2ff82e1..d970587 100644 --- a/HarmonySrc/DecorColliderTagPatch.cs +++ b/HarmonySrc/DecorColliderTagPatch.cs @@ -20,7 +20,7 @@ namespace NecromancerTome static bool Ours(string _name) { - return _name == "necroBookMindPrefab" || _name == "necroKnifeDecorPrefab" || _name == "necroMortarPrefab" || _name.StartsWith("necroBloodRose") || _name.StartsWith("necroPoster") || _name == "necroBookDoorPrefab" || _name.StartsWith("necroSkullDecor") || _name == "necroCinerariumPrefab"; + return _name == "necroBookMindPrefab" || _name == "necroKnifeDecorPrefab" || _name == "necroMortarPrefab" || _name.StartsWith("necroBloodRose") || _name.StartsWith("necroPoster") || _name == "necroBookDoorPrefab" || _name.StartsWith("necroSkullDecor") || _name == "necroCinerariumPrefab" || _name == "necroCinerariumWorkerPrefab"; } public static void Postfix(Transform __result) diff --git a/NecromancerHarmony.dll b/NecromancerHarmony.dll index 05f8f2f..b476c0d 100644 Binary files a/NecromancerHarmony.dll and b/NecromancerHarmony.dll differ