From 026def2fdebdc55f9f68c2cc8ed6cda70c1f1ccd Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 27 Oct 2026 15:01:44 +0100 Subject: [PATCH 01/13] fix(eyes): female face placement, smaller Dvergar/Aswid eyes, grey Alfar eyes The female body maps the painted eyes about 6 mm lower and a quarter closer together than the male one (read from bodymale/bodyfem and the skin UVs), so every race's male-tuned eyes sat on the female brow. PlayerFace moves them for the Dvergar, Aswid, Sverm and Alfar. Dvergar eyes shrink to an 18 mm radius. The Aswid's borrowed sockets are halved before the config multiplier and the smoke is off by default. Alfar eyes become slanted, wrapped black almonds with a wet sheen. They are placed in fixed head-local units: the live lossyScale under the non-uniform Alfar body drifted as the head turned, and the 0.5 s cosmetic pass made the eyes trail the face. --- JotunnModStub/Alfar/AlfarConfig.cs | 27 ++++++++----- JotunnModStub/Alfar/AlfarVisuals.cs | 52 +++++++++++++++---------- JotunnModStub/Aswid/AswidConfig.cs | 2 +- JotunnModStub/Aswid/AswidVisuals.cs | 24 ++++++++++-- JotunnModStub/Dvergar/DvergarConfig.cs | 4 +- JotunnModStub/Dvergar/DvergarVisuals.cs | 14 +++++-- JotunnModStub/PlayerFace.cs | 49 +++++++++++++++++++++++ JotunnModStub/Sverm/SvermVisuals.cs | 13 +++++-- 8 files changed, 141 insertions(+), 44 deletions(-) create mode 100644 JotunnModStub/PlayerFace.cs diff --git a/JotunnModStub/Alfar/AlfarConfig.cs b/JotunnModStub/Alfar/AlfarConfig.cs index 1769a1a..7d72e25 100644 --- a/JotunnModStub/Alfar/AlfarConfig.cs +++ b/JotunnModStub/Alfar/AlfarConfig.cs @@ -39,17 +39,26 @@ namespace RacesOfValheim public static ConfigEntry WidthScale; /// - /// 1 is the Sverm's size, which is what the design asked to try first ("se non va li - /// allarghiamo"). Raise it to enlarge the eyes: 1.6 is roughly a grey from the films. + /// Scales the almond eyes (EyeExtent). The default 0.8 is the tuned grey look; raise it for + /// bigger eyes. /// public static ConfigEntry EyeSizeMultiplier; - // The eye geometry is the Sverm's, unchanged (SvermVisuals): offsets are metres in the head - // bone's OWN frame, so they land on the same part of the face at any body scale. - public const float EyeSeparation = 0.032f; - public const float EyeForward = 0.081f; - public const float EyeHeight = 0.181f; - public const float EyeSize = 0.062f; + // A grey's eyes, on the Sverm's eye spot: offsets are metres in the head bone's OWN frame + // at human scale, so they land on the same part of the face at any body scale. + // Pushed apart and forward of the Sverm's, because an almond this wide would otherwise + // meet its twin over the nose and sink into the cheek. + public const float EyeSeparation = 0.037f; + public const float EyeForward = 0.086f; + public const float EyeHeight = 0.183f; + + // Full width, height and depth of one eye in metres at Eye Size Multiplier 1. The saved + // default of 0.8 makes that 50 x 28 x 18 mm. + public static readonly Vector3 EyeExtent = new Vector3(0.0625f, 0.035f, 0.0225f); + + // Degrees. Slant raises the outer corner; wrap turns each eye out toward its temple. + public const float EyeSlant = 22f; + public const float EyeWrap = 20f; // ─── Eitr: diet, shield, soft fall ─────────────────────────────────── @@ -152,7 +161,7 @@ namespace RacesOfValheim new AcceptableValueRange(0.7f, 1.2f))); EyeSizeMultiplier = config.Bind(look, "Eye Size Multiplier", 0.8f, - new ConfigDescription("1 = the Sverm's eye size; 0.8 is slightly smaller. Raise to enlarge the black eyes.", + new ConfigDescription("Scales the black almond eyes. 0.8 is the default look; raise it for bigger eyes.", new AcceptableValueRange(0.5f, 3f))); } } diff --git a/JotunnModStub/Alfar/AlfarVisuals.cs b/JotunnModStub/Alfar/AlfarVisuals.cs index 51d4cd1..c2f2065 100644 --- a/JotunnModStub/Alfar/AlfarVisuals.cs +++ b/JotunnModStub/Alfar/AlfarVisuals.cs @@ -161,35 +161,47 @@ namespace RacesOfValheim } if (eyes == null) return; - PlaceEyes(headBone, eyes); + PlaceEyes(player, eyes); } - private static void PlaceEyes(Transform headBone, Transform holder) + /// + /// A grey's eyes: wide black almonds, outer corners raised, wrapping round the sides of the + /// face. Each is a sphere squashed to an ellipsoid and turned in the skull's own frame. + /// + /// FIXED HEAD-LOCAL UNITS, never headBone.lossyScale. The Alfar Visual is scaled + /// non-uniformly, so the head's lossyScale is only an approximation that changes as the + /// head turns; recomputed on the 0.5s cosmetic pass it made the eyes trail the face. The + /// face is skinned to the same bone through the same matrices, so a constant local offset + /// stays glued to it at any body scale, and PlaceEyes only has to run when the eyes change. + /// + private static void PlaceEyes(Player player, Transform holder) { - Vector3 lossy = headBone.lossyScale; - if (Mathf.Abs(lossy.x) < 0.0001f || Mathf.Abs(lossy.y) < 0.0001f || Mathf.Abs(lossy.z) < 0.0001f) return; - EyeFrame frame = holder.GetComponent(); if (frame == null) return; - // The Visual is scaled non-uniformly (thinner than tall), so lossyScale has three - // different components and a single divisor would squash the spheres. Each axis is - // divided by its own. - Vector3 toLocal = new Vector3(1f / lossy.x, 1f / lossy.y, 1f / lossy.z); - float eyeSize = AlfarConfig.EyeSize * AlfarConfig.EyeSizeMultiplier.Value; + const float toLocal = PlayerFace.MetresToHeadLocal; - Vector3 baseOffset = frame.LocalForward * AlfarConfig.EyeForward + frame.LocalUp * AlfarConfig.EyeHeight; + float height = AlfarConfig.EyeHeight; + float separation = AlfarConfig.EyeSeparation; + float size = AlfarConfig.EyeSizeMultiplier.Value; + PlayerFace.AdjustEyes(player, ref height, ref separation, ref size); + + Vector3 baseOffset = frame.LocalForward * AlfarConfig.EyeForward + frame.LocalUp * height; + Vector3 extent = AlfarConfig.EyeExtent * (size * toLocal); + Quaternion facing = Quaternion.LookRotation(frame.LocalForward, frame.LocalUp); for (int i = 0; i < holder.childCount; i++) { Transform eye = holder.GetChild(i); - // Index 0 is offset against the right axis, so it is the model's left eye. + // Index 0 is offset against the right axis, so it is the model's left eye. The + // slant and the wrap are mirrored so both outer corners go up and back. float side = i == 0 ? -1f : 1f; - Vector3 offset = baseOffset + frame.LocalRight * (side * AlfarConfig.EyeSeparation); + Vector3 offset = baseOffset + frame.LocalRight * (side * separation); - eye.localPosition = Vector3.Scale(offset, toLocal); - eye.localScale = Vector3.Scale(Vector3.one * eyeSize, toLocal); + eye.localPosition = offset * toLocal; + eye.localRotation = facing * Quaternion.Euler(0f, AlfarConfig.EyeWrap * side, AlfarConfig.EyeSlant * side); + eye.localScale = extent; } } @@ -234,9 +246,8 @@ namespace RacesOfValheim } /// - /// Matte black, and nothing else: the colour is black, the emission is black, and the two - /// properties that make a lit shader shine are zeroed where the shader has them. The - /// Sverm's eyes burn; these must read as holes. + /// Black with a wet sheen: no emission, but smooth enough to catch a highlight, which is + /// what makes a grey's eyes read as eyes and not as two holes punched in the face. /// private static Material BlackMaterial(Shader shader) { @@ -244,10 +255,9 @@ namespace RacesOfValheim material.color = Color.black; if (material.HasProperty("_EmissionColor")) material.SetColor("_EmissionColor", Color.black); - if (material.HasProperty("_Glossiness")) material.SetFloat("_Glossiness", 0f); - if (material.HasProperty("_Smoothness")) material.SetFloat("_Smoothness", 0f); + if (material.HasProperty("_Glossiness")) material.SetFloat("_Glossiness", 0.8f); + if (material.HasProperty("_Smoothness")) material.SetFloat("_Smoothness", 0.8f); if (material.HasProperty("_Metallic")) material.SetFloat("_Metallic", 0f); - if (material.HasProperty("_SpecColor")) material.SetColor("_SpecColor", Color.black); return material; } diff --git a/JotunnModStub/Aswid/AswidConfig.cs b/JotunnModStub/Aswid/AswidConfig.cs index 1cf197b..ee02779 100644 --- a/JotunnModStub/Aswid/AswidConfig.cs +++ b/JotunnModStub/Aswid/AswidConfig.cs @@ -453,7 +453,7 @@ namespace RacesOfValheim new ConfigDescription("As above, around the third axis. The default half turn is what rights the borrowed socket, which arrives upside down on a player's head bone.", new AcceptableValueRange(-180f, 180f), new ConfigurationManagerAttributes { Order = 58 })); - EyeSmoke = config.Bind(eyes, "Eye Smoke", true, + EyeSmoke = config.Bind(eyes, "Eye Smoke", false, new ConfigDescription("Lights the smoke the creature carries inside its own sockets and leaves switched off. Tinted to match the eyes, so it turns with them at the last stage.", null, new ConfigurationManagerAttributes { Order = 50 })); EyeFlatColorShader = config.Bind(eyes, "Eye Flat Colour Shader", false, diff --git a/JotunnModStub/Aswid/AswidVisuals.cs b/JotunnModStub/Aswid/AswidVisuals.cs index b118424..8a6e047 100644 --- a/JotunnModStub/Aswid/AswidVisuals.cs +++ b/JotunnModStub/Aswid/AswidVisuals.cs @@ -58,6 +58,11 @@ namespace RacesOfValheim private const float BaseEyeHeight = 0.181f; private const float BaseEyeSeparation = 0.032f; + // The borrowed socket at the size the Skeleton wears it, times the config multiplier, was + // two green blocks on the face. This halves it before the multiplier, so a saved config + // keeps its meaning as "relative to the default" and the eyes read as two small points. + private const float BaseEyeScale = 0.5f; + // ─── Race check ───────────────────────────────────────────────────── /// @@ -99,6 +104,10 @@ namespace RacesOfValheim // built again rather than merely moved. public string SourceModel = ""; public bool FlatShader; + + // Which body the base pose was measured for: the female face puts the eyes elsewhere + // (PlayerFace), so a change of body model is a rebuild too. + public bool Female; } /// The pose an eye was authored at on the creature. Everything else is a delta on this. @@ -180,7 +189,8 @@ namespace RacesOfValheim EyeFrame existing = eyes.GetComponent(); if (existing == null || existing.SourceModel != AswidConfig.EyeSourceModel.Value || - existing.FlatShader != AswidConfig.EyeFlatColorShader.Value) + existing.FlatShader != AswidConfig.EyeFlatColorShader.Value || + existing.Female != PlayerFace.IsFemale(player)) { eyes.name = EyesName + "_Removed"; Object.Destroy(eyes.gameObject); @@ -424,6 +434,12 @@ namespace RacesOfValheim MeasureFrame(player, headBone, frame); frame.SourceModel = modelName; frame.FlatShader = AswidConfig.EyeFlatColorShader.Value; + frame.Female = PlayerFace.IsFemale(player); + + float baseHeight = BaseEyeHeight; + float baseSeparation = BaseEyeSeparation; + float baseSize = BaseEyeScale; + PlayerFace.AdjustEyes(player, ref baseHeight, ref baseSeparation, ref baseSize); // canonicalToFrame turns "face forward, as authored" into "face forward, on THIS // rig's own axes" - the rotation that carries the ordinary (X,Y,Z) convention onto @@ -458,8 +474,8 @@ namespace RacesOfValheim float toLocal = 1f / headBone.lossyScale.x; Vector3 basePosition = frame.LocalForward * (BaseEyeForward * toLocal) - + frame.LocalUp * (BaseEyeHeight * toLocal) - + frame.LocalRight * (side * BaseEyeSeparation * toLocal); + + frame.LocalUp * (baseHeight * toLocal) + + frame.LocalRight * (side * baseSeparation * toLocal); // The socket's own authored tilt is skipped for the same reason its position is - // canonicalToFrame alone (face forward, on this rig's axes) is what the config's @@ -481,7 +497,7 @@ namespace RacesOfValheim // this object at on a real skeleton. Divided into the new parent's scale, the pair // lands at exactly the size vanilla wears them, which is the whole point of // borrowing them instead of drawing spheres. - Vector3 baseScale = source.lossyScale * toLocal; + Vector3 baseScale = source.lossyScale * (toLocal * baseSize); // Remembered before anything moves it, because everything the config does is // expressed as a delta on this. diff --git a/JotunnModStub/Dvergar/DvergarConfig.cs b/JotunnModStub/Dvergar/DvergarConfig.cs index 745c748..3a41599 100644 --- a/JotunnModStub/Dvergar/DvergarConfig.cs +++ b/JotunnModStub/Dvergar/DvergarConfig.cs @@ -126,7 +126,9 @@ namespace RacesOfValheim public static readonly float EyeSeparation = 0.032f; // half the distance between them public static readonly float EyeForward = 0.081f; // centre ~63mm out public static readonly float EyeHeight = 0.181f; // ~15mm lower than before - public static readonly float EyeSize = 0.062f; // ~48mm across, so a 24mm radius + // Then cut down after playtest: at 0.062 the cap read as two lamps covering the face. An + // 18mm radius at the same depth leaves a cap of about 22mm on a 0.78 Dvergar. + public static readonly float EyeSize = 0.036f; // How hard the eyes burn. The colours the game gives a starred dverger are HDR - one star // is (0, 4, 3.3) - and anything past 1 clips to white on the way to the bloom pass, which diff --git a/JotunnModStub/Dvergar/DvergarVisuals.cs b/JotunnModStub/Dvergar/DvergarVisuals.cs index a6a694a..103f31d 100644 --- a/JotunnModStub/Dvergar/DvergarVisuals.cs +++ b/JotunnModStub/Dvergar/DvergarVisuals.cs @@ -277,10 +277,16 @@ namespace RacesOfValheim // metre was the entire drift: the offsets below are under a centimetre in local units // and never stood a chance of mattering next to it. float raceScale = GetVisualScale(player); - Vector3 baseLocal = localForward * (DvergarConfig.EyeForward * raceScale * toLocal) - + localUp * (DvergarConfig.EyeHeight * raceScale * toLocal); - float eyeLocalSize = DvergarConfig.EyeSize * raceScale * toLocal; + float height = DvergarConfig.EyeHeight; + float separation = DvergarConfig.EyeSeparation; + float eyeSize = DvergarConfig.EyeSize; + PlayerFace.AdjustEyes(player, ref height, ref separation, ref eyeSize); + + Vector3 baseLocal = localForward * (DvergarConfig.EyeForward * raceScale * toLocal) + + localUp * (height * raceScale * toLocal); + + float eyeLocalSize = eyeSize * raceScale * toLocal; for (int i = 0; i < holder.childCount; i++) { @@ -293,7 +299,7 @@ namespace RacesOfValheim float side = i == 0 ? -1f : 1f; float size = i == 0 ? eyeLocalSize * DvergarConfig.LeftEyeSizeMultiplier : eyeLocalSize; - eye.localPosition = baseLocal + localRight * (side * DvergarConfig.EyeSeparation * raceScale * toLocal); + eye.localPosition = baseLocal + localRight * (side * separation * raceScale * toLocal); eye.localScale = Vector3.one * size; } } diff --git a/JotunnModStub/PlayerFace.cs b/JotunnModStub/PlayerFace.cs new file mode 100644 index 0000000..15b3199 --- /dev/null +++ b/JotunnModStub/PlayerFace.cs @@ -0,0 +1,49 @@ +using UnityEngine; + +namespace RacesOfValheim +{ + /// + /// Where a player's painted eyes are, for the races that hang something over them (Alfar, + /// Aswid, Dvergar, Sverm). + /// + /// Every eye constant in this mod (0.081 forward, 0.181 up, 0.032 apart) was tuned on the MALE + /// body. The female body is a different mesh on the same rig and the same skin texture, and it + /// maps the painted eyes elsewhere: read offline from VisEquipment.m_models (bodymale vs + /// bodyfem, Valheim 1.0.20), by finding the dark socket pixels of PlayerCharacter_01 and + /// following the UVs back onto each mesh in head-bone space, the female eyes sit about 6mm + /// lower and a quarter closer together. Both are weighted 100% to Head, so once placed they + /// follow the head exactly; a sphere on the male spot simply sits on the brow, off the face. + /// + /// HEAD-LOCAL UNITS. The player armature is authored at 100x, so one metre at human scale is + /// 0.01 in the head bone's own space. That is a constant of the rig, not of this frame: + /// reading headBone.lossyScale live instead breaks under a non-uniform body scale (the Alfar), + /// where the value drifts as the head turns. + /// + public static class PlayerFace + { + public const float MetresToHeadLocal = 0.01f; + + // Female against male, measured as described above. + private const float FemaleHeightShift = -0.006f; + private const float FemaleSeparationScale = 0.75f; + private const float FemaleSizeScale = 0.9f; + + /// True while the body wears the female mesh (VisEquipment model index 1). + public static bool IsFemale(Player player) + { + VisEquipment vis = player != null ? player.GetComponent() : null; + if (vis == null || vis.m_bodyModel == null || vis.m_models == null || vis.m_models.Length < 2) return false; + return vis.m_bodyModel.sharedMesh == vis.m_models[1].m_mesh; + } + + /// Moves male-tuned eye numbers (metres) onto the female face; leaves a male face alone. + public static void AdjustEyes(Player player, ref float height, ref float separation, ref float size) + { + if (!IsFemale(player)) return; + + height += FemaleHeightShift; + separation *= FemaleSeparationScale; + size *= FemaleSizeScale; + } + } +} diff --git a/JotunnModStub/Sverm/SvermVisuals.cs b/JotunnModStub/Sverm/SvermVisuals.cs index f39e3ca..7dab089 100644 --- a/JotunnModStub/Sverm/SvermVisuals.cs +++ b/JotunnModStub/Sverm/SvermVisuals.cs @@ -251,10 +251,15 @@ namespace RacesOfValheim float scale = player.transform.localScale.x; - Vector3 baseLocal = frame.LocalForward * (EyeForward * scale * toLocal) - + frame.LocalUp * (EyeHeight * scale * toLocal); + float height = EyeHeight; + float separation = EyeSeparation; + float eyeSize = EyeSize; + PlayerFace.AdjustEyes(player, ref height, ref separation, ref eyeSize); - float eyeLocalSize = EyeSize * scale * toLocal; + Vector3 baseLocal = frame.LocalForward * (EyeForward * scale * toLocal) + + frame.LocalUp * (height * scale * toLocal); + + float eyeLocalSize = eyeSize * scale * toLocal; for (int i = 0; i < holder.childCount; i++) { @@ -264,7 +269,7 @@ namespace RacesOfValheim float side = i == 0 ? -1f : 1f; float size = i == 0 ? eyeLocalSize * LeftEyeSizeMultiplier : eyeLocalSize; - eye.localPosition = baseLocal + frame.LocalRight * (side * EyeSeparation * scale * toLocal); + eye.localPosition = baseLocal + frame.LocalRight * (side * separation * scale * toLocal); eye.localScale = Vector3.one * size; } } From a7e99964415fb1fe6444434526b19e77335e8a12 Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 27 Oct 2026 15:15:10 +0100 Subject: [PATCH 02/13] fix(eyes): lower female eyes further, push Alfar/Dvergar out, enlarge Aswid points Playtest on female characters: every race's eyes still sat about an eye-height above the painted ones. Female height shift goes from -6 to -14 mm. Alfar and Dvergar centres move 4 mm forward out of the face, and the Aswid socket goes from 0.5 to 0.75 of the borrowed size so it covers the painted eye. --- JotunnModStub/Alfar/AlfarConfig.cs | 2 +- JotunnModStub/Aswid/AswidVisuals.cs | 7 ++++--- JotunnModStub/Dvergar/DvergarConfig.cs | 2 +- JotunnModStub/PlayerFace.cs | 6 ++++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/JotunnModStub/Alfar/AlfarConfig.cs b/JotunnModStub/Alfar/AlfarConfig.cs index 7d72e25..558c0a7 100644 --- a/JotunnModStub/Alfar/AlfarConfig.cs +++ b/JotunnModStub/Alfar/AlfarConfig.cs @@ -49,7 +49,7 @@ namespace RacesOfValheim // Pushed apart and forward of the Sverm's, because an almond this wide would otherwise // meet its twin over the nose and sink into the cheek. public const float EyeSeparation = 0.037f; - public const float EyeForward = 0.086f; + public const float EyeForward = 0.090f; public const float EyeHeight = 0.183f; // Full width, height and depth of one eye in metres at Eye Size Multiplier 1. The saved diff --git a/JotunnModStub/Aswid/AswidVisuals.cs b/JotunnModStub/Aswid/AswidVisuals.cs index 8a6e047..0402d1e 100644 --- a/JotunnModStub/Aswid/AswidVisuals.cs +++ b/JotunnModStub/Aswid/AswidVisuals.cs @@ -59,9 +59,10 @@ namespace RacesOfValheim private const float BaseEyeSeparation = 0.032f; // The borrowed socket at the size the Skeleton wears it, times the config multiplier, was - // two green blocks on the face. This halves it before the multiplier, so a saved config - // keeps its meaning as "relative to the default" and the eyes read as two small points. - private const float BaseEyeScale = 0.5f; + // two green blocks on the face; at half it was smaller than the painted eye underneath, + // which then showed round it. Applied before the multiplier, so a saved config keeps its + // meaning as "relative to the default". + private const float BaseEyeScale = 0.75f; // ─── Race check ───────────────────────────────────────────────────── diff --git a/JotunnModStub/Dvergar/DvergarConfig.cs b/JotunnModStub/Dvergar/DvergarConfig.cs index 3a41599..03f0bad 100644 --- a/JotunnModStub/Dvergar/DvergarConfig.cs +++ b/JotunnModStub/Dvergar/DvergarConfig.cs @@ -124,7 +124,7 @@ namespace RacesOfValheim // still clearing by about 2mm. Same size of eye, sitting deeper, and the cap is flatter // for it - which is what reads as set into the skull rather than resting on it. public static readonly float EyeSeparation = 0.032f; // half the distance between them - public static readonly float EyeForward = 0.081f; // centre ~63mm out + public static readonly float EyeForward = 0.085f; // 0.081 left the smaller ball buried public static readonly float EyeHeight = 0.181f; // ~15mm lower than before // Then cut down after playtest: at 0.062 the cap read as two lamps covering the face. An // 18mm radius at the same depth leaves a cap of about 22mm on a 0.78 Dvergar. diff --git a/JotunnModStub/PlayerFace.cs b/JotunnModStub/PlayerFace.cs index 15b3199..4c6b39f 100644 --- a/JotunnModStub/PlayerFace.cs +++ b/JotunnModStub/PlayerFace.cs @@ -23,8 +23,10 @@ namespace RacesOfValheim { public const float MetresToHeadLocal = 0.01f; - // Female against male, measured as described above. - private const float FemaleHeightShift = -0.006f; + // Female against male. The UV reading gave -6mm, but in game the eyes still sat a full + // eye-height above the painted ones on every race (screenshots, 2026-10-27), so the + // height is the measured shift plus that. + private const float FemaleHeightShift = -0.014f; private const float FemaleSeparationScale = 0.75f; private const float FemaleSizeScale = 0.9f; From 8b2b5180ed9b612c5c7ff48b72c71fcd676f0606 Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 27 Oct 2026 15:21:19 +0100 Subject: [PATCH 03/13] feat(eyes): per-race eye position sliders in Configuration Manager One 'Eyes Position - ' section each for the Alfar, Aswid, Dvergar and Sverm, with a female and a male set: forward, height, separation and size, plus rotation X/Y/Z for the Alfar and Aswid. All are deltas on the computed placement (0 and size 1 change nothing), read live, and left local by ConfigSync because they only change how this client draws faces. --- JotunnModStub/Alfar/AlfarVisuals.cs | 20 ++++- JotunnModStub/Aswid/AswidVisuals.cs | 21 ++++-- JotunnModStub/ConfigSync.cs | 1 + JotunnModStub/Dvergar/DvergarVisuals.cs | 12 ++- JotunnModStub/EyePositionConfig.cs | 98 +++++++++++++++++++++++++ JotunnModStub/RacesOfValheim.cs | 2 + JotunnModStub/Sverm/SvermVisuals.cs | 12 ++- 7 files changed, 155 insertions(+), 11 deletions(-) create mode 100644 JotunnModStub/EyePositionConfig.cs diff --git a/JotunnModStub/Alfar/AlfarVisuals.cs b/JotunnModStub/Alfar/AlfarVisuals.cs index c2f2065..e281db9 100644 --- a/JotunnModStub/Alfar/AlfarVisuals.cs +++ b/JotunnModStub/Alfar/AlfarVisuals.cs @@ -186,7 +186,23 @@ namespace RacesOfValheim float size = AlfarConfig.EyeSizeMultiplier.Value; PlayerFace.AdjustEyes(player, ref height, ref separation, ref size); - Vector3 baseOffset = frame.LocalForward * AlfarConfig.EyeForward + frame.LocalUp * height; + float forward = AlfarConfig.EyeForward; + float wrap = AlfarConfig.EyeWrap; + float slant = AlfarConfig.EyeSlant; + float tilt = 0f; + EyePositionConfig.Tuning tuning = EyePositionConfig.For(AlfarConfig.RaceId, player); + if (tuning != null) + { + forward += tuning.Forward.Value; + height += tuning.Height.Value; + separation += tuning.Separation.Value; + size *= tuning.Size.Value; + tilt = tuning.RotX; + wrap += tuning.RotY; + slant += tuning.RotZ; + } + + Vector3 baseOffset = frame.LocalForward * forward + frame.LocalUp * height; Vector3 extent = AlfarConfig.EyeExtent * (size * toLocal); Quaternion facing = Quaternion.LookRotation(frame.LocalForward, frame.LocalUp); @@ -200,7 +216,7 @@ namespace RacesOfValheim Vector3 offset = baseOffset + frame.LocalRight * (side * separation); eye.localPosition = offset * toLocal; - eye.localRotation = facing * Quaternion.Euler(0f, AlfarConfig.EyeWrap * side, AlfarConfig.EyeSlant * side); + eye.localRotation = facing * Quaternion.Euler(tilt, wrap * side, slant * side); eye.localScale = extent; } } diff --git a/JotunnModStub/Aswid/AswidVisuals.cs b/JotunnModStub/Aswid/AswidVisuals.cs index 0402d1e..738170c 100644 --- a/JotunnModStub/Aswid/AswidVisuals.cs +++ b/JotunnModStub/Aswid/AswidVisuals.cs @@ -320,8 +320,15 @@ namespace RacesOfValheim float scale = GetPlayerScale(player) * toLocal; - Vector3 shift = frame.LocalForward * (AswidConfig.EyeForwardOffset.Value * scale) - + frame.LocalUp * (AswidConfig.EyeHeightOffset.Value * scale); + // The per-body sliders of "Eyes Position - Aswid", on top of the race's own offsets. + EyePositionConfig.Tuning tuning = EyePositionConfig.For("Aswid", player); + float forward = AswidConfig.EyeForwardOffset.Value + (tuning != null ? tuning.Forward.Value : 0f); + float height = AswidConfig.EyeHeightOffset.Value + (tuning != null ? tuning.Height.Value : 0f); + float separation = AswidConfig.EyeSeparationOffset.Value + (tuning != null ? tuning.Separation.Value : 0f); + float size = AswidConfig.EyeSizeMultiplier.Value * (tuning != null ? tuning.Size.Value : 1f); + + Vector3 shift = frame.LocalForward * (forward * scale) + + frame.LocalUp * (height * scale); for (int i = 0; i < holder.childCount; i++) { @@ -344,14 +351,14 @@ namespace RacesOfValheim // Pitch and roll are shared deliberately: both eyes looking up is a face looking // up, and mirroring either of those would cross them instead of aiming them. Quaternion twist = Quaternion.Euler( - AswidConfig.EyeRotationX.Value, - AswidConfig.EyeRotationY.Value * side, - AswidConfig.EyeRotationZ.Value); + AswidConfig.EyeRotationX.Value + (tuning != null ? tuning.RotX : 0f), + (AswidConfig.EyeRotationY.Value + (tuning != null ? tuning.RotY : 0f)) * side, + AswidConfig.EyeRotationZ.Value + (tuning != null ? tuning.RotZ * side : 0f)); eye.localPosition = authored.Position + shift + - frame.LocalRight * (side * AswidConfig.EyeSeparationOffset.Value * scale); + frame.LocalRight * (side * separation * scale); eye.localRotation = twist * authored.Rotation; - eye.localScale = authored.Scale * AswidConfig.EyeSizeMultiplier.Value; + eye.localScale = authored.Scale * size; } } diff --git a/JotunnModStub/ConfigSync.cs b/JotunnModStub/ConfigSync.cs index abbad38..0f9ac48 100644 --- a/JotunnModStub/ConfigSync.cs +++ b/JotunnModStub/ConfigSync.cs @@ -87,6 +87,7 @@ namespace RacesOfValheim if (section.EndsWith("Keybinds", StringComparison.OrdinalIgnoreCase)) return false; if (LocalSections.Contains(section, StringComparer.OrdinalIgnoreCase)) return false; + if (section.StartsWith(EyePositionConfig.SectionPrefix, StringComparison.OrdinalIgnoreCase)) return false; if (LocalKeyParts.Any(key.Contains)) return false; // Model pose nudges (rotation/offset/yaw) are cosmetic, but "Attack Reach Offset" is a diff --git a/JotunnModStub/Dvergar/DvergarVisuals.cs b/JotunnModStub/Dvergar/DvergarVisuals.cs index 103f31d..9ca8815 100644 --- a/JotunnModStub/Dvergar/DvergarVisuals.cs +++ b/JotunnModStub/Dvergar/DvergarVisuals.cs @@ -283,7 +283,17 @@ namespace RacesOfValheim float eyeSize = DvergarConfig.EyeSize; PlayerFace.AdjustEyes(player, ref height, ref separation, ref eyeSize); - Vector3 baseLocal = localForward * (DvergarConfig.EyeForward * raceScale * toLocal) + float forward = DvergarConfig.EyeForward; + EyePositionConfig.Tuning tuning = EyePositionConfig.For(DvergarConfig.RaceId, player); + if (tuning != null) + { + forward += tuning.Forward.Value; + height += tuning.Height.Value; + separation += tuning.Separation.Value; + eyeSize *= tuning.Size.Value; + } + + Vector3 baseLocal = localForward * (forward * raceScale * toLocal) + localUp * (height * raceScale * toLocal); float eyeLocalSize = eyeSize * raceScale * toLocal; diff --git a/JotunnModStub/EyePositionConfig.cs b/JotunnModStub/EyePositionConfig.cs new file mode 100644 index 0000000..bd4a942 --- /dev/null +++ b/JotunnModStub/EyePositionConfig.cs @@ -0,0 +1,98 @@ +using System.Collections.Generic; +using BepInEx.Configuration; + +namespace RacesOfValheim +{ + /// + /// Hand placement for every race that hangs eyes on the face: one "Eyes Position - race" + /// section each, with a female and a male set, because the two bodies put their painted eyes + /// in different places (PlayerFace). Every value is a delta on the placement the race's own + /// code computes, so all zeros (and size 1) is the shipped look. + /// + /// Local, never synced (ConfigSync): it only changes how this client draws faces. + /// + public static class EyePositionConfig + { + public const string SectionPrefix = "Eyes Position - "; + + /// One body's sliders for one race. + public sealed class Tuning + { + public ConfigEntry Forward; + public ConfigEntry Height; + public ConfigEntry Separation; + public ConfigEntry Size; + + // Only bound for races whose eyes are not spheres; null elsewhere. + public ConfigEntry RotationX; + public ConfigEntry RotationY; + public ConfigEntry RotationZ; + + public float RotX => RotationX != null ? RotationX.Value : 0f; + public float RotY => RotationY != null ? RotationY.Value : 0f; + public float RotZ => RotationZ != null ? RotationZ.Value : 0f; + } + + // [race] -> { male, female } + private static readonly Dictionary tunings = new Dictionary(); + + public static void Bind(ConfigFile config) + { + BindRace(config, AlfarConfig.RaceId, true); + BindRace(config, "Aswid", true); + BindRace(config, DvergarConfig.RaceId, false); + BindRace(config, SvermConfig.RaceId, false); + } + + /// The sliders for the body this player is wearing right now. + public static Tuning For(string race, Player player) + { + if (!tunings.TryGetValue(race, out Tuning[] pair)) return null; + return pair[PlayerFace.IsFemale(player) ? 1 : 0]; + } + + private static void BindRace(ConfigFile config, string race, bool rotation) + { + string section = SectionPrefix + race; + tunings[race] = new[] + { + BindBody(config, section, "Male", rotation, 100), + BindBody(config, section, "Female", rotation, 200), + }; + } + + private static Tuning BindBody(ConfigFile config, string section, string body, bool rotation, int order) + { + // Female first in the list: Order sorts high to low. + Tuning t = new Tuning(); + + t.Forward = config.Bind(section, body + " Forward", 0f, + new ConfigDescription($"{body} characters: moves both eyes out of (+) or into (-) the face, in metres.", + new AcceptableValueRange(-0.05f, 0.05f), new ConfigurationManagerAttributes { Order = order + 9 })); + t.Height = config.Bind(section, body + " Height", 0f, + new ConfigDescription($"{body} characters: moves both eyes up (+) or down (-), in metres.", + new AcceptableValueRange(-0.05f, 0.05f), new ConfigurationManagerAttributes { Order = order + 8 })); + t.Separation = config.Bind(section, body + " Separation", 0f, + new ConfigDescription($"{body} characters: pushes the eyes apart (+) or together (-), in metres. Each eye moves by this much.", + new AcceptableValueRange(-0.03f, 0.03f), new ConfigurationManagerAttributes { Order = order + 7 })); + t.Size = config.Bind(section, body + " Size", 1f, + new ConfigDescription($"{body} characters: scales both eyes. 1 is the default size.", + new AcceptableValueRange(0.2f, 3f), new ConfigurationManagerAttributes { Order = order + 6 })); + + if (rotation) + { + t.RotationX = config.Bind(section, body + " Rotation X", 0f, + new ConfigDescription($"{body} characters: tilts both eyes up or down, in degrees.", + new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 5 })); + t.RotationY = config.Bind(section, body + " Rotation Y", 0f, + new ConfigDescription($"{body} characters: turns the eyes toward the temples (+) or the nose (-), in degrees. Mirrored between the two eyes.", + new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 4 })); + t.RotationZ = config.Bind(section, body + " Rotation Z", 0f, + new ConfigDescription($"{body} characters: raises (+) or lowers (-) the outer corners, in degrees. Mirrored between the two eyes.", + new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 3 })); + } + + return t; + } + } +} diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs index f075a97..5eb3b9b 100644 --- a/JotunnModStub/RacesOfValheim.cs +++ b/JotunnModStub/RacesOfValheim.cs @@ -56,6 +56,8 @@ namespace RacesOfValheim // Not a race either: the faction truce and the faction merchants, which cut across // every race at once, so they bind last rather than inside the alphabetical run above. FactionsConfig.Bind(Config); + // Not a race either: the hand placement of every race's eyes, one section per race. + EyePositionConfig.Bind(Config); // After every Bind above: tags the gameplay entries for Jotunn's server-to-client sync. ConfigSync.Apply(Config); harmony.PatchAll(); diff --git a/JotunnModStub/Sverm/SvermVisuals.cs b/JotunnModStub/Sverm/SvermVisuals.cs index 7dab089..9cb6c82 100644 --- a/JotunnModStub/Sverm/SvermVisuals.cs +++ b/JotunnModStub/Sverm/SvermVisuals.cs @@ -256,7 +256,17 @@ namespace RacesOfValheim float eyeSize = EyeSize; PlayerFace.AdjustEyes(player, ref height, ref separation, ref eyeSize); - Vector3 baseLocal = frame.LocalForward * (EyeForward * scale * toLocal) + float forward = EyeForward; + EyePositionConfig.Tuning tuning = EyePositionConfig.For(SvermConfig.RaceId, player); + if (tuning != null) + { + forward += tuning.Forward.Value; + height += tuning.Height.Value; + separation += tuning.Separation.Value; + eyeSize *= tuning.Size.Value; + } + + Vector3 baseLocal = frame.LocalForward * (forward * scale * toLocal) + frame.LocalUp * (height * scale * toLocal); float eyeLocalSize = eyeSize * scale * toLocal; From 20c12724fde99007cae8f7462f549d36d7c3eca2 Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 27 Oct 2026 15:38:52 +0100 Subject: [PATCH 04/13] feat(eyes): female eye defaults from playtest The female slider values dialled in on screen for the Dvergar, Alfar and Aswid become the defaults of their Eyes Position sections, so a fresh install lands on the tuned faces. The Sverm keeps zeros: its helmet hides the eyes. --- JotunnModStub/EyePositionConfig.cs | 46 +++++++++++++++++++----------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/JotunnModStub/EyePositionConfig.cs b/JotunnModStub/EyePositionConfig.cs index bd4a942..be3b94e 100644 --- a/JotunnModStub/EyePositionConfig.cs +++ b/JotunnModStub/EyePositionConfig.cs @@ -7,7 +7,8 @@ namespace RacesOfValheim /// Hand placement for every race that hangs eyes on the face: one "Eyes Position - race" /// section each, with a female and a male set, because the two bodies put their painted eyes /// in different places (PlayerFace). Every value is a delta on the placement the race's own - /// code computes, so all zeros (and size 1) is the shipped look. + /// code computes: all zeros (and size 1) is the code's own placement, and the female + /// defaults below are the corrections found in game on top of it. /// /// Local, never synced (ConfigSync): it only changes how this client draws faces. /// @@ -38,10 +39,23 @@ namespace RacesOfValheim public static void Bind(ConfigFile config) { - BindRace(config, AlfarConfig.RaceId, true); - BindRace(config, "Aswid", true); - BindRace(config, DvergarConfig.RaceId, false); - BindRace(config, SvermConfig.RaceId, false); + // Female defaults dialled in on screen (playtest, 2026-10-27). The male ones are + // still the code's own placement; the Sverm's helmet hides its eyes, so it keeps it. + BindRace(config, AlfarConfig.RaceId, true, + new Defaults { Separation = 0.006f, RotX = -17.524f }); + BindRace(config, "Aswid", true, + new Defaults { Forward = -0.001f, Height = 0.001f, Separation = 0.006f, Size = 1.061f, + RotX = -4.543f, RotY = -1.514f, RotZ = -4.543f }); + BindRace(config, DvergarConfig.RaceId, false, + new Defaults { Forward = -0.011f, Separation = 0.005f, Size = 1.616f }); + BindRace(config, SvermConfig.RaceId, false, new Defaults()); + } + + /// Starting values for one body's sliders. + private sealed class Defaults + { + public float Forward, Height, Separation, RotX, RotY, RotZ; + public float Size = 1f; } /// The sliders for the body this player is wearing right now. @@ -51,43 +65,43 @@ namespace RacesOfValheim return pair[PlayerFace.IsFemale(player) ? 1 : 0]; } - private static void BindRace(ConfigFile config, string race, bool rotation) + private static void BindRace(ConfigFile config, string race, bool rotation, Defaults female) { string section = SectionPrefix + race; tunings[race] = new[] { - BindBody(config, section, "Male", rotation, 100), - BindBody(config, section, "Female", rotation, 200), + BindBody(config, section, "Male", rotation, 100, new Defaults()), + BindBody(config, section, "Female", rotation, 200, female), }; } - private static Tuning BindBody(ConfigFile config, string section, string body, bool rotation, int order) + private static Tuning BindBody(ConfigFile config, string section, string body, bool rotation, int order, Defaults d) { // Female first in the list: Order sorts high to low. Tuning t = new Tuning(); - t.Forward = config.Bind(section, body + " Forward", 0f, + t.Forward = config.Bind(section, body + " Forward", d.Forward, new ConfigDescription($"{body} characters: moves both eyes out of (+) or into (-) the face, in metres.", new AcceptableValueRange(-0.05f, 0.05f), new ConfigurationManagerAttributes { Order = order + 9 })); - t.Height = config.Bind(section, body + " Height", 0f, + t.Height = config.Bind(section, body + " Height", d.Height, new ConfigDescription($"{body} characters: moves both eyes up (+) or down (-), in metres.", new AcceptableValueRange(-0.05f, 0.05f), new ConfigurationManagerAttributes { Order = order + 8 })); - t.Separation = config.Bind(section, body + " Separation", 0f, + t.Separation = config.Bind(section, body + " Separation", d.Separation, new ConfigDescription($"{body} characters: pushes the eyes apart (+) or together (-), in metres. Each eye moves by this much.", new AcceptableValueRange(-0.03f, 0.03f), new ConfigurationManagerAttributes { Order = order + 7 })); - t.Size = config.Bind(section, body + " Size", 1f, + t.Size = config.Bind(section, body + " Size", d.Size, new ConfigDescription($"{body} characters: scales both eyes. 1 is the default size.", new AcceptableValueRange(0.2f, 3f), new ConfigurationManagerAttributes { Order = order + 6 })); if (rotation) { - t.RotationX = config.Bind(section, body + " Rotation X", 0f, + t.RotationX = config.Bind(section, body + " Rotation X", d.RotX, new ConfigDescription($"{body} characters: tilts both eyes up or down, in degrees.", new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 5 })); - t.RotationY = config.Bind(section, body + " Rotation Y", 0f, + t.RotationY = config.Bind(section, body + " Rotation Y", d.RotY, new ConfigDescription($"{body} characters: turns the eyes toward the temples (+) or the nose (-), in degrees. Mirrored between the two eyes.", new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 4 })); - t.RotationZ = config.Bind(section, body + " Rotation Z", 0f, + t.RotationZ = config.Bind(section, body + " Rotation Z", d.RotZ, new ConfigDescription($"{body} characters: raises (+) or lowers (-) the outer corners, in degrees. Mirrored between the two eyes.", new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 3 })); } From ffba40650ed5df1716c3d33e071bde7b5e2d1478 Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 27 Oct 2026 15:40:52 +0100 Subject: [PATCH 05/13] fix(aswid): eye position sliders rotate on the face's axes The Eyes Position rotation was added to the Aswid's own twist, which works on the head bone's raw axes: bone X points out of the face and bone Z sideways, so Rotation X rolled the eyes and the mirrored Rotation Z tipped one eye up and the other down. The slider rotation is now conjugated by the face frame, so X tips, Y turns toward the temple and Z raises the outer corner on both eyes alike. The female rotation defaults go back to 0, since the old numbers meant other axes. --- JotunnModStub/Aswid/AswidVisuals.cs | 24 ++++++++++++++++++++---- JotunnModStub/EyePositionConfig.cs | 5 ++--- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/JotunnModStub/Aswid/AswidVisuals.cs b/JotunnModStub/Aswid/AswidVisuals.cs index 738170c..3fd25ba 100644 --- a/JotunnModStub/Aswid/AswidVisuals.cs +++ b/JotunnModStub/Aswid/AswidVisuals.cs @@ -350,14 +350,30 @@ namespace RacesOfValheim // // Pitch and roll are shared deliberately: both eyes looking up is a face looking // up, and mirroring either of those would cross them instead of aiming them. + // + // This twist is on the HEAD BONE's raw axes (it multiplies from the left), and on + // this rig those are not the face's: bone X points out of the face and bone Z + // sideways. The defaults were dialled in against that, so it stays as it is. Quaternion twist = Quaternion.Euler( - AswidConfig.EyeRotationX.Value + (tuning != null ? tuning.RotX : 0f), - (AswidConfig.EyeRotationY.Value + (tuning != null ? tuning.RotY : 0f)) * side, - AswidConfig.EyeRotationZ.Value + (tuning != null ? tuning.RotZ * side : 0f)); + AswidConfig.EyeRotationX.Value, + AswidConfig.EyeRotationY.Value * side, + AswidConfig.EyeRotationZ.Value); + + // The Eyes Position sliders turn the eye on the FACE's axes instead: conjugated by + // the face frame, X tips it, Y turns it toward the temple and Z raises the outer + // corner, the same on both eyes. Added to the bone-axis twist above, X rolled the + // eyes and a mirrored Z tipped one up and the other down. + Quaternion nudge = Quaternion.identity; + if (tuning != null) + { + nudge = authored.Rotation + * Quaternion.Euler(tuning.RotX, tuning.RotY * side, tuning.RotZ * side) + * Quaternion.Inverse(authored.Rotation); + } eye.localPosition = authored.Position + shift + frame.LocalRight * (side * separation * scale); - eye.localRotation = twist * authored.Rotation; + eye.localRotation = nudge * twist * authored.Rotation; eye.localScale = authored.Scale * size; } } diff --git a/JotunnModStub/EyePositionConfig.cs b/JotunnModStub/EyePositionConfig.cs index be3b94e..88f03d6 100644 --- a/JotunnModStub/EyePositionConfig.cs +++ b/JotunnModStub/EyePositionConfig.cs @@ -44,8 +44,7 @@ namespace RacesOfValheim BindRace(config, AlfarConfig.RaceId, true, new Defaults { Separation = 0.006f, RotX = -17.524f }); BindRace(config, "Aswid", true, - new Defaults { Forward = -0.001f, Height = 0.001f, Separation = 0.006f, Size = 1.061f, - RotX = -4.543f, RotY = -1.514f, RotZ = -4.543f }); + new Defaults { Forward = -0.001f, Height = 0.001f, Separation = 0.006f, Size = 1.061f }); BindRace(config, DvergarConfig.RaceId, false, new Defaults { Forward = -0.011f, Separation = 0.005f, Size = 1.616f }); BindRace(config, SvermConfig.RaceId, false, new Defaults()); @@ -96,7 +95,7 @@ namespace RacesOfValheim if (rotation) { t.RotationX = config.Bind(section, body + " Rotation X", d.RotX, - new ConfigDescription($"{body} characters: tilts both eyes up or down, in degrees.", + new ConfigDescription($"{body} characters: tips both eyes down (+) or up (-), in degrees.", new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 5 })); t.RotationY = config.Bind(section, body + " Rotation Y", d.RotY, new ConfigDescription($"{body} characters: turns the eyes toward the temples (+) or the nose (-), in degrees. Mirrored between the two eyes.", From 132d7e034f47a1a61ef57a2b32f4e1c5faf2338d Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 27 Oct 2026 16:03:24 +0100 Subject: [PATCH 06/13] feat(eyes): per-eye sliders, Aswid female defaults from playtest Each Eyes Position section now has a set per body and per eye (the character's own left and right), because the face is not symmetric enough for one set to fit both eyes. The Aswid female defaults are the per-eye values dialled in on screen; Alfar and Dvergar copy their female values to both eyes. The old shared keys are dropped: they only ever existed in test builds. --- JotunnModStub/Alfar/AlfarVisuals.cs | 44 ++++++------ JotunnModStub/Aswid/AswidVisuals.cs | 20 +++--- JotunnModStub/Dvergar/DvergarVisuals.cs | 35 +++++----- JotunnModStub/EyePositionConfig.cs | 90 +++++++++++++++---------- JotunnModStub/Sverm/SvermVisuals.cs | 35 +++++----- 5 files changed, 124 insertions(+), 100 deletions(-) diff --git a/JotunnModStub/Alfar/AlfarVisuals.cs b/JotunnModStub/Alfar/AlfarVisuals.cs index e281db9..70b3f68 100644 --- a/JotunnModStub/Alfar/AlfarVisuals.cs +++ b/JotunnModStub/Alfar/AlfarVisuals.cs @@ -186,24 +186,6 @@ namespace RacesOfValheim float size = AlfarConfig.EyeSizeMultiplier.Value; PlayerFace.AdjustEyes(player, ref height, ref separation, ref size); - float forward = AlfarConfig.EyeForward; - float wrap = AlfarConfig.EyeWrap; - float slant = AlfarConfig.EyeSlant; - float tilt = 0f; - EyePositionConfig.Tuning tuning = EyePositionConfig.For(AlfarConfig.RaceId, player); - if (tuning != null) - { - forward += tuning.Forward.Value; - height += tuning.Height.Value; - separation += tuning.Separation.Value; - size *= tuning.Size.Value; - tilt = tuning.RotX; - wrap += tuning.RotY; - slant += tuning.RotZ; - } - - Vector3 baseOffset = frame.LocalForward * forward + frame.LocalUp * height; - Vector3 extent = AlfarConfig.EyeExtent * (size * toLocal); Quaternion facing = Quaternion.LookRotation(frame.LocalForward, frame.LocalUp); for (int i = 0; i < holder.childCount; i++) @@ -213,11 +195,33 @@ namespace RacesOfValheim // Index 0 is offset against the right axis, so it is the model's left eye. The // slant and the wrap are mirrored so both outer corners go up and back. float side = i == 0 ? -1f : 1f; - Vector3 offset = baseOffset + frame.LocalRight * (side * separation); + + // This eye's sliders from "Eyes Position - Alfar". + float forward = AlfarConfig.EyeForward; + float eyeHeight = height; + float eyeSeparation = separation; + float eyeSize = size; + float wrap = AlfarConfig.EyeWrap; + float slant = AlfarConfig.EyeSlant; + float tilt = 0f; + EyePositionConfig.Tuning tuning = EyePositionConfig.For(AlfarConfig.RaceId, player, side); + if (tuning != null) + { + forward += tuning.Forward.Value; + eyeHeight += tuning.Height.Value; + eyeSeparation += tuning.Separation.Value; + eyeSize *= tuning.Size.Value; + tilt = tuning.RotX; + wrap += tuning.RotY; + slant += tuning.RotZ; + } + + Vector3 offset = frame.LocalForward * forward + frame.LocalUp * eyeHeight + + frame.LocalRight * (side * eyeSeparation); eye.localPosition = offset * toLocal; eye.localRotation = facing * Quaternion.Euler(tilt, wrap * side, slant * side); - eye.localScale = extent; + eye.localScale = AlfarConfig.EyeExtent * (eyeSize * toLocal); } } diff --git a/JotunnModStub/Aswid/AswidVisuals.cs b/JotunnModStub/Aswid/AswidVisuals.cs index 3fd25ba..8d0aeef 100644 --- a/JotunnModStub/Aswid/AswidVisuals.cs +++ b/JotunnModStub/Aswid/AswidVisuals.cs @@ -320,16 +320,6 @@ namespace RacesOfValheim float scale = GetPlayerScale(player) * toLocal; - // The per-body sliders of "Eyes Position - Aswid", on top of the race's own offsets. - EyePositionConfig.Tuning tuning = EyePositionConfig.For("Aswid", player); - float forward = AswidConfig.EyeForwardOffset.Value + (tuning != null ? tuning.Forward.Value : 0f); - float height = AswidConfig.EyeHeightOffset.Value + (tuning != null ? tuning.Height.Value : 0f); - float separation = AswidConfig.EyeSeparationOffset.Value + (tuning != null ? tuning.Separation.Value : 0f); - float size = AswidConfig.EyeSizeMultiplier.Value * (tuning != null ? tuning.Size.Value : 1f); - - Vector3 shift = frame.LocalForward * (forward * scale) - + frame.LocalUp * (height * scale); - for (int i = 0; i < holder.childCount; i++) { Transform eye = holder.GetChild(i); @@ -342,6 +332,16 @@ namespace RacesOfValheim float side = Mathf.Sign(Vector3.Dot(authored.Position, frame.LocalRight)); if (side == 0f) side = i == 0 ? -1f : 1f; + // This eye's sliders from "Eyes Position - Aswid", on top of the race's own offsets. + EyePositionConfig.Tuning tuning = EyePositionConfig.For("Aswid", player, side); + float forward = AswidConfig.EyeForwardOffset.Value + (tuning != null ? tuning.Forward.Value : 0f); + float height = AswidConfig.EyeHeightOffset.Value + (tuning != null ? tuning.Height.Value : 0f); + float separation = AswidConfig.EyeSeparationOffset.Value + (tuning != null ? tuning.Separation.Value : 0f); + float size = AswidConfig.EyeSizeMultiplier.Value * (tuning != null ? tuning.Size.Value : 1f); + + Vector3 shift = frame.LocalForward * (forward * scale) + + frame.LocalUp * (height * scale); + // YAW IS MIRRORED, the other two are not. Turning both eyes the same way on Y // makes the pair look sideways - both point off the same shoulder, because a face // is symmetric about its centre line and yaw is the axis that crosses it. Negating diff --git a/JotunnModStub/Dvergar/DvergarVisuals.cs b/JotunnModStub/Dvergar/DvergarVisuals.cs index 9ca8815..b156fe2 100644 --- a/JotunnModStub/Dvergar/DvergarVisuals.cs +++ b/JotunnModStub/Dvergar/DvergarVisuals.cs @@ -283,21 +283,6 @@ namespace RacesOfValheim float eyeSize = DvergarConfig.EyeSize; PlayerFace.AdjustEyes(player, ref height, ref separation, ref eyeSize); - float forward = DvergarConfig.EyeForward; - EyePositionConfig.Tuning tuning = EyePositionConfig.For(DvergarConfig.RaceId, player); - if (tuning != null) - { - forward += tuning.Forward.Value; - height += tuning.Height.Value; - separation += tuning.Separation.Value; - eyeSize *= tuning.Size.Value; - } - - Vector3 baseLocal = localForward * (forward * raceScale * toLocal) - + localUp * (height * raceScale * toLocal); - - float eyeLocalSize = eyeSize * raceScale * toLocal; - for (int i = 0; i < holder.childCount; i++) { Transform eye = holder.GetChild(i); @@ -307,9 +292,25 @@ namespace RacesOfValheim // curved and the two sides do not present the same surface to a ball of this // radius. float side = i == 0 ? -1f : 1f; - float size = i == 0 ? eyeLocalSize * DvergarConfig.LeftEyeSizeMultiplier : eyeLocalSize; - eye.localPosition = baseLocal + localRight * (side * separation * raceScale * toLocal); + // This eye's sliders from "Eyes Position - Dvergar". + float forward = DvergarConfig.EyeForward; + float eyeHeight = height; + float eyeSeparation = separation; + float size = eyeSize * raceScale * toLocal; + EyePositionConfig.Tuning tuning = EyePositionConfig.For(DvergarConfig.RaceId, player, side); + if (tuning != null) + { + forward += tuning.Forward.Value; + eyeHeight += tuning.Height.Value; + eyeSeparation += tuning.Separation.Value; + size *= tuning.Size.Value; + } + if (i == 0) size *= DvergarConfig.LeftEyeSizeMultiplier; + + eye.localPosition = localForward * (forward * raceScale * toLocal) + + localUp * (eyeHeight * raceScale * toLocal) + + localRight * (side * eyeSeparation * raceScale * toLocal); eye.localScale = Vector3.one * size; } } diff --git a/JotunnModStub/EyePositionConfig.cs b/JotunnModStub/EyePositionConfig.cs index 88f03d6..26c9e2f 100644 --- a/JotunnModStub/EyePositionConfig.cs +++ b/JotunnModStub/EyePositionConfig.cs @@ -5,10 +5,13 @@ namespace RacesOfValheim { /// /// Hand placement for every race that hangs eyes on the face: one "Eyes Position - race" - /// section each, with a female and a male set, because the two bodies put their painted eyes - /// in different places (PlayerFace). Every value is a delta on the placement the race's own - /// code computes: all zeros (and size 1) is the code's own placement, and the female - /// defaults below are the corrections found in game on top of it. + /// section each, with a set of sliders 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: all zeros (and size + /// 1) is the code's own placement, and the female defaults below are the corrections found in + /// game on top of it. /// /// Local, never synced (ConfigSync): it only changes how this client draws faces. /// @@ -16,7 +19,7 @@ namespace RacesOfValheim { public const string SectionPrefix = "Eyes Position - "; - /// One body's sliders for one race. + /// One eye's sliders, for one body of one race. public sealed class Tuning { public ConfigEntry Forward; @@ -34,74 +37,89 @@ namespace RacesOfValheim public float RotZ => RotationZ != null ? RotationZ.Value : 0f; } - // [race] -> { male, female } + // [race] -> { male left, male right, female left, female right } private static readonly Dictionary tunings = new Dictionary(); public static void Bind(ConfigFile config) { // Female defaults dialled in on screen (playtest, 2026-10-27). The male ones are // still the code's own placement; the Sverm's helmet hides its eyes, so it keeps it. - BindRace(config, AlfarConfig.RaceId, true, - new Defaults { Separation = 0.006f, RotX = -17.524f }); + Defaults alfar = new Defaults { Separation = 0.006f, RotX = -17.524f }; + BindRace(config, AlfarConfig.RaceId, true, alfar, alfar); + BindRace(config, "Aswid", true, - new Defaults { Forward = -0.001f, Height = 0.001f, Separation = 0.006f, Size = 1.061f }); - BindRace(config, DvergarConfig.RaceId, false, - new Defaults { Forward = -0.011f, Separation = 0.005f, Size = 1.616f }); - BindRace(config, SvermConfig.RaceId, false, new Defaults()); + new Defaults { Forward = -0.002f, Height = -0.001f, Separation = 0.003f, Size = 1.142f, + RotX = 1.298f, RotY = 0.649f }, + new Defaults { Forward = -0.001f, Height = -0.001f, Separation = 0.009f, Size = 1.142f, + RotX = 1.298f, RotY = 0.649f, RotZ = -7.788f }); + + Defaults dvergar = new Defaults { Forward = -0.011f, Separation = 0.005f, Size = 1.616f }; + BindRace(config, DvergarConfig.RaceId, false, dvergar, dvergar); + + BindRace(config, SvermConfig.RaceId, false, new Defaults(), new Defaults()); } - /// Starting values for one body's sliders. + /// Starting values for one eye's sliders. private sealed class Defaults { public float Forward, Height, Separation, RotX, RotY, RotZ; public float Size = 1f; } - /// The sliders for the body this player is wearing right now. - public static Tuning For(string race, Player player) + /// + /// The sliders 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. + /// + public static Tuning For(string race, Player player, float side) { - if (!tunings.TryGetValue(race, out Tuning[] pair)) return null; - return pair[PlayerFace.IsFemale(player) ? 1 : 0]; + if (!tunings.TryGetValue(race, out Tuning[] set)) return null; + return set[(PlayerFace.IsFemale(player) ? 2 : 0) + (side < 0f ? 0 : 1)]; } - private static void BindRace(ConfigFile config, string race, bool rotation, Defaults female) + private static void BindRace(ConfigFile config, string race, bool rotation, Defaults femaleLeft, Defaults femaleRight) { string section = SectionPrefix + race; + + // Female first in the list, left before right: Order sorts high to low. tunings[race] = new[] { - BindBody(config, section, "Male", rotation, 100, new Defaults()), - BindBody(config, section, "Female", rotation, 200, female), + BindEye(config, section, "Male", "Left", rotation, 200, new Defaults()), + BindEye(config, section, "Male", "Right", rotation, 100, new Defaults()), + BindEye(config, section, "Female", "Left", rotation, 400, femaleLeft), + BindEye(config, section, "Female", "Right", rotation, 300, femaleRight), }; } - private static Tuning BindBody(ConfigFile config, string section, string body, bool rotation, int order, Defaults d) + private static Tuning BindEye(ConfigFile config, string section, string body, string eye, bool rotation, int order, Defaults d) { - // Female first in the list: Order sorts high to low. + string prefix = $"{body} {eye} Eye "; + string who = $"{body} characters, {eye.ToLowerInvariant()} eye (the character's own {eye.ToLowerInvariant()})"; Tuning t = new Tuning(); - t.Forward = config.Bind(section, body + " Forward", d.Forward, - new ConfigDescription($"{body} characters: moves both eyes out of (+) or into (-) the face, in metres.", + t.Forward = config.Bind(section, prefix + "Forward", d.Forward, + new ConfigDescription($"{who}: moves the eye out of (+) or into (-) the face, in metres.", new AcceptableValueRange(-0.05f, 0.05f), new ConfigurationManagerAttributes { Order = order + 9 })); - t.Height = config.Bind(section, body + " Height", d.Height, - new ConfigDescription($"{body} characters: moves both eyes up (+) or down (-), in metres.", + t.Height = config.Bind(section, prefix + "Height", d.Height, + new ConfigDescription($"{who}: moves the eye up (+) or down (-), in metres.", new AcceptableValueRange(-0.05f, 0.05f), new ConfigurationManagerAttributes { Order = order + 8 })); - t.Separation = config.Bind(section, body + " Separation", d.Separation, - new ConfigDescription($"{body} characters: pushes the eyes apart (+) or together (-), in metres. Each eye moves by this much.", + t.Separation = config.Bind(section, prefix + "Separation", d.Separation, + new ConfigDescription($"{who}: moves the eye away from (+) or toward (-) the nose, in metres.", new AcceptableValueRange(-0.03f, 0.03f), new ConfigurationManagerAttributes { Order = order + 7 })); - t.Size = config.Bind(section, body + " Size", d.Size, - new ConfigDescription($"{body} characters: scales both eyes. 1 is the default size.", + t.Size = config.Bind(section, prefix + "Size", d.Size, + new ConfigDescription($"{who}: scales the eye. 1 is the default size.", new AcceptableValueRange(0.2f, 3f), new ConfigurationManagerAttributes { Order = order + 6 })); if (rotation) { - t.RotationX = config.Bind(section, body + " Rotation X", d.RotX, - new ConfigDescription($"{body} characters: tips both eyes down (+) or up (-), in degrees.", + t.RotationX = config.Bind(section, prefix + "Rotation X", d.RotX, + new ConfigDescription($"{who}: tips the eye down (+) or up (-), in degrees.", new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 5 })); - t.RotationY = config.Bind(section, body + " Rotation Y", d.RotY, - new ConfigDescription($"{body} characters: turns the eyes toward the temples (+) or the nose (-), in degrees. Mirrored between the two eyes.", + t.RotationY = config.Bind(section, prefix + "Rotation Y", d.RotY, + new ConfigDescription($"{who}: turns the eye toward the temple (+) or the nose (-), in degrees.", new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 4 })); - t.RotationZ = config.Bind(section, body + " Rotation Z", d.RotZ, - new ConfigDescription($"{body} characters: raises (+) or lowers (-) the outer corners, in degrees. Mirrored between the two eyes.", + t.RotationZ = config.Bind(section, prefix + "Rotation Z", d.RotZ, + new ConfigDescription($"{who}: raises (+) or lowers (-) the outer corner, in degrees.", new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 3 })); } diff --git a/JotunnModStub/Sverm/SvermVisuals.cs b/JotunnModStub/Sverm/SvermVisuals.cs index 9cb6c82..350a153 100644 --- a/JotunnModStub/Sverm/SvermVisuals.cs +++ b/JotunnModStub/Sverm/SvermVisuals.cs @@ -256,30 +256,31 @@ namespace RacesOfValheim float eyeSize = EyeSize; PlayerFace.AdjustEyes(player, ref height, ref separation, ref eyeSize); - float forward = EyeForward; - EyePositionConfig.Tuning tuning = EyePositionConfig.For(SvermConfig.RaceId, player); - if (tuning != null) - { - forward += tuning.Forward.Value; - height += tuning.Height.Value; - separation += tuning.Separation.Value; - eyeSize *= tuning.Size.Value; - } - - Vector3 baseLocal = frame.LocalForward * (forward * scale * toLocal) - + frame.LocalUp * (height * scale * toLocal); - - float eyeLocalSize = eyeSize * scale * toLocal; - for (int i = 0; i < holder.childCount; i++) { Transform eye = holder.GetChild(i); // Index 0 is offset against the right axis, so it is the model's left eye. float side = i == 0 ? -1f : 1f; - float size = i == 0 ? eyeLocalSize * LeftEyeSizeMultiplier : eyeLocalSize; - eye.localPosition = baseLocal + frame.LocalRight * (side * separation * scale * toLocal); + // This eye's sliders from "Eyes Position - Sverm". + float forward = EyeForward; + float eyeHeight = height; + float eyeSeparation = separation; + float size = eyeSize * scale * toLocal; + EyePositionConfig.Tuning tuning = EyePositionConfig.For(SvermConfig.RaceId, player, side); + if (tuning != null) + { + forward += tuning.Forward.Value; + eyeHeight += tuning.Height.Value; + eyeSeparation += tuning.Separation.Value; + size *= tuning.Size.Value; + } + if (i == 0) size *= LeftEyeSizeMultiplier; + + eye.localPosition = frame.LocalForward * (forward * scale * toLocal) + + frame.LocalUp * (eyeHeight * scale * toLocal) + + frame.LocalRight * (side * eyeSeparation * scale * toLocal); eye.localScale = Vector3.one * size; } } From a214a604e1ce26fe6adb9a3c00deb8a711fb1759 Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 27 Oct 2026 16:16:46 +0100 Subject: [PATCH 07/13] feat(eyes): Aswid and Alfar female per-eye defaults from playtest --- JotunnModStub/EyePositionConfig.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/JotunnModStub/EyePositionConfig.cs b/JotunnModStub/EyePositionConfig.cs index 26c9e2f..c238c7e 100644 --- a/JotunnModStub/EyePositionConfig.cs +++ b/JotunnModStub/EyePositionConfig.cs @@ -44,14 +44,15 @@ namespace RacesOfValheim { // Female defaults dialled in on screen (playtest, 2026-10-27). The male ones are // still the code's own placement; the Sverm's helmet hides its eyes, so it keeps it. - Defaults alfar = new Defaults { Separation = 0.006f, RotX = -17.524f }; - BindRace(config, AlfarConfig.RaceId, true, alfar, alfar); + BindRace(config, AlfarConfig.RaceId, true, + new Defaults { Separation = 0.006f, RotX = -17.524f }, + new Defaults { Separation = 0.015f, RotX = -17.524f }); BindRace(config, "Aswid", true, - new Defaults { Forward = -0.002f, Height = -0.001f, Separation = 0.003f, Size = 1.142f, - RotX = 1.298f, RotY = 0.649f }, - new Defaults { Forward = -0.001f, Height = -0.001f, Separation = 0.009f, Size = 1.142f, - RotX = 1.298f, RotY = 0.649f, RotZ = -7.788f }); + new Defaults { Forward = -0.006f, Height = -0.010f, Separation = 0f, Size = 1.314f, + RotX = -14.279f, RotY = -5.841f, RotZ = -1.298f }, + new Defaults { Forward = -0.006f, Height = -0.012f, Separation = 0.011f, Size = 1.324f, + RotX = 1.947f, RotY = 3.245f, RotZ = 4.544f }); Defaults dvergar = new Defaults { Forward = -0.011f, Separation = 0.005f, Size = 1.616f }; BindRace(config, DvergarConfig.RaceId, false, dvergar, dvergar); From 06b7fc165c9e760f91afcd17d6b450bc7a4a3fd2 Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 27 Oct 2026 16:17:03 +0100 Subject: [PATCH 08/13] feat(eyes): Dvergar female right-eye defaults from playtest --- JotunnModStub/EyePositionConfig.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/JotunnModStub/EyePositionConfig.cs b/JotunnModStub/EyePositionConfig.cs index c238c7e..ae8d4b8 100644 --- a/JotunnModStub/EyePositionConfig.cs +++ b/JotunnModStub/EyePositionConfig.cs @@ -54,8 +54,9 @@ namespace RacesOfValheim new Defaults { Forward = -0.006f, Height = -0.012f, Separation = 0.011f, Size = 1.324f, RotX = 1.947f, RotY = 3.245f, RotZ = 4.544f }); - Defaults dvergar = new Defaults { Forward = -0.011f, Separation = 0.005f, Size = 1.616f }; - BindRace(config, DvergarConfig.RaceId, false, dvergar, dvergar); + BindRace(config, DvergarConfig.RaceId, false, + new Defaults { Forward = -0.011f, Separation = 0.005f, Size = 1.616f }, + new Defaults { Forward = -0.015f, Separation = 0.013f, Size = 1.616f }); BindRace(config, SvermConfig.RaceId, false, new Defaults(), new Defaults()); } From f7a4494b3977f163b2f5131fb13393c2aa545c3c Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 27 Oct 2026 17:44:49 +0100 Subject: [PATCH 09/13] feat(eyes): male per-eye defaults from playtest Male Aswid, Alfar and Dvergar eye values dialled in on screen become the defaults of their Eyes Position sections, so male faces no longer start from the untuned code placement. --- JotunnModStub/EyePositionConfig.cs | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/JotunnModStub/EyePositionConfig.cs b/JotunnModStub/EyePositionConfig.cs index ae8d4b8..e08c257 100644 --- a/JotunnModStub/EyePositionConfig.cs +++ b/JotunnModStub/EyePositionConfig.cs @@ -42,23 +42,32 @@ namespace RacesOfValheim public static void Bind(ConfigFile config) { - // Female defaults dialled in on screen (playtest, 2026-10-27). The male ones are - // still the code's own placement; the Sverm's helmet hides its eyes, so it keeps it. + // Defaults dialled in on screen (playtest, 2026-10-27), per eye: female left, female + // right, male left, male right. The Sverm's helmet hides its eyes, so it keeps the + // code's own placement. BindRace(config, AlfarConfig.RaceId, true, new Defaults { Separation = 0.006f, RotX = -17.524f }, - new Defaults { Separation = 0.015f, RotX = -17.524f }); + new Defaults { Separation = 0.015f, RotX = -17.524f }, + new Defaults(), + new Defaults { Separation = 0.009f }); BindRace(config, "Aswid", true, new Defaults { Forward = -0.006f, Height = -0.010f, Separation = 0f, Size = 1.314f, RotX = -14.279f, RotY = -5.841f, RotZ = -1.298f }, new Defaults { Forward = -0.006f, Height = -0.012f, Separation = 0.011f, Size = 1.324f, - RotX = 1.947f, RotY = 3.245f, RotZ = 4.544f }); + RotX = 1.947f, RotY = 3.245f, RotZ = 4.544f }, + new Defaults { Height = -0.005f, Separation = -0.005f, Size = 1.273f, + RotX = 6.49f, RotY = 4.544f, RotZ = 4.544f }, + new Defaults { Forward = -0.002f, Height = -0.005f, Separation = 0.004f, Size = 1.444f, + RotZ = 6.49f }); BindRace(config, DvergarConfig.RaceId, false, new Defaults { Forward = -0.011f, Separation = 0.005f, Size = 1.616f }, - new Defaults { Forward = -0.015f, Separation = 0.013f, Size = 1.616f }); + new Defaults { Forward = -0.015f, Separation = 0.013f, Size = 1.616f }, + new Defaults { Forward = -0.003f, Size = 1.05f }, + new Defaults { Forward = -0.004f, Separation = 0.005f }); - BindRace(config, SvermConfig.RaceId, false, new Defaults(), new Defaults()); + BindRace(config, SvermConfig.RaceId, false, new Defaults(), new Defaults(), new Defaults(), new Defaults()); } /// Starting values for one eye's sliders. @@ -79,15 +88,16 @@ namespace RacesOfValheim return set[(PlayerFace.IsFemale(player) ? 2 : 0) + (side < 0f ? 0 : 1)]; } - private static void BindRace(ConfigFile config, string race, bool rotation, Defaults femaleLeft, Defaults femaleRight) + private static void BindRace(ConfigFile config, string race, bool rotation, + Defaults femaleLeft, Defaults femaleRight, Defaults maleLeft, Defaults maleRight) { string section = SectionPrefix + race; // Female first in the list, left before right: Order sorts high to low. tunings[race] = new[] { - BindEye(config, section, "Male", "Left", rotation, 200, new Defaults()), - BindEye(config, section, "Male", "Right", rotation, 100, new Defaults()), + BindEye(config, section, "Male", "Left", rotation, 200, maleLeft), + BindEye(config, section, "Male", "Right", rotation, 100, maleRight), BindEye(config, section, "Female", "Left", rotation, 400, femaleLeft), BindEye(config, section, "Female", "Right", rotation, 300, femaleRight), }; From 5b3b2ac88d29d152c16f75db4b915cd09b15e9f1 Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 27 Oct 2026 17:46:36 +0100 Subject: [PATCH 10/13] 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. --- JotunnModStub/Alfar/AlfarVisuals.cs | 12 +- JotunnModStub/Aswid/AswidVisuals.cs | 14 +-- JotunnModStub/ConfigSync.cs | 1 - JotunnModStub/Dvergar/DvergarVisuals.cs | 12 +- JotunnModStub/EyePositionConfig.cs | 141 ------------------------ JotunnModStub/RaceEyeTuning.cs | 64 +++++++++++ JotunnModStub/RacesOfValheim.cs | 2 - JotunnModStub/Sverm/SvermVisuals.cs | 12 +- 8 files changed, 89 insertions(+), 169 deletions(-) delete mode 100644 JotunnModStub/EyePositionConfig.cs create mode 100644 JotunnModStub/RaceEyeTuning.cs diff --git a/JotunnModStub/Alfar/AlfarVisuals.cs b/JotunnModStub/Alfar/AlfarVisuals.cs index 70b3f68..aa6df6e 100644 --- a/JotunnModStub/Alfar/AlfarVisuals.cs +++ b/JotunnModStub/Alfar/AlfarVisuals.cs @@ -196,7 +196,7 @@ namespace RacesOfValheim // slant and the wrap are mirrored so both outer corners go up and back. float side = i == 0 ? -1f : 1f; - // This eye's sliders from "Eyes Position - Alfar". + // This eye's hand corrections (RaceEyeTuning). float forward = AlfarConfig.EyeForward; float eyeHeight = height; float eyeSeparation = separation; @@ -204,13 +204,13 @@ namespace RacesOfValheim float wrap = AlfarConfig.EyeWrap; float slant = AlfarConfig.EyeSlant; float tilt = 0f; - EyePositionConfig.Tuning tuning = EyePositionConfig.For(AlfarConfig.RaceId, player, side); + RaceEyeTuning.Eye tuning = RaceEyeTuning.For(AlfarConfig.RaceId, player, side); if (tuning != null) { - forward += tuning.Forward.Value; - eyeHeight += tuning.Height.Value; - eyeSeparation += tuning.Separation.Value; - eyeSize *= tuning.Size.Value; + forward += tuning.Forward; + eyeHeight += tuning.Height; + eyeSeparation += tuning.Separation; + eyeSize *= tuning.Size; tilt = tuning.RotX; wrap += tuning.RotY; slant += tuning.RotZ; diff --git a/JotunnModStub/Aswid/AswidVisuals.cs b/JotunnModStub/Aswid/AswidVisuals.cs index 8d0aeef..c0822ad 100644 --- a/JotunnModStub/Aswid/AswidVisuals.cs +++ b/JotunnModStub/Aswid/AswidVisuals.cs @@ -332,12 +332,12 @@ namespace RacesOfValheim float side = Mathf.Sign(Vector3.Dot(authored.Position, frame.LocalRight)); if (side == 0f) side = i == 0 ? -1f : 1f; - // This eye's sliders from "Eyes Position - Aswid", on top of the race's own offsets. - EyePositionConfig.Tuning tuning = EyePositionConfig.For("Aswid", player, side); - float forward = AswidConfig.EyeForwardOffset.Value + (tuning != null ? tuning.Forward.Value : 0f); - float height = AswidConfig.EyeHeightOffset.Value + (tuning != null ? tuning.Height.Value : 0f); - float separation = AswidConfig.EyeSeparationOffset.Value + (tuning != null ? tuning.Separation.Value : 0f); - float size = AswidConfig.EyeSizeMultiplier.Value * (tuning != null ? tuning.Size.Value : 1f); + // This eye's hand corrections (RaceEyeTuning), on top of the race's own offsets. + RaceEyeTuning.Eye tuning = RaceEyeTuning.For("Aswid", player, side); + float forward = AswidConfig.EyeForwardOffset.Value + (tuning != null ? tuning.Forward : 0f); + float height = AswidConfig.EyeHeightOffset.Value + (tuning != null ? tuning.Height : 0f); + float separation = AswidConfig.EyeSeparationOffset.Value + (tuning != null ? tuning.Separation : 0f); + float size = AswidConfig.EyeSizeMultiplier.Value * (tuning != null ? tuning.Size : 1f); Vector3 shift = frame.LocalForward * (forward * scale) + frame.LocalUp * (height * scale); @@ -359,7 +359,7 @@ namespace RacesOfValheim AswidConfig.EyeRotationY.Value * side, AswidConfig.EyeRotationZ.Value); - // The Eyes Position sliders turn the eye on the FACE's axes instead: conjugated by + // The RaceEyeTuning corrections turn the eye on the FACE's axes instead: conjugated by // the face frame, X tips it, Y turns it toward the temple and Z raises the outer // corner, the same on both eyes. Added to the bone-axis twist above, X rolled the // eyes and a mirrored Z tipped one up and the other down. diff --git a/JotunnModStub/ConfigSync.cs b/JotunnModStub/ConfigSync.cs index 0f9ac48..abbad38 100644 --- a/JotunnModStub/ConfigSync.cs +++ b/JotunnModStub/ConfigSync.cs @@ -87,7 +87,6 @@ namespace RacesOfValheim if (section.EndsWith("Keybinds", StringComparison.OrdinalIgnoreCase)) return false; if (LocalSections.Contains(section, StringComparer.OrdinalIgnoreCase)) return false; - if (section.StartsWith(EyePositionConfig.SectionPrefix, StringComparison.OrdinalIgnoreCase)) return false; if (LocalKeyParts.Any(key.Contains)) return false; // Model pose nudges (rotation/offset/yaw) are cosmetic, but "Attack Reach Offset" is a diff --git a/JotunnModStub/Dvergar/DvergarVisuals.cs b/JotunnModStub/Dvergar/DvergarVisuals.cs index b156fe2..c654a3a 100644 --- a/JotunnModStub/Dvergar/DvergarVisuals.cs +++ b/JotunnModStub/Dvergar/DvergarVisuals.cs @@ -293,18 +293,18 @@ namespace RacesOfValheim // radius. float side = i == 0 ? -1f : 1f; - // This eye's sliders from "Eyes Position - Dvergar". + // This eye's hand corrections (RaceEyeTuning). float forward = DvergarConfig.EyeForward; float eyeHeight = height; float eyeSeparation = separation; float size = eyeSize * raceScale * toLocal; - EyePositionConfig.Tuning tuning = EyePositionConfig.For(DvergarConfig.RaceId, player, side); + RaceEyeTuning.Eye tuning = RaceEyeTuning.For(DvergarConfig.RaceId, player, side); if (tuning != null) { - forward += tuning.Forward.Value; - eyeHeight += tuning.Height.Value; - eyeSeparation += tuning.Separation.Value; - size *= tuning.Size.Value; + forward += tuning.Forward; + eyeHeight += tuning.Height; + eyeSeparation += tuning.Separation; + size *= tuning.Size; } if (i == 0) size *= DvergarConfig.LeftEyeSizeMultiplier; diff --git a/JotunnModStub/EyePositionConfig.cs b/JotunnModStub/EyePositionConfig.cs deleted file mode 100644 index e08c257..0000000 --- a/JotunnModStub/EyePositionConfig.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System.Collections.Generic; -using BepInEx.Configuration; - -namespace RacesOfValheim -{ - /// - /// Hand placement for every race that hangs eyes on the face: one "Eyes Position - race" - /// section each, with a set of sliders 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: all zeros (and size - /// 1) is the code's own placement, and the female defaults below are the corrections found in - /// game on top of it. - /// - /// Local, never synced (ConfigSync): it only changes how this client draws faces. - /// - public static class EyePositionConfig - { - public const string SectionPrefix = "Eyes Position - "; - - /// One eye's sliders, for one body of one race. - public sealed class Tuning - { - public ConfigEntry Forward; - public ConfigEntry Height; - public ConfigEntry Separation; - public ConfigEntry Size; - - // Only bound for races whose eyes are not spheres; null elsewhere. - public ConfigEntry RotationX; - public ConfigEntry RotationY; - public ConfigEntry RotationZ; - - public float RotX => RotationX != null ? RotationX.Value : 0f; - public float RotY => RotationY != null ? RotationY.Value : 0f; - public float RotZ => RotationZ != null ? RotationZ.Value : 0f; - } - - // [race] -> { male left, male right, female left, female right } - private static readonly Dictionary tunings = new Dictionary(); - - public static void Bind(ConfigFile config) - { - // Defaults dialled in on screen (playtest, 2026-10-27), per eye: female left, female - // right, male left, male right. The Sverm's helmet hides its eyes, so it keeps the - // code's own placement. - BindRace(config, AlfarConfig.RaceId, true, - new Defaults { Separation = 0.006f, RotX = -17.524f }, - new Defaults { Separation = 0.015f, RotX = -17.524f }, - new Defaults(), - new Defaults { Separation = 0.009f }); - - BindRace(config, "Aswid", true, - new Defaults { Forward = -0.006f, Height = -0.010f, Separation = 0f, Size = 1.314f, - RotX = -14.279f, RotY = -5.841f, RotZ = -1.298f }, - new Defaults { Forward = -0.006f, Height = -0.012f, Separation = 0.011f, Size = 1.324f, - RotX = 1.947f, RotY = 3.245f, RotZ = 4.544f }, - new Defaults { Height = -0.005f, Separation = -0.005f, Size = 1.273f, - RotX = 6.49f, RotY = 4.544f, RotZ = 4.544f }, - new Defaults { Forward = -0.002f, Height = -0.005f, Separation = 0.004f, Size = 1.444f, - RotZ = 6.49f }); - - BindRace(config, DvergarConfig.RaceId, false, - new Defaults { Forward = -0.011f, Separation = 0.005f, Size = 1.616f }, - new Defaults { Forward = -0.015f, Separation = 0.013f, Size = 1.616f }, - new Defaults { Forward = -0.003f, Size = 1.05f }, - new Defaults { Forward = -0.004f, Separation = 0.005f }); - - BindRace(config, SvermConfig.RaceId, false, new Defaults(), new Defaults(), new Defaults(), new Defaults()); - } - - /// Starting values for one eye's sliders. - private sealed class Defaults - { - public float Forward, Height, Separation, RotX, RotY, RotZ; - public float Size = 1f; - } - - /// - /// The sliders 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. - /// - public static Tuning For(string race, Player player, float side) - { - if (!tunings.TryGetValue(race, out Tuning[] set)) return null; - return set[(PlayerFace.IsFemale(player) ? 2 : 0) + (side < 0f ? 0 : 1)]; - } - - private static void BindRace(ConfigFile config, string race, bool rotation, - Defaults femaleLeft, Defaults femaleRight, Defaults maleLeft, Defaults maleRight) - { - string section = SectionPrefix + race; - - // Female first in the list, left before right: Order sorts high to low. - tunings[race] = new[] - { - BindEye(config, section, "Male", "Left", rotation, 200, maleLeft), - BindEye(config, section, "Male", "Right", rotation, 100, maleRight), - BindEye(config, section, "Female", "Left", rotation, 400, femaleLeft), - BindEye(config, section, "Female", "Right", rotation, 300, femaleRight), - }; - } - - private static Tuning BindEye(ConfigFile config, string section, string body, string eye, bool rotation, int order, Defaults d) - { - string prefix = $"{body} {eye} Eye "; - string who = $"{body} characters, {eye.ToLowerInvariant()} eye (the character's own {eye.ToLowerInvariant()})"; - Tuning t = new Tuning(); - - t.Forward = config.Bind(section, prefix + "Forward", d.Forward, - new ConfigDescription($"{who}: moves the eye out of (+) or into (-) the face, in metres.", - new AcceptableValueRange(-0.05f, 0.05f), new ConfigurationManagerAttributes { Order = order + 9 })); - t.Height = config.Bind(section, prefix + "Height", d.Height, - new ConfigDescription($"{who}: moves the eye up (+) or down (-), in metres.", - new AcceptableValueRange(-0.05f, 0.05f), new ConfigurationManagerAttributes { Order = order + 8 })); - t.Separation = config.Bind(section, prefix + "Separation", d.Separation, - new ConfigDescription($"{who}: moves the eye away from (+) or toward (-) the nose, in metres.", - new AcceptableValueRange(-0.03f, 0.03f), new ConfigurationManagerAttributes { Order = order + 7 })); - t.Size = config.Bind(section, prefix + "Size", d.Size, - new ConfigDescription($"{who}: scales the eye. 1 is the default size.", - new AcceptableValueRange(0.2f, 3f), new ConfigurationManagerAttributes { Order = order + 6 })); - - if (rotation) - { - t.RotationX = config.Bind(section, prefix + "Rotation X", d.RotX, - new ConfigDescription($"{who}: tips the eye down (+) or up (-), in degrees.", - new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 5 })); - t.RotationY = config.Bind(section, prefix + "Rotation Y", d.RotY, - new ConfigDescription($"{who}: turns the eye toward the temple (+) or the nose (-), in degrees.", - new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 4 })); - t.RotationZ = config.Bind(section, prefix + "Rotation Z", d.RotZ, - new ConfigDescription($"{who}: raises (+) or lowers (-) the outer corner, in degrees.", - new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 3 })); - } - - return t; - } - } -} diff --git a/JotunnModStub/RaceEyeTuning.cs b/JotunnModStub/RaceEyeTuning.cs new file mode 100644 index 0000000..ea55567 --- /dev/null +++ b/JotunnModStub/RaceEyeTuning.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; + +namespace RacesOfValheim +{ + /// + /// 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. + /// + public static class RaceEyeTuning + { + /// One eye's corrections. Metres for the offsets, degrees for the rotations. + 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 tunings = new Dictionary + { + [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. + }; + + /// + /// 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. + /// + 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)]; + } + } +} diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs index 5eb3b9b..f075a97 100644 --- a/JotunnModStub/RacesOfValheim.cs +++ b/JotunnModStub/RacesOfValheim.cs @@ -56,8 +56,6 @@ namespace RacesOfValheim // Not a race either: the faction truce and the faction merchants, which cut across // every race at once, so they bind last rather than inside the alphabetical run above. FactionsConfig.Bind(Config); - // Not a race either: the hand placement of every race's eyes, one section per race. - EyePositionConfig.Bind(Config); // After every Bind above: tags the gameplay entries for Jotunn's server-to-client sync. ConfigSync.Apply(Config); harmony.PatchAll(); diff --git a/JotunnModStub/Sverm/SvermVisuals.cs b/JotunnModStub/Sverm/SvermVisuals.cs index 350a153..dd18e5d 100644 --- a/JotunnModStub/Sverm/SvermVisuals.cs +++ b/JotunnModStub/Sverm/SvermVisuals.cs @@ -263,18 +263,18 @@ namespace RacesOfValheim // Index 0 is offset against the right axis, so it is the model's left eye. float side = i == 0 ? -1f : 1f; - // This eye's sliders from "Eyes Position - Sverm". + // This eye's hand corrections (RaceEyeTuning). float forward = EyeForward; float eyeHeight = height; float eyeSeparation = separation; float size = eyeSize * scale * toLocal; - EyePositionConfig.Tuning tuning = EyePositionConfig.For(SvermConfig.RaceId, player, side); + RaceEyeTuning.Eye tuning = RaceEyeTuning.For(SvermConfig.RaceId, player, side); if (tuning != null) { - forward += tuning.Forward.Value; - eyeHeight += tuning.Height.Value; - eyeSeparation += tuning.Separation.Value; - size *= tuning.Size.Value; + forward += tuning.Forward; + eyeHeight += tuning.Height; + eyeSeparation += tuning.Separation; + size *= tuning.Size; } if (i == 0) size *= LeftEyeSizeMultiplier; From b9ec452e72fcfa38d8eadc52fa4e9c3ccec3e7f2 Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 27 Oct 2026 19:25:03 +0100 Subject: [PATCH 11/13] fix: Draugh eats Bjorn and Volture meat, Alfar levitation on gamepad Draugh: add BjornMeat -> CookedBjornMeat to the raw-to-cooked table and correct VoltureMeat's cooked name (RoastedVoltureMeat does not exist, CookedVoltureMeat does), so neither raw meat got an EdibleUncooked_ item. Names checked against the SoftRef manifests. Alfar: ZInput "Jump" is the keyboard binding only. Read "JoyJump" and "JoyCrouch" too, as PlayerController does, for levitation and the Archon's climb and descent. Reported by lexsonn. --- JotunnModStub/Alfar/AlfarLevitation.cs | 14 ++++++++++---- JotunnModStub/Draugh/DraughFoodPatches.cs | 4 +++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/JotunnModStub/Alfar/AlfarLevitation.cs b/JotunnModStub/Alfar/AlfarLevitation.cs index 77f6b9d..206c8c7 100644 --- a/JotunnModStub/Alfar/AlfarLevitation.cs +++ b/JotunnModStub/Alfar/AlfarLevitation.cs @@ -48,7 +48,7 @@ namespace RacesOfValheim float target = 0f; if (Time.time - AlfarArchon.StartedAt < 0.6f) target = 4f; // lift off else if (RaceInput.Allowed && JumpHeld()) target = speed; - else if (RaceInput.Allowed && ZInput.GetButton("Crouch")) target = -speed; + else if (RaceInput.Allowed && CrouchHeld()) target = -speed; Vector3 velocity = flyer.linearVelocity; velocity.y = Mathf.Lerp(velocity.y, target, 0.25f); @@ -97,9 +97,15 @@ namespace RacesOfValheim private static bool JumpHeld() { - // ZInput's "Jump" covers the space bar and the pad's jump button alike, and respects the - // controls the player picked in the settings. - return ZInput.GetButton("Jump"); + // "Jump" is the keyboard binding only; the pad's button is a separate "JoyJump", read + // the way PlayerController reads it, kept off while a radial menu has the pad. + return ZInput.GetButton("Jump") || (ZInput.GetButton("JoyJump") && !Hud.InRadial()); + } + + private static bool CrouchHeld() + { + // Same split as jump: PlayerController ORs "Crouch" with "JoyCrouch". + return ZInput.GetButton("Crouch") || (ZInput.GetButton("JoyCrouch") && !Hud.InRadial()); } private static void FlushSpend(Player player) diff --git a/JotunnModStub/Draugh/DraughFoodPatches.cs b/JotunnModStub/Draugh/DraughFoodPatches.cs index ea56d5c..fe57c31 100644 --- a/JotunnModStub/Draugh/DraughFoodPatches.cs +++ b/JotunnModStub/Draugh/DraughFoodPatches.cs @@ -24,11 +24,13 @@ namespace RacesOfValheim { "HareMeat", "CookedHareMeat" }, { "ChickenMeat", "CookedChickenMeat" }, { "BugMeat", "CookedBugMeat" }, - { "VoltureMeat", "RoastedVoltureMeat" }, + { "VoltureMeat", "CookedVoltureMeat" }, { "GreydwarfEye", "DeerStew" }, { "Entrails", "Sausages" }, { "Bloodbag", "BloodPudding" }, { "MooseMeat", "CookedMooseMeat" }, + // Bjorn, the Valheim 1.0 bear. + { "BjornMeat", "CookedBjornMeat" }, // Raw blubber keeps its own name and icon (EdibleUncooked_ copies them from the raw // item) and gives the stats of Seal Meat Soup. { "SealBlubber", "SealSoup" } From db9aac2bf67a4dc24dce034c418be3ec17414497 Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 27 Oct 2026 19:33:17 +0100 Subject: [PATCH 12/13] fix: Draugh Ashlands meats, rebindable flight keys, Geisli on gamepad Draugh: add AsksvinMeat and BoneMawSerpentMeat to the shared raw-to-cooked table; the Aswid blood refinery no longer adds them on its own copy. DirectedFlight (drake, bat): read ZInput Forward/Backward/Run instead of raw W, S and Shift, so keys rebound in the settings work. Geisli: the pad has no free button in vanilla's Classic layout, so the beam is held on the pad's secondary attack, bare-handed or in the Archon form, as Skadi's Cold Spell does. The unarmed kick is swallowed while it fires. RaceInput.EmptyHanded is shared with Skadi. Compendium text mentions the pad in English, Italian and Russian. --- JotunnModStub/Alfar/AlfarPowers.cs | 30 ++++++++++++++++++- JotunnModStub/Aswid/AswidBloodRefinery.cs | 2 -- JotunnModStub/DirectedFlight.cs | 9 +++--- JotunnModStub/Draugh/DraughFoodPatches.cs | 3 ++ JotunnModStub/RaceInput.cs | 15 +++++++++- JotunnModStub/Skadi/SkadiRace.cs | 8 +---- .../Translations/English/compendium.json | 2 +- .../Translations/Italian/compendium.json | 2 +- .../Translations/Russian/compendium.json | 2 +- 9 files changed, 55 insertions(+), 18 deletions(-) diff --git a/JotunnModStub/Alfar/AlfarPowers.cs b/JotunnModStub/Alfar/AlfarPowers.cs index dc7c52b..82aca06 100644 --- a/JotunnModStub/Alfar/AlfarPowers.cs +++ b/JotunnModStub/Alfar/AlfarPowers.cs @@ -305,6 +305,34 @@ namespace RacesOfValheim // ─── Geisli: the beam ──────────────────────────────────────────────── + /// + /// The pad's way to hold the beam. Every pad button is taken in vanilla's Classic layout, so, + /// like Skadi's Cold Spell, the beam borrows the secondary attack: bare-handed, or in the + /// archon form, which has no weapons anyway. The radial entry only gives a single press, + /// which cannot hold a beam. + /// + private static bool PadBeamHeld(Player player) => + !RaceInput.RadialOpen && RaceInput.PadAttackHeld(2) && + (AlfarArchon.Active || RaceInput.EmptyHanded(player)); + + /// + /// Swallows the unarmed secondary (the kick) while the pad's secondary attack is the beam, + /// the same way SkadiAttackPatch does for the Cold Spell. + /// + [HarmonyPatch(typeof(Humanoid), "StartAttack")] + public static class Alfar_GeisliPadKick_Patch + { + public static bool Prefix(Humanoid __instance, bool secondaryAttack, ref bool __result) + { + if (!secondaryAttack || __instance != Player.m_localPlayer) return true; + Player player = (Player)__instance; + if (!AlfarVisuals.IsAlfarPlayer(player) || !Unlocked(AlfarPowerConfig.GeisliState)) return true; + if (!PadBeamHeld(player)) return true; + __result = false; + return false; + } + } + private static LineRenderer beamLine; private static readonly List beamArcs = new List(); private static GameObject beamFx; @@ -324,7 +352,7 @@ namespace RacesOfValheim private static void TickBeam(Player player) { bool wanted = RaceInput.Allowed && !player.IsDead() && Unlocked(AlfarPowerConfig.GeisliState) && - AlfarPowerConfig.GeisliKey.Value.IsPressedIgnoringHeldKeys(); + (AlfarPowerConfig.GeisliKey.Value.IsPressedIgnoringHeldKeys() || PadBeamHeld(player)); if (!wanted) { diff --git a/JotunnModStub/Aswid/AswidBloodRefinery.cs b/JotunnModStub/Aswid/AswidBloodRefinery.cs index c119d53..a127b5a 100644 --- a/JotunnModStub/Aswid/AswidBloodRefinery.cs +++ b/JotunnModStub/Aswid/AswidBloodRefinery.cs @@ -338,8 +338,6 @@ namespace RacesOfValheim // The raw -> cooked table the Draugh already maintains is the source of truth. meatToCooked = new Dictionary(DraughFoodPatches.rawToCookedMapping); meatToCooked.Remove("GreydwarfEye"); // stew ingredient, not flesh - meatToCooked["AsksvinMeat"] = "CookedAsksvinMeat"; - meatToCooked["BoneMawSerpentMeat"] = "CookedBoneMawSerpentMeat"; foreach (string stationName in CookingStationPrefabs) { diff --git a/JotunnModStub/DirectedFlight.cs b/JotunnModStub/DirectedFlight.cs index 49d2b5d..f68a094 100644 --- a/JotunnModStub/DirectedFlight.cs +++ b/JotunnModStub/DirectedFlight.cs @@ -112,12 +112,13 @@ namespace RacesOfValheim // Flight only knows powered forward, reverse or neither, so the stick is a // threshold, not a throttle. Steering stays on the camera, i.e. the right stick. float stick = -JoyLeftStickY(); - bool forward = input && (Input.GetKey(KeyCode.W) || stick > StickThreshold); + // The keyboard side reads vanilla's own Forward/Backward/Run actions, so a key the + // player rebound in the settings flies too, not just W, S and Shift. + bool forward = input && (ZInput.GetButton("Forward") || stick > StickThreshold); // Forward wins a W+S mash rather than the two cancelling into a dead hover. - bool backward = input && !forward && (Input.GetKey(KeyCode.S) || stick < -StickThreshold); + bool backward = input && !forward && (ZInput.GetButton("Backward") || stick < -StickThreshold); // Sprint on a pad is vanilla's run button, wherever the chosen layout puts it. - bool sprintKey = input && (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift) || - ZInput.GetButton("JoyRun")); + bool sprintKey = input && (ZInput.GetButton("Run") || ZInput.GetButton("JoyRun")); bool onGround = __instance.IsOnGround(); // IsSwimming is the exact test UpdateMotion uses to hand the frame to UpdateSwimming // instead of UpdateFlying, so it is also the one condition DirectedFlightWaterPatch has diff --git a/JotunnModStub/Draugh/DraughFoodPatches.cs b/JotunnModStub/Draugh/DraughFoodPatches.cs index fe57c31..a527830 100644 --- a/JotunnModStub/Draugh/DraughFoodPatches.cs +++ b/JotunnModStub/Draugh/DraughFoodPatches.cs @@ -31,6 +31,9 @@ namespace RacesOfValheim { "MooseMeat", "CookedMooseMeat" }, // Bjorn, the Valheim 1.0 bear. { "BjornMeat", "CookedBjornMeat" }, + // Ashlands. + { "AsksvinMeat", "CookedAsksvinMeat" }, + { "BoneMawSerpentMeat", "CookedBoneMawSerpentMeat" }, // Raw blubber keeps its own name and icon (EdibleUncooked_ copies them from the raw // item) and gives the stats of Seal Meat Soup. { "SealBlubber", "SealSoup" } diff --git a/JotunnModStub/RaceInput.cs b/JotunnModStub/RaceInput.cs index c045f2c..16f5d09 100644 --- a/JotunnModStub/RaceInput.cs +++ b/JotunnModStub/RaceInput.cs @@ -167,6 +167,19 @@ namespace RacesOfValheim return Input.GetMouseButtonDown(mouseButton) || PadAttackDown(mouseButton); } + /// + /// Nothing in either hand and not building. The pad has no spare button, so a race power + /// that needs one borrows the secondary attack under this condition only: with a weapon or + /// a tool in hand that button stays the item's, as in vanilla. + /// + public static bool EmptyHanded(Player player) + { + if (player == null || player.InPlaceMode()) return false; + var hands = Traverse.Create(player); + return hands.Field("m_rightItem").Value == null && + hands.Field("m_leftItem").Value == null; + } + /// Held-down counterpart of . public static bool AttackHeld(int mouseButton) { @@ -202,7 +215,7 @@ namespace RacesOfValheim private static bool loggedOpen; private static bool loggedClosed; - private static bool RadialOpen + internal static bool RadialOpen { get { diff --git a/JotunnModStub/Skadi/SkadiRace.cs b/JotunnModStub/Skadi/SkadiRace.cs index 27ea13e..8a5ff45 100644 --- a/JotunnModStub/Skadi/SkadiRace.cs +++ b/JotunnModStub/Skadi/SkadiRace.cs @@ -465,13 +465,7 @@ namespace RacesOfValheim /// mode and with nothing in either hand. Shared with SkadiAttackPatch, which swallows the /// unarmed kick under exactly the same condition. /// - public static bool PadCastsColdSpell(Player player) - { - if (player == null || player.InPlaceMode()) return false; - var hands = HarmonyLib.Traverse.Create(player); - return hands.Field("m_rightItem").Value == null && - hands.Field("m_leftItem").Value == null; - } + public static bool PadCastsColdSpell(Player player) => RaceInput.EmptyHanded(player); private IEnumerator ColdSpellKickCoroutine(SkadiProgression.FormRules rules) { diff --git a/JotunnModStub/Translations/English/compendium.json b/JotunnModStub/Translations/English/compendium.json index 98ffd70..657b743 100644 --- a/JotunnModStub/Translations/English/compendium.json +++ b/JotunnModStub/Translations/English/compendium.json @@ -12,7 +12,7 @@ "rov_compendium_alfar_utsog": "[Elder Unlock] Utsog: $1% of the damage you deal comes back to you as eitr.\n", "rov_compendium_alfar_kall": "[Bonemass Unlock] Kall ('$1' Key): Pulls every dropped item within $2 meters to you. Waits $3 seconds.\n", "rov_compendium_alfar_ljosstorm": "[Moder Unlock] Ljosstorm ('$1' Key): A psionic storm over a $2 meter area for $3 seconds. Waits $4 seconds.\n", - "rov_compendium_alfar_geisli": "[Yagluth Unlock] Geisli ('$1' Key, hold): A laser from your right hand, up to $2 meters, for at most $3 seconds, costing eitr by the second.\n", + "rov_compendium_alfar_geisli": "[Yagluth Unlock] Geisli ('$1' Key, hold): A laser from your right hand, up to $2 meters, for at most $3 seconds, costing eitr by the second. On a gamepad, hold the secondary attack with empty hands.\n", "rov_compendium_alfar_kyrr": "[Queen Unlock] Kyrr ('$1' Key): Holds what you look at in stasis for $2 seconds ($3 for a boss).\n", "rov_compendium_alfar_sameining": "[Fader Unlock] Sameining ('$1' Key): The archon. Needs $2% of your eitr and a ready Heimkall; spends all the eitr and turns it into a pool of protection. For up to $3 seconds you are larger, faster and you fly, and a psionic pulse strikes everything hostile around you, but you cannot use weapons. When it ends - time up or pool gone - you are called home at one health and the Heimkall begins its wait.\n", "rov_compendium_alfar_more_to_come": "More powers wake as the great ones fall.\n", diff --git a/JotunnModStub/Translations/Italian/compendium.json b/JotunnModStub/Translations/Italian/compendium.json index f9d4e25..34ca869 100644 --- a/JotunnModStub/Translations/Italian/compendium.json +++ b/JotunnModStub/Translations/Italian/compendium.json @@ -12,7 +12,7 @@ "rov_compendium_alfar_utsog": "[Sblocco Anziano] Utsog: il $1% dei danni che infliggi ti torna come eitr.\n", "rov_compendium_alfar_kall": "[Sblocco Bonemass] Kall (tasto '$1'): attira a te ogni oggetto a terra entro $2 metri. Attesa $3 secondi.\n", "rov_compendium_alfar_ljosstorm": "[Sblocco Moder] Ljosstorm (tasto '$1'): una tempesta psionica su un'area di $2 metri per $3 secondi. Attesa $4 secondi.\n", - "rov_compendium_alfar_geisli": "[Sblocco Yagluth] Geisli (tasto '$1', tenuto): un laser dalla mano destra, fino a $2 metri, per al massimo $3 secondi, consumando eitr al secondo.\n", + "rov_compendium_alfar_geisli": "[Sblocco Yagluth] Geisli (tasto '$1', tenuto): un laser dalla mano destra, fino a $2 metri, per al massimo $3 secondi, consumando eitr al secondo. Col controller, tieni premuto l'attacco secondario a mani vuote.\n", "rov_compendium_alfar_kyrr": "[Sblocco Regina] Kyrr (tasto '$1'): tiene in stasi ciò che guardi per $2 secondi ($3 per un boss).\n", "rov_compendium_alfar_sameining": "[Sblocco Fader] Sameining (tasto '$1'): l'arconte. Servono il $2% dell'eitr e un Heimkall pronto; spende tutto l'eitr e lo trasforma in una riserva di protezione. Per al massimo $3 secondi sei più grande, più veloce e voli, e un impulso psionico colpisce tutto ciò che è ostile attorno a te, ma non puoi usare armi. Alla fine - tempo scaduto o riserva esaurita - vieni richiamato a casa con un punto ferita e l'attesa dell'Heimkall ricomincia.\n", "rov_compendium_alfar_more_to_come": "Altri poteri si risveglieranno man mano che cadono i grandi.\n", diff --git a/JotunnModStub/Translations/Russian/compendium.json b/JotunnModStub/Translations/Russian/compendium.json index 3f8898f..c1ce95c 100644 --- a/JotunnModStub/Translations/Russian/compendium.json +++ b/JotunnModStub/Translations/Russian/compendium.json @@ -12,7 +12,7 @@ "rov_compendium_alfar_utsog": "[Открывается со Старейшиной] Утсог: $1% нанесённого вами урона возвращается к вам в виде эйтра.\n", "rov_compendium_alfar_kall": "[Открывается с Боунмассом] Калль (клавиша '$1'): притягивает к вам все лежащие предметы в радиусе $2 метров. Перезарядка $3 секунд.\n", "rov_compendium_alfar_ljosstorm": "[Открывается с Модером] Льёсстормр (клавиша '$1'): псионическая буря на площади $2 метров на $3 секунд. Перезарядка $4 секунд.\n", - "rov_compendium_alfar_geisli": "[Открывается с Ягнутом] Гейсли (клавиша '$1', удерживать): лазер из правой руки до $2 метров, не дольше $3 секунд, эйтр тратится каждую секунду.\n", + "rov_compendium_alfar_geisli": "[Открывается с Ягнутом] Гейсли (клавиша '$1', удерживать): лазер из правой руки до $2 метров, не дольше $3 секунд, эйтр тратится каждую секунду. На геймпаде удерживайте вторичную атаку с пустыми руками.\n", "rov_compendium_alfar_kyrr": "[Открывается с Королевой] Кюрр (клавиша '$1'): удерживает того, на кого смотрите, в стазисе $2 секунд ($3 для босса).\n", "rov_compendium_alfar_sameining": "[Открывается с Фадером] Саминг (клавиша '$1'): архонт. Нужно $2% эйтра и готовый Хеймкалль; тратит весь эйтр и превращает его в запас защиты. До $3 секунд вы больше, быстрее и летаете, а псионический импульс бьёт всех врагов вокруг, но оружием пользоваться нельзя. В конце - по времени или с исчерпанным запасом - вас возвращают домой с одной единицей здоровья, и Хеймкалль начинает ожидание.\n", "rov_compendium_alfar_more_to_come": "Новые силы пробуждаются по мере падения великих.\n", From cb29f54a28a7345082d9f4673f6bbc99f0b8a944 Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 27 Oct 2026 19:36:02 +0100 Subject: [PATCH 13/13] chore(release): v1.6.2 - race eyes and controller fixes Version 1.6.2 in the manifests and PluginVersion. README: the New in v1.6.2 block and the changelog, crediting lexsonn's reports; the Aswid eyes, Alfar levitation and Geisli lines follow the changes. --- JotunnModStub/Package/manifest.json | 2 +- JotunnModStub/RacesOfValheim.cs | 2 +- README.md | 22 +++++++++++++++++----- manifest.json | 2 +- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/JotunnModStub/Package/manifest.json b/JotunnModStub/Package/manifest.json index 2e2a9c0..ec4d99c 100644 --- a/JotunnModStub/Package/manifest.json +++ b/JotunnModStub/Package/manifest.json @@ -1,7 +1,7 @@ { "name": "RacesOfValheim", "description": "A Valheim mod that adds eleven custom playable races (Alfar, Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Sverm, Trenta, Trol) each with unique abilities, traits, race stations and a deep boss-driven progression system.", - "version_number": "1.6.1", + "version_number": "1.6.2", "website_url": "", "dependencies": [ "denikson-BepInExPack_Valheim-5.4.2333", diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs index f075a97..be4bdcf 100644 --- a/JotunnModStub/RacesOfValheim.cs +++ b/JotunnModStub/RacesOfValheim.cs @@ -16,7 +16,7 @@ namespace RacesOfValheim { public const string PluginGUID = "com.nandor.racesofvalheim"; public const string PluginName = "Races Of Valheim"; - public const string PluginVersion = "1.6.1"; + public const string PluginVersion = "1.6.2"; private readonly Harmony harmony = new Harmony(PluginGUID); diff --git a/README.md b/README.md index d743965..0c4775c 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ Support the mod: [Patreon — NandorTheModder](https://www.patreon.com/c/NandorT --- -## New in v1.6.1 +## New in v1.6.2 -**The Aswid rebalance.** The vampire was all strength and no price, so it now has both: a real stamina pool instead of infinite stamina, a bat that flies on stamina with the Skadi drake's controls, and four weaknesses (sunlight, fire, pierce and running water), each one configurable or switchable off. Full details in the [changelog](#v161) and under [Aswid](#4-aswid). +**Eyes and controllers.** The races' eyes now sit right on female faces, the Dvergar and Aswid eyes are smaller, and the Alfar have new grey-alien eyes. On a gamepad the Alfar can now levitate and fire Geisli, and the Draugh eats bear, Asksvin and Bonemaw meat. Full details in the [changelog](#v162). --- @@ -60,7 +60,7 @@ Support the mod: [Patreon — NandorTheModder](https://www.patreon.com/c/NandorT - **Blood Magic Mastery:** Cast Blood Magic items with infinite Eitr (health cost only). - **Benedictus et Afflictus:** Your per-boss armor, damage, speed, jump and lifesteal bonuses double at night. - **Claws of the Beast:** Press [K] to grow blackened claws for a limited time — see [Claws](#claws). -- **Burning Eyes:** Spectral green sockets, smoke trailing off them, that hold a red glow only in the final stage. +- **Burning Eyes:** Two small spectral green points that hold a red glow only in the final stage. The smoke trailing off them is off by default (`Aswid - Eyes` > `Eye Smoke`). - **Undead Vigor:** A large stamina pool on top of your food: +25, and 10 more for every boss. Consume the lifeforce of enemies instead of eating normal food; early prey feeds you more stamina than health. - **The Curse's Price:** By day under open sky the sun slows you, weakens your regeneration and burns you down to 30% health; a roof, a dungeon, the Swamp, the Mistlands, the night or your Eclipse shield you. Fire hits 25% harder until Fader, pierce 20% harder. Running water rejects you: swimming costs double stamina, and open water (sea, river or lake) burns you while you swim in it or fly over it, unless a boat carries you, though the camera still sways on board. Every weakness can be switched off under `Aswid - Weaknesses` and `Aswid - Running Water`. @@ -109,7 +109,7 @@ Support the mod: [Patreon — NandorTheModder](https://www.patreon.com/c/NandorT ### 11. Alfar - **Eitr Shield:** Eitr is your armour: blows land on the eitr pool first, and lightning and spirit cost double. Only drowning and the edge of the world ignore it. Every food you eat also feeds the pool. -- **Soft Fall & Levitation:** With eitr in the pool, falls cost nothing and you drift down slowly; hold Jump in the air to rise, burning eitr. +- **Soft Fall & Levitation:** With eitr in the pool, falls cost nothing and you drift down slowly; hold Jump in the air to rise, burning eitr. Works with the gamepad's jump button too. - **Heimkall:** A lethal blow wakes you at one health at your bed (or the world's origin if you set none), invulnerable for 5 seconds. Once every 20 minutes, 15 after Yagluth and 10 after Fader. - **Caster powers:** Skrid (blink), Grafvaettir (a grenade of mining drones), Kall (pulls dropped items to you), Ljosstorm (psionic storm), Geisli (a laser from the hand), Kyrr (stasis) and, from Fader, Sameining, the archon. Their cooldowns and the Heimkall wait show on screen. - **The Nexus:** a Ljoskjarne with a market, workers that keep the base running, three constructs, crystals, a Ljosgard that turns mushrooms into Sap and bronze turrets. See [Race Stations & Companions](#race-stations--companions). @@ -279,7 +279,7 @@ Build a **Brood Mound** with the hammer — no more than two within its density - **Elder:** Utsog — 15% of the damage you deal comes back as eitr. - **Bonemass:** Kall (J) — every dropped item within 15 meters flies to you. - **Moder:** Ljosstorm (K) — a psionic storm over an area. -- **Yagluth:** Geisli (O, hold) — a laser from your right hand. Heimkall wait drops to 15 minutes. +- **Yagluth:** Geisli (O, hold; on a gamepad, hold the secondary attack with empty hands) — a laser from your right hand. Heimkall wait drops to 15 minutes. - **Queen:** Kyrr (U) — stasis on what you look at. - **Fader:** Sameining (I) — the archon: all your eitr becomes a pool of protection; larger, faster, flying, a psionic pulse instead of weapons, up to 3 minutes. It ends with a trip home at one health. Heimkall wait drops to 10 minutes. @@ -475,6 +475,18 @@ Both halves have an off switch under `Factions` in Configuration Manager: **Fact ## Changelog +### v1.6.2 +- **Fix - eyes on female faces:** the glowing eyes of the Dvergar, Aswid and Sverm, and the Alfar's black eyes, now sit on the female face. They used to land on the brow and seemed not to follow the head. +- **Changed - Dvergar eyes:** smaller. +- **Changed - Aswid eyes:** two small green points, and the eye smoke is off by default (`Aswid - Eyes` > `Eye Smoke`). +- **Changed - Alfar eyes:** wide black almonds slanted up toward the temples, like the greys. They no longer trail behind the head when it moves. +- **Fix - Draugh diet:** raw bear meat (Bjorn), Asksvin tail and Bonemaw serpent meat are now food. Raw Volture meat works too; the Draugh pointed it at a cooked item that does not exist. +- **Fix - Alfar levitation on a controller:** hold the jump button in the air to rise. In the Archon form the pad's jump and crouch buttons climb and descend. +- **Fix - Alfar Geisli on a controller:** hold the secondary attack with empty hands, or at any time in the Archon form. Every pad button is already taken in the game's default layout, so Geisli borrows this one, as the Skadi's Cold Spell does. +- **Fix - flight keys:** flying as a Skadi drake or an Aswid bat follows your own movement and sprint keys if you rebound them in the settings, not only W, S and Shift. + +Thanks to lexsonn for the Draugh and controller reports. + ### v1.6.1 - **Balance - Aswid stamina:** no more infinite stamina. The Aswid has a large pool on top of its food (+25, plus 10 per boss) and spends stamina like everyone else, so stamina mods, foods and skills work for the race again, and the stamina bar is back. Tune the pool and a cost multiplier under `Aswid - Stamina`. - **Balance - Aswid devour:** devoured creatures feed 10% less health, and part of it turns into stamina: 60% for Meadows and Black Forest prey, 10% for the rest. Creatures without a meal of their own are capped by their biome, so a Troll now feeds about 16 health and 24 stamina instead of 150 health. All of it under `Aswid - Devour`. diff --git a/manifest.json b/manifest.json index 2e2a9c0..ec4d99c 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "RacesOfValheim", "description": "A Valheim mod that adds eleven custom playable races (Alfar, Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Sverm, Trenta, Trol) each with unique abilities, traits, race stations and a deep boss-driven progression system.", - "version_number": "1.6.1", + "version_number": "1.6.2", "website_url": "", "dependencies": [ "denikson-BepInExPack_Valheim-5.4.2333",