fix(skeleton): hide beard and skinned helmet pieces correctly

The hair/beard hide called into m_hairItemInstances/m_beardItemInstances
(plural), fields that don't exist on VisEquipment - every other race uses
the real singular m_hairItemInstance/m_beardItemInstance, so the beard was
never actually hidden. Fixed the field names and made the helper handle
both a GameObject and a List<GameObject> defensively.

Helmet hiding only scaled the wrapper to zero, which does nothing for a
skinned-mesh piece bound to the player's own bones - it ignores its
wrapper's transform. Added SkeletonVisuals.SetEquipmentPieceHidden, which
scales to zero and disables every child renderer, and used it everywhere
the helmet is hidden (local player, remote players, main-menu preview).

Also added an F8 debug dump of the hair/beard/helmet instance state
(active, renderer enabled, scale) for diagnosing any future visibility
regressions in-game.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
kanym 2026-08-06 12:12:30 +02:00
commit 2f890f95f7
4 changed files with 154 additions and 54 deletions

View file

@ -128,10 +128,7 @@ namespace RacesOfValheim
// Hide Helmet
var helmetObj = HarmonyLib.Traverse.Create(vis).Field<GameObject>("m_helmetItemInstance").Value;
if (helmetObj != null && helmetObj.transform.localScale != Vector3.zero)
{
helmetObj.transform.localScale = Vector3.zero;
}
SkeletonVisuals.SetEquipmentPieceHidden(helmetObj, true);
// Scale Body Armor
string[] armorFields = { "m_chestItemInstances", "m_legItemInstances", "m_shoulderItemInstances" };