fix(skeleton): the Summon on Kill aura borrows the torch smoke

The Draugr's evil_smoke is on 'Lux Lit Particles/ Bumped' and showed
nothing in game once tinted dark. The torch's own Smoke, from the
prefab the head flame burns from, is the grey everyone sees above a
torch; darkened to (0.08, 0.08, 0.09) at 0.45 alpha.
This commit is contained in:
kanym 2026-10-24 15:44:16 +02:00
commit 3591b7e375

View file

@ -442,8 +442,8 @@ namespace RacesOfValheim
/// of the indicator, beside the Raise the Dead icon, so the community can pick either or
/// both. Cosmetic only.
///
/// The smoke is the Draugr's own looping one, the same particle DraughVisuals.BuildAura
/// borrows, cloned through BorrowEffect and tinted near-black. It emits from a box the
/// The smoke is the torch's own (see Build for why not the Draugr's), cloned through
/// BorrowEffect and tinted near-black. It emits from a box the
/// size of the body rather than from one point, so it comes off the arms and legs too.
/// A mesh-shaped emitter would hug the body closer, but only works on a readable mesh.
///
@ -451,7 +451,8 @@ namespace RacesOfValheim
/// </summary>
public class RaisingAura
{
private static readonly Color Smoke = new Color(0.06f, 0.06f, 0.07f, 0.35f);
// The torch smoke is (0.35, 0.35, 0.35, 0.21); darker and a little thicker than that.
private static readonly Color Smoke = new Color(0.08f, 0.08f, 0.09f, 0.45f);
private static readonly Vector3 BodyBox = new Vector3(0.55f, 1.7f, 0.35f);
private const float BodyCentre = 0.95f;
@ -473,17 +474,18 @@ namespace RacesOfValheim
private bool Build(Player player)
{
GameObject draugr = PrefabManager.Cache.GetPrefab<GameObject>("Draugr");
// The torch's own 'Smoke', from the same prefab the head flame burns from. The
// Draugr's evil_smoke was tried first: its material is on 'Lux Lit Particles/
// Bumped', which takes its look from the material and the scene light, so a dark
// tint on it showed nothing in game. The torch smoke is the grey everyone sees
// above a torch, so darkening it has something to darken.
GameObject torch = ResolveFlameSource();
ParticleSystem source = null;
if (draugr != null)
if (torch != null)
{
foreach (ParticleSystem ps in draugr.GetComponentsInChildren<ParticleSystem>(true))
foreach (ParticleSystem ps in torch.GetComponentsInChildren<ParticleSystem>(true))
{
string name = ps.gameObject.name.ToLower();
if (!ps.main.loop || name.Contains("flies") || name.Contains("drip") || name.Contains("drop") ||
name.Contains("rain") || name.Contains("splash")) continue;
source = ps;
break;
if (ps.gameObject.name.ToLower().Contains("smoke")) { source = ps; break; }
}
}
@ -492,7 +494,7 @@ namespace RacesOfValheim
if (!warned)
{
warned = true;
Jotunn.Logger.LogWarning("[Skeleton] No looping smoke found on 'Draugr'; the Summon on Kill aura stays off.");
Jotunn.Logger.LogWarning("[Skeleton] No 'Smoke' particle on the torch; the Summon on Kill aura stays off.");
}
return false;
}
@ -519,8 +521,8 @@ namespace RacesOfValheim
shape.position = Vector3.zero;
shape.rotation = Vector3.zero;
// The Draugr's tint over a particle's life would put its green back; keep the
// fade (alpha) and drop the colour.
// A tint over the particle's life would put the source's own colour back; keep
// the fade (alpha) and drop the colour.
ParticleSystem.ColorOverLifetimeModule col = ps.colorOverLifetime;
if (col.enabled)
{
@ -536,7 +538,7 @@ namespace RacesOfValheim
// nothing for black. If the aura is invisible in game, this line says why.
Renderer smokeRenderer = m_instance.GetComponentInChildren<Renderer>(true);
Material smokeMaterial = smokeRenderer != null ? smokeRenderer.sharedMaterial : null;
Jotunn.Logger.LogInfo($"[Skeleton] Summon on Kill aura built from 'Draugr/{source.gameObject.name}', " +
Jotunn.Logger.LogInfo($"[Skeleton] Summon on Kill aura built from '{torch.name}/{source.gameObject.name}', " +
$"material '{(smokeMaterial != null ? smokeMaterial.name : "none")}', " +
$"shader '{(smokeMaterial != null && smokeMaterial.shader != null ? smokeMaterial.shader.name : "none")}'.");
return true;