fix(skeleton): let everyone see the burning skull

The head flame was built inside SkeletonRace, a single MonoBehaviour that only
ever looks at Player.m_localPlayer, so the fire existed on one client and on one
player. Everyone else saw a bare skull. Same shape as the Draugh aura, same fix:
the build moves to SkeletonVisuals.HeadFlame, which takes a Player, and
RacesVisualController grows one for every remote skeleton it can see. Held per
player rather than statically - a static would hand the second skeleton in view
the first one is fire. Nothing is networked and nothing needs to be: the tier is
already on the ZDO, so each client works out for itself who should be alight.

The remote path also still collapsed the jaw at Fader, the charred-twitcher
leftover that was removed from the local path two commits ago - so other players
would have gone on seeing a Fader with no mandible. It is a restore there now
too.
This commit is contained in:
kanym 2026-08-05 18:22:57 +02:00
commit 892b970df4
3 changed files with 170 additions and 142 deletions

View file

@ -40,6 +40,7 @@ namespace RacesOfValheim
private GameObject m_currentFormInstance = null;
private GameObject m_fireAuraVFX = null;
private GameObject m_draughAuraVFX = null;
private readonly SkeletonVisuals.HeadFlame m_skeletonHeadFlame = new SkeletonVisuals.HeadFlame();
private float m_lastFlightLog = 0f;
private void Awake()
@ -148,27 +149,25 @@ namespace RacesOfValheim
}
}
// Hide Jaw for Charred Twitcher
// Fader used to collapse this bone here too, for the charred twitcher it wore at
// that tier. That model is gone and the skeleton in its place has a jaw of its
// own, so this is only a restore now - the same as the local path. Without it,
// other players would still see a Fader with no mandible.
if (vis.m_bodyModel != null && vis.m_bodyModel.bones != null)
{
foreach (Transform bone in vis.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;
}
if (bone == null || !bone.name.ToLower().Contains("jaw")) continue;
if (bone.localScale == Vector3.zero) bone.localScale = Vector3.one;
break;
}
}
}
// The burning skull, grown locally for whoever we are looking at. The tier is on the
// ZDO, so this client can work out for itself whether they should be alight.
m_skeletonHeadFlame.Apply(m_player, rules.ModelPrefab == SkeletonProgression.FireModel);
// Apply Scale
Vector3 targetScale = rules.ScaleMultiplier;
if (m_player.transform.localScale != targetScale)
@ -269,6 +268,7 @@ namespace RacesOfValheim
if (m_currentFormInstance != null) Destroy(m_currentFormInstance);
EnsureFireAuraVFX(false);
DraughVisuals.EnsureAura(m_player, false, ref m_draughAuraVFX);
m_skeletonHeadFlame.Apply(m_player, false);
// Takes the crown off a Trenta who has died or changed race; a no-op for everyone else.
TrentaVisuals.ApplyCrown(m_player);