From dc635f49cbce37468ac88c15c9885bb91c10692c Mon Sep 17 00:00:00 2001 From: kanym Date: Wed, 5 Aug 2026 17:57:01 +0200 Subject: [PATCH] fix(skeleton): stop hiding Fader's jaw, and take the race off properly on reset Fader collapsed the jaw bone deliberately: the charred twitcher it used to wear there carried a jaw of its own and the two doubled up. That model is gone from every tier now, and the skeleton worn in its place has a jaw that belongs on the face - so tier 8 was losing its mandible for no reason. The collapse is gone and what remains is a restore, so anyone left jawless by the old build gets it back on their next frame. Resetting to Human left a burning skull and an invisible jaw behind. Everything the race puts on the player is taken off in one branch - the one entered the moment IsSkeleton stops being true - and neither the head flame nor the jaw was ever listed there. The flame was only ever switched off from inside the Skeleton branch, which by then is unreachable, and the jaw was only restored at tiers below 8, which a Human never evaluates. Both now come off with everything else, alongside the body scale that already did. --- JotunnModStub/Skeleton/SkeletonRace.cs | 53 ++++++++++++++++---------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/JotunnModStub/Skeleton/SkeletonRace.cs b/JotunnModStub/Skeleton/SkeletonRace.cs index 8f7438c..1d82864 100644 --- a/JotunnModStub/Skeleton/SkeletonRace.cs +++ b/JotunnModStub/Skeleton/SkeletonRace.cs @@ -228,9 +228,16 @@ namespace RacesOfValheim if (Player.m_localPlayer == null) return; - if (!IsSkeleton() || Player.m_localPlayer.IsDead()) + if (!IsSkeleton() || Player.m_localPlayer.IsDead()) { + // Everything the race puts on the player has to come off here, because this is the + // only path taken once they stop being one. A Fader-tier Skeleton who reset to + // Human kept a burning skull and a collapsed jaw, since neither the flame nor the + // jaw was ever switched back from outside the Skeleton branch below. EnsureFireAuraVFX(false); + EnsureHeadFlameVFX(false); + RestoreJawBone(); + if (Player.m_localPlayer.transform.localScale != Vector3.one) { Player.m_localPlayer.transform.localScale = Vector3.one; @@ -305,25 +312,12 @@ namespace RacesOfValheim } } - // Hide Charred Twitcher Jaw - if (currentVis != null && currentVis.m_bodyModel != null && currentVis.m_bodyModel.bones != null) - { - foreach (Transform bone in currentVis.m_bodyModel.bones) - { - if (bone != null && bone.name.ToLower().Contains("jaw")) - { - if (state >= 8) - { - if (bone.localScale != Vector3.zero) bone.localScale = Vector3.zero; - } - else - { - if (bone.localScale == Vector3.zero) bone.localScale = Vector3.one; - } - break; - } - } - } + // Fader used to collapse this bone, because the charred twitcher it wore there carried + // a jaw of its own and the two doubled up. That model is gone from every tier now, and + // the skeleton worn in its place has a jaw that belongs on the face - so the tier lost + // its mandible for no reason at all. Kept as a restore so anyone left with a collapsed + // jaw by the old build gets it back. + RestoreJawBone(); // Apply Scale Vector3 targetScale = rules.ScaleMultiplier; @@ -423,6 +417,25 @@ namespace RacesOfValheim } } + /// + /// Puts the player's jaw back if anything collapsed it. Safe to call every frame and for + /// any race - it does nothing unless the bone is actually at zero scale. + /// + private static void RestoreJawBone() + { + VisEquipment vis = Player.m_localPlayer != null + ? Player.m_localPlayer.GetComponent() + : null; + if (vis == null || vis.m_bodyModel == null || vis.m_bodyModel.bones == null) return; + + foreach (Transform bone in vis.m_bodyModel.bones) + { + if (bone == null || !bone.name.ToLower().Contains("jaw")) continue; + if (bone.localScale == Vector3.zero) bone.localScale = Vector3.one; + break; + } + } + /// /// Flames burning on the skull. Cosmetic only - it deals nothing and blocks nothing. ///