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:
parent
53f6fb71a2
commit
98b1a1b5f3
7 changed files with 143 additions and 8 deletions
|
|
@ -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."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
///
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue