feat(trenta): grow a crown of branches, and fix(draugh): let everyone see the rot

Trenta: a greydwarf shaman trophy is hung on the player head bone and sunk into
the skull until only the horns and branches clear it - the Furling wears a goblin
head the same way, aimed at the opposite result. A trophy is a plain static mesh,
so unlike the Dvergar hood there is no rig to collapse: the player own head does
all the hiding, which makes the three offsets in TrentaConfig the entire look.
They are a first pass and want eyeballing in game.

Draugh: the smoke and the cloud of flies only ever existed on the client of the
player wearing them. DraughRace is a single MonoBehaviour that looks at
Player.m_localPlayer and nothing else, so in multiplayer every other player saw
an ordinary, unrotted Viking. The build moved to DraughVisuals, which takes a
Player, and RacesVisualController now grows the same aura on every remote Draugh
it can see. Nothing is networked and nothing needs to be - each client reads the
race off the ZDO and makes its own particles.

Both hang off VisEquipment.UpdateVisuals or the visual controller, the two hooks
that already run for remote players, so neither had to invent a sync path.
This commit is contained in:
kanym 2026-08-05 13:40:09 +02:00
commit 67e445014f
7 changed files with 345 additions and 70 deletions

View file

@ -112,71 +112,14 @@ namespace RacesOfValheim
}
}
/// <summary>
/// The local player's half of the aura. The build itself moved to DraughVisuals so that
/// RacesVisualController can grow the same one on every remote Draugh - this script only
/// ever sees the player at the keyboard, which is why nobody else could see the rot.
/// </summary>
private void EnsureVFX(bool enable)
{
if (enable && Player.m_localPlayer != null)
{
if (draughVFX == null)
{
GameObject draugrPrefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>("Draugr");
if (draugrPrefab != null)
{
draughVFX = new GameObject("DraughAuraVFX");
draughVFX.transform.SetParent(Player.m_localPlayer.transform, false);
// Centro del giocatore invece che il pivot (piedi)
draughVFX.transform.localPosition = new Vector3(0, 1f, 0);
// Find all ParticleSystems in Draugr prefab
ParticleSystem[] pss = draugrPrefab.GetComponentsInChildren<ParticleSystem>(true);
foreach (ParticleSystem ps in pss)
{
// We only want looping ambient effects (flies, smoke)
if (ps.main.loop)
{
GameObject psCopy = Instantiate(ps.gameObject, draughVFX.transform);
psCopy.name = ps.gameObject.name;
psCopy.SetActive(true);
// Entrambi (fumo e mosche) partono esattamente dal centro
psCopy.transform.localPosition = Vector3.zero;
psCopy.transform.localRotation = ps.transform.localRotation;
string psName = psCopy.name.ToLower();
if (psName.Contains("flies"))
{
// Flies effect: leave as is
}
else if (psName.Contains("drip") || psName.Contains("drop") || psName.Contains("rain") || psName.Contains("splash"))
{
// Effetto 3 (pioggia): disattivato
psCopy.SetActive(false);
}
else
{
// Smoke effect: scale reduced to 1.5f (-40% of 2.5f)
psCopy.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
var main = psCopy.GetComponent<ParticleSystem>().main;
main.scalingMode = ParticleSystemScalingMode.Hierarchy;
}
}
}
}
}
if (draughVFX != null && !draughVFX.activeSelf)
{
draughVFX.SetActive(true);
}
}
else
{
if (draughVFX != null && draughVFX.activeSelf)
{
draughVFX.SetActive(false);
}
}
DraughVisuals.EnsureAura(Player.m_localPlayer, enable, ref draughVFX);
}
public System.Collections.IEnumerator UndyingWillRoutine(Player p)