fix(skeleton): stop the fire aura borrowing another mod's VFX by name
The tier-5 fire aura looked for "vfx_smoke", then "vfx_surtling_death". Neither name exists in Valheim, checked against the game's own asset manifests, so both lookups came back null and the aura has never been visible in a plain install. The dead branch was not harmless. PrefabManager.Cache resolves by asset name across everything in memory, other mods' asset bundles included, and its tie-break for a duplicate name ends in "newest wins". A name vanilla does not use has no vanilla candidate to beat, so it is a free slot. Magic_Supremacy fills it. The lookup resolved to 'EncounterCreatureRikoMountain_DO/vfx_smoke', a child node of one of its creatures carrying 'club_trail_riko_DO' on 'Dreanegade/ParticleAlphaEmission' - a weapon trail, on an emissive shader, sprayed through a 4.5m sphere on the player. That is the purple smoke around the burning skull users reported, on every client that could see the skeleton. The aura now draws nothing on purpose, which costs it nothing it had. Its damage, radius and tick are untouched. The two identical EnsureFireAuraVFX copies in SkeletonRace and ZdoVisualSync are replaced by one SkeletonVisuals.EnsureFireAura, shaped like DraughVisuals.EnsureAura; the call sites stay, so reinstating the visual needs no change in either file. The comment on it records the whole chain and the way to build it properly, through BorrowEffect, the way HeadFlame already does. Also keeps a resolution log on the model lookup: every magic mod in the report ships an object called "Skeleton", which is this race's own tier-0 model name. The vanilla creature won during the repro; root=False in that log is what says it stopped winning. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
f64fe83d9d
commit
00d4fd6e46
4 changed files with 102 additions and 144 deletions
|
|
@ -173,8 +173,9 @@ namespace RacesOfValheim
|
|||
m_player.transform.localScale = targetScale;
|
||||
}
|
||||
|
||||
// Fire Aura VFX
|
||||
EnsureFireAuraVFX(rules.FireAura);
|
||||
// Deliberately draws nothing - see SkeletonVisuals.EnsureFireAura for why. Called
|
||||
// anyway so reinstating the visual needs no change here.
|
||||
SkeletonVisuals.EnsureFireAura(m_player, rules.FireAura, ref m_fireAuraVFX);
|
||||
}
|
||||
|
||||
private void UpdateFenrirVisuals()
|
||||
|
|
@ -263,7 +264,7 @@ namespace RacesOfValheim
|
|||
PlayerVisualHider.Show(playerVisual, "zdosync-revert");
|
||||
|
||||
if (m_currentFormInstance != null) Destroy(m_currentFormInstance);
|
||||
EnsureFireAuraVFX(false);
|
||||
SkeletonVisuals.EnsureFireAura(m_player, false, ref m_fireAuraVFX);
|
||||
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.
|
||||
|
|
@ -283,70 +284,5 @@ namespace RacesOfValheim
|
|||
m_lastFenrirForm = "";
|
||||
m_lastSkadiForm = "";
|
||||
}
|
||||
|
||||
private void EnsureFireAuraVFX(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
if (m_fireAuraVFX == null)
|
||||
{
|
||||
GameObject sourceVFX = Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>("vfx_smoke") ??
|
||||
Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>("vfx_surtling_death");
|
||||
|
||||
m_fireAuraVFX = new GameObject("SkeletonFireAuraVFX");
|
||||
m_fireAuraVFX.transform.SetParent(m_player.transform, false);
|
||||
m_fireAuraVFX.transform.localPosition = new Vector3(0, 1f, 0);
|
||||
|
||||
if (sourceVFX != null)
|
||||
{
|
||||
ParticleSystem[] pss = sourceVFX.GetComponentsInChildren<ParticleSystem>();
|
||||
if (pss.Length > 0)
|
||||
{
|
||||
ParticleSystem ps = m_fireAuraVFX.AddComponent<ParticleSystem>();
|
||||
var main = ps.main;
|
||||
main.loop = true;
|
||||
main.duration = 1f;
|
||||
main.startLifetime = 1.5f;
|
||||
main.startSize = new ParticleSystem.MinMaxCurve(1.5f, 3f);
|
||||
main.startSpeed = 0f;
|
||||
main.simulationSpace = ParticleSystemSimulationSpace.World;
|
||||
|
||||
var renderer = m_fireAuraVFX.GetComponent<ParticleSystemRenderer>();
|
||||
renderer.material = pss[0].GetComponent<ParticleSystemRenderer>().material;
|
||||
|
||||
var shape = ps.shape;
|
||||
shape.shapeType = ParticleSystemShapeType.Sphere;
|
||||
shape.radius = 4.5f;
|
||||
|
||||
var emission = ps.emission;
|
||||
emission.rateOverTime = 40f;
|
||||
|
||||
var colorOverLifetime = ps.colorOverLifetime;
|
||||
colorOverLifetime.enabled = true;
|
||||
Gradient grad = new Gradient();
|
||||
grad.SetKeys(
|
||||
new GradientColorKey[] {
|
||||
new GradientColorKey(new Color(1f, 0.8f, 0.2f), 0.0f),
|
||||
new GradientColorKey(new Color(1f, 0.3f, 0.0f), 0.5f),
|
||||
new GradientColorKey(new Color(0.2f, 0.0f, 0.0f), 1.0f)
|
||||
},
|
||||
new GradientAlphaKey[] {
|
||||
new GradientAlphaKey(0.0f, 0.0f),
|
||||
new GradientAlphaKey(0.6f, 0.2f),
|
||||
new GradientAlphaKey(0.6f, 0.8f),
|
||||
new GradientAlphaKey(0.0f, 1.0f)
|
||||
}
|
||||
);
|
||||
colorOverLifetime.color = grad;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!m_fireAuraVFX.activeSelf) m_fireAuraVFX.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_fireAuraVFX != null && m_fireAuraVFX.activeSelf) m_fireAuraVFX.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue