RacesOfValheim/JotunnModStub/RaceEyeTuning.cs
kanym 5b3b2ac88d refactor(eyes): bake the tuned eye corrections in, drop the sliders
The Eyes Position sections were a tuning tool. Their per-body, per-eye values
from playtest now live in RaceEyeTuning as constants, so every player gets
the tuned faces and Configuration Manager loses four sections. The Aswid -
Eyes section stays for now.
2026-10-27 17:46:36 +01:00

64 lines
3 KiB
C#

using System.Collections.Generic;
namespace RacesOfValheim
{
/// <summary>
/// Hand corrections for every race that hangs eyes on the face, per body and per eye. Per body
/// because the two bodies put their painted eyes in different places (PlayerFace); per eye
/// because the face is not symmetric enough for one set to fit both. Left and right are the
/// character's own.
///
/// Every value is a delta on the placement the race's own code computes: zeros (and size 1)
/// change nothing. They were dialled in on screen with Configuration Manager sliders
/// (playtest, 2026-10-27) and then written down here; the sliders are gone.
/// </summary>
public static class RaceEyeTuning
{
/// <summary>One eye's corrections. Metres for the offsets, degrees for the rotations.</summary>
public sealed class Eye
{
public float Forward, Height, Separation, RotX, RotY, RotZ;
public float Size = 1f;
}
private static readonly Eye Untouched = new Eye();
// [race] -> { male left, male right, female left, female right }
private static readonly Dictionary<string, Eye[]> tunings = new Dictionary<string, Eye[]>
{
[AlfarConfig.RaceId] = new[]
{
new Eye(),
new Eye { Separation = 0.009f },
new Eye { Separation = 0.006f, RotX = -17.524f },
new Eye { Separation = 0.015f, RotX = -17.524f },
},
["Aswid"] = new[]
{
new Eye { Height = -0.005f, Separation = -0.005f, Size = 1.273f, RotX = 6.49f, RotY = 4.544f, RotZ = 4.544f },
new Eye { Forward = -0.002f, Height = -0.005f, Separation = 0.004f, Size = 1.444f, RotZ = 6.49f },
new Eye { Forward = -0.006f, Height = -0.010f, Size = 1.314f, RotX = -14.279f, RotY = -5.841f, RotZ = -1.298f },
new Eye { Forward = -0.006f, Height = -0.012f, Separation = 0.011f, Size = 1.324f, RotX = 1.947f, RotY = 3.245f, RotZ = 4.544f },
},
[DvergarConfig.RaceId] = new[]
{
new Eye { Forward = -0.003f, Size = 1.05f },
new Eye { Forward = -0.004f, Separation = 0.005f },
new Eye { Forward = -0.011f, Separation = 0.005f, Size = 1.616f },
new Eye { Forward = -0.015f, Separation = 0.013f, Size = 1.616f },
},
// The Sverm's helmet hides its eyes, so it keeps the code's own placement.
};
/// <summary>
/// The corrections for one eye of the body this player is wearing right now. Side is the
/// races' own convention: negative is offset against the head frame's right axis, which is
/// the character's left eye. Never null.
/// </summary>
public static Eye For(string race, Player player, float side)
{
if (!tunings.TryGetValue(race, out Eye[] set)) return Untouched;
return set[(PlayerFace.IsFemale(player) ? 2 : 0) + (side < 0f ? 0 : 1)];
}
}
}