feat(skeleton): dark aura while Summon on Kill is on, archaic toggle messages

Beside the Raise the Dead icon, a faint near-black smoke now rises off
the whole body while Summon on Kill is on: the Draugr's looping smoke,
borrowed like the Draugh aura, emitted from a body-sized box in world
space. The owner writes the switch to the ZDO, so other players see
it. "Raise the Dead Icon" and "Raise the Dead Aura" under Skeleton -
Visuals let each player keep either or both, for a community vote.

The toggle now says "Thy dead shall rise again." / "Raising...
nevermore.", in English, Italian and Russian.
This commit is contained in:
kanym 2026-10-24 15:38:42 +02:00
commit 98b1a1b5f3
7 changed files with 143 additions and 8 deletions

View file

@ -46,6 +46,8 @@ namespace RacesOfValheim
// ─── Visuals ───────────────────────────────────────────────────────────
public static ConfigEntry<bool> HeadFireVFXEnabled;
public static ConfigEntry<bool> BodyModelEnabled;
public static ConfigEntry<bool> RaiseDeadIcon;
public static ConfigEntry<bool> RaiseDeadAura;
public static void Bind(ConfigFile config)
{
@ -72,7 +74,7 @@ namespace RacesOfValheim
// G is the first ability key of every race that has one; the Skeleton had none.
const string keybinds = "Skeleton - Keybinds";
SummonToggleKey = config.Bind(keybinds, "Toggle Summon on Kill", new KeyboardShortcut(KeyCode.G),
"Turns raising a skeleton from each kill on and off (The Queen and later). The Dead Raiser icon shows while it is on.");
"Turns raising a skeleton from each kill on and off (The Queen and later). While it is on, the Raise the Dead icon and a faint dark aura show it (see Skeleton - Visuals).");
const string resurrection = "Skeleton - Resurrection";
ResurrectionCooldown = config.Bind(resurrection, "Cooldown", 300f,
@ -83,6 +85,10 @@ namespace RacesOfValheim
new ConfigDescription("Whether the burning-skull effect (worn from tier 5+) renders at all. A client-side preference: disabling it stops you from seeing it on yourself and on every other skeleton you look at, but does not change what other players see."));
BodyModelEnabled = config.Bind(visuals, "Body Model Enabled", true,
new ConfigDescription("Whether Skeleton players wear the skeleton body. Turn it off if you use a player model mod (EnhancedValheimVRM and the like): Skeletons then keep the vanilla viking body, so the replacement model shows without bones clipping through it. Abilities are unchanged. Client-side, like the option above: it applies to every Skeleton you see, yourself included, and changes nothing for other players."));
RaiseDeadIcon = config.Bind(visuals, "Raise the Dead Icon", true,
new ConfigDescription("Shows the Raise the Dead status icon while your Summon on Kill is on."));
RaiseDeadAura = config.Bind(visuals, "Raise the Dead Aura", true,
new ConfigDescription("A faint dark smoke rises off a Skeleton whose Summon on Kill is on. Client-side: turning it off hides it on yourself and on every other Skeleton you see."));
}
}
}

View file

@ -106,7 +106,22 @@ namespace RacesOfValheim
}
}
SetRaiseDeadIcon(player, rules.SummonOnKill && SummonOnKillEnabled);
bool on = rules.SummonOnKill && SummonOnKillEnabled;
SetRaiseDeadIcon(player, on && SkeletonConfig.RaiseDeadIcon.Value);
Instance?.raisingAura.Apply(player, on && SkeletonConfig.RaiseDeadAura.Value);
SetRaisingFlag(player, on);
}
private readonly SkeletonVisuals.RaisingAura raisingAura = new SkeletonVisuals.RaisingAura();
/// <summary>Owner only, and only on a change, so other clients can draw the aura.</summary>
private static void SetRaisingFlag(Player player, bool on)
{
ZNetView nview = player.GetComponent<ZNetView>();
if (nview == null || !nview.IsValid() || !nview.IsOwner()) return;
ZDO zdo = nview.GetZDO();
if (zdo.GetBool(SkeletonVisuals.RaisingZdoKey, false) != on) zdo.Set(SkeletonVisuals.RaisingZdoKey, on);
}
private static void SetRaiseDeadIcon(Player player, bool on)
@ -340,6 +355,8 @@ namespace RacesOfValheim
headFlame.Apply(Player.m_localPlayer, false);
RestoreJawBone();
SetRaiseDeadIcon(Player.m_localPlayer, false);
raisingAura.Apply(Player.m_localPlayer, false);
SetRaisingFlag(Player.m_localPlayer, false);
if (Player.m_localPlayer.transform.localScale != Vector3.one)
{

View file

@ -434,6 +434,115 @@ namespace RacesOfValheim
aura = null;
}
/// <summary>The owner's Summon on Kill switch, for every other client to read.</summary>
public const string RaisingZdoKey = "RacesOfValheim_SkeletonRaising";
/// <summary>
/// A faint dark smoke rising off the whole body while Summon on Kill is on: the other half
/// 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
/// 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.
///
/// Held per player, like HeadFlame. Call Apply every frame; it builds once.
/// </summary>
public class RaisingAura
{
private static readonly Color Smoke = new Color(0.06f, 0.06f, 0.07f, 0.35f);
private static readonly Vector3 BodyBox = new Vector3(0.55f, 1.7f, 0.35f);
private const float BodyCentre = 0.95f;
private GameObject m_instance;
public void Apply(Player player, bool enable)
{
if (!enable || player == null)
{
if (m_instance != null && m_instance.activeSelf) m_instance.SetActive(false);
return;
}
if (m_instance == null && !Build(player)) return;
if (!m_instance.activeSelf) m_instance.SetActive(true);
}
private static bool warned;
private bool Build(Player player)
{
GameObject draugr = PrefabManager.Cache.GetPrefab<GameObject>("Draugr");
ParticleSystem source = null;
if (draugr != null)
{
foreach (ParticleSystem ps in draugr.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 (source == null)
{
if (!warned)
{
warned = true;
Jotunn.Logger.LogWarning("[Skeleton] No looping smoke found on 'Draugr'; the Summon on Kill aura stays off.");
}
return false;
}
m_instance = BorrowEffect(source.gameObject, player.transform, "SkeletonRaisingAura", false, "Skeleton");
if (m_instance == null) return false;
m_instance.transform.localPosition = new Vector3(0f, BodyCentre, 0f);
m_instance.transform.localRotation = Quaternion.identity;
m_instance.transform.localScale = Vector3.one;
foreach (ParticleSystem ps in m_instance.GetComponentsInChildren<ParticleSystem>(true))
{
ParticleSystem.MainModule main = ps.main;
main.startColor = new ParticleSystem.MinMaxGradient(Smoke);
// World space, so the smoke stays behind as the body moves, like a trail.
main.simulationSpace = ParticleSystemSimulationSpace.World;
main.scalingMode = ParticleSystemScalingMode.Hierarchy;
ParticleSystem.ShapeModule shape = ps.shape;
shape.enabled = true;
shape.shapeType = ParticleSystemShapeType.Box;
shape.scale = BodyBox;
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.
ParticleSystem.ColorOverLifetimeModule col = ps.colorOverLifetime;
if (col.enabled)
{
Gradient faded = new Gradient();
faded.SetKeys(new[] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) },
col.color.gradient != null ? col.color.gradient.alphaKeys
: new[] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0f, 1f) });
col.color = new ParticleSystem.MinMaxGradient(faded);
}
}
// The shader decides whether a dark tint can show at all: an additive one adds
// 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}', " +
$"material '{(smokeMaterial != null ? smokeMaterial.name : "none")}', " +
$"shader '{(smokeMaterial != null && smokeMaterial.shader != null ? smokeMaterial.shader.name : "none")}'.");
return true;
}
}
/// <summary>
/// One player's burning skull. Cosmetic only - it deals nothing and blocks nothing.
///

View file

@ -203,7 +203,7 @@
"rov_msg_warvulture_vulture_spirals_down": "The vulture spirals down.",
"rov_msg_boneship_no_shore": "No shore in reach. They stay at the oars.",
"rov_msg_boneship_sunk": "The ship goes down, and $1 go with it.",
"rov_msg_skeleton_summon_on": "Summon on Kill: on. The dead will rise for you.",
"rov_msg_skeleton_summon_off": "Summon on Kill: off. The dead stay down.",
"rov_msg_skeleton_summon_on": "Thy dead shall rise again.",
"rov_msg_skeleton_summon_off": "Raising... nevermore.",
"rov_msg_skeleton_summon_locked": "Summon on Kill awakens once The Queen falls."
}

View file

@ -203,7 +203,7 @@
"rov_msg_warvulture_vulture_spirals_down": "L'avvoltoio scende a spirale.",
"rov_msg_boneship_no_shore": "Nessuna riva a portata. Restano ai remi.",
"rov_msg_boneship_sunk": "La nave affonda, e con lei $1.",
"rov_msg_skeleton_summon_on": "Evoca all'uccisione: attiva. I morti si alzeranno per te.",
"rov_msg_skeleton_summon_off": "Evoca all'uccisione: disattiva. I morti restano a terra.",
"rov_msg_skeleton_summon_on": "I tuoi morti risorgeranno ancora.",
"rov_msg_skeleton_summon_off": "Risorgere... mai più.",
"rov_msg_skeleton_summon_locked": "Evoca all'uccisione si risveglia quando cade la Regina."
}

View file

@ -203,7 +203,7 @@
"rov_msg_warvulture_vulture_spirals_down": "Стервятник кружит, спускаясь по спирали.",
"rov_msg_boneship_no_shore": "Берега не видно. Они остаются на веслах.",
"rov_msg_boneship_sunk": "Корабль идет ко дну, и $1 вместе с ним.",
"rov_msg_skeleton_summon_on": "Призыв при убийстве: включён. Мёртвые восстанут ради тебя.",
"rov_msg_skeleton_summon_off": "Призыв при убийстве: выключен. Мёртвые остаются лежать.",
"rov_msg_skeleton_summon_on": "Твои мёртвые вновь восстанут.",
"rov_msg_skeleton_summon_off": "Восстание... никогда более.",
"rov_msg_skeleton_summon_locked": "Призыв при убийстве пробудится, когда падёт Королева."
}

View file

@ -41,6 +41,7 @@ namespace RacesOfValheim
private GameObject m_fireAuraVFX = null;
private GameObject m_draughAuraVFX = null;
private readonly SkeletonVisuals.HeadFlame m_skeletonHeadFlame = new SkeletonVisuals.HeadFlame();
private readonly SkeletonVisuals.RaisingAura m_skeletonRaisingAura = new SkeletonVisuals.RaisingAura();
private void Awake()
{
@ -169,6 +170,7 @@ namespace RacesOfValheim
// 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, SkeletonConfig.HeadFireVFXEnabled.Value && SkeletonConfig.BodyModelEnabled.Value && SkeletonVisuals.GetModel(m_player, state) == SkeletonProgression.FireModel);
m_skeletonRaisingAura.Apply(m_player, SkeletonConfig.RaiseDeadAura.Value && nview.GetZDO().GetBool(SkeletonVisuals.RaisingZdoKey, false));
// Apply Scale
Vector3 targetScale = rules.ScaleMultiplier;
@ -273,6 +275,7 @@ namespace RacesOfValheim
SkeletonVisuals.EnsureFireAura(m_player, false, ref m_fireAuraVFX);
DraughVisuals.EnsureAura(m_player, false, ref m_draughAuraVFX);
m_skeletonHeadFlame.Apply(m_player, false);
m_skeletonRaisingAura.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);