feat: Skeletons can show their helmet

New "Show Helmet" option under Skeleton - Visuals, off by default. The owner's
choice is written to the ZDO, so other players see the helmet the way its owner
picked.

On a skull the helmet moves up and back and grows to fit, since the skull is
bigger than the viking head the helmet hangs for. Hoods and the other skinned
helmets can't be moved by their transform: their Head bone is swapped for a
fitted child bone, so the head part follows the skull and the shoulder parts
stay put. A viking body gets the vanilla placement and bones back.
This commit is contained in:
kanym 2026-10-29 01:08:07 +01:00
commit e972ca5ea4
5 changed files with 259 additions and 30 deletions

View file

@ -396,10 +396,11 @@ namespace RacesOfValheim
{
// Hide Helmets (Valheim uses singular GameObject for helmet). Only over a skull:
// a viking body wears its helmet, and the VisEquipment postfix puts it back.
// "Show Helmet" keeps it on the skull too, and is published for other clients.
SkeletonVisuals.PublishShowHelmet(Player.m_localPlayer);
if (SkeletonConfig.BodyModelEnabled.Value)
{
var helmetObj = HarmonyLib.Traverse.Create(currentVis).Field<GameObject>("m_helmetItemInstance").Value;
SkeletonVisuals.SetEquipmentPieceHidden(helmetObj, true);
SkeletonVisuals.FitHelmet(Player.m_localPlayer, currentVis, SkeletonConfig.ShowHelmet.Value);
}
// Scale Body Armor (Chest, Legs, Shoulder) by 5%