fix(dvergur): tint the skin from UpdateColors, and raise the height

The tint was applied the way the race-selection menu appears to do it, with
VisEquipment.SetSkinColor followed by UpdateColors, and had no visible effect.
That pair is not what colours a player: UpdateColors rebuilds the body material
from Valheim own state each refresh, so a tint only survives if it is written
after it runs. Every race here that visibly changes colour already has a
postfix on UpdateColors setting _SkinColor on the material, and the SetSkinColor
calls in the menu are decorative on their own. The Dvergur now follows the Trol.

Reading the race from the ZDO with a m_customData fallback and no local-player
check covers the main-menu preview and the first spawn frame, where
Player.m_localPlayer is still null. Nothing needs saving or restoring either,
since the tint stops being applied the moment the race changes.

Beard and hair go pale to match; the hood hides most of the hair but the beard
shows.

Height goes from 0.70 to 0.78. The spec asked for at least -30% but that read as
too small beside a human on screen.
This commit is contained in:
kanym 2026-08-02 23:08:12 +02:00
commit 8df7681cea
4 changed files with 60 additions and 47 deletions

View file

@ -33,12 +33,18 @@ namespace RacesOfValheim
// Tuning knobs are static readonly rather than const throughout: a const folds at compile
// time, which turns "is this perk switched off?" guards into dead code the moment a knob
// is set to zero, and would bake the old value into any assembly built against this one.
public static readonly float VisualScale = 0.70f; // -30% versus a human
// Nudged up from the 0.70 the spec asked for: -30% read as too small next to a human once
// it was actually on screen.
public static readonly float VisualScale = 0.78f; // -22% versus a human
// ─── Skin ────────────────────────────────────────────────────────────
// Tint applied over the human skin texture, the same multiplicative m_skinColor the
// Furling and Trol use. Ashen grey with a blue cast, to read as one of the deep folk.
public static readonly Vector3 SkinColor = new Vector3(0.72f, 0.74f, 0.82f);
// Written straight onto the body material's _SkinColor by the UpdateColors postfix, which
// is the only thing that actually tints a player - see the comment on that patch.
// Ashen grey with a blue cast, to read as one of the deep folk.
public static readonly Color SkinColor = new Color(0.72f, 0.74f, 0.82f, 1f);
// Dvergr are white-haired. The hood hides most of it, but the beard shows.
public static readonly Color HairColor = new Color(0.88f, 0.88f, 0.90f, 1f);
// ─── Cosmetic hood ───────────────────────────────────────────────────
// The helmet slot itself stays free — whatever the player equips keeps all of its stats,