revert(skeleton): drop the Summon on Kill aura, keep the icon
Neither the Draugr's evil_smoke nor the torch smoke showed in game once tinted dark. The Raise the Dead icon stays, with its per-player switch.
This commit is contained in:
parent
3591b7e375
commit
e41f7b610e
4 changed files with 1 additions and 134 deletions
|
|
@ -47,7 +47,6 @@ namespace RacesOfValheim
|
|||
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)
|
||||
{
|
||||
|
|
@ -74,7 +73,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). While it is on, the Raise the Dead icon and a faint dark aura show it (see Skeleton - Visuals).");
|
||||
"Turns raising a skeleton from each kill on and off (The Queen and later). The Raise the Dead icon shows while it is on.");
|
||||
|
||||
const string resurrection = "Skeleton - Resurrection";
|
||||
ResurrectionCooldown = config.Bind(resurrection, "Cooldown", 300f,
|
||||
|
|
@ -87,8 +86,6 @@ namespace RacesOfValheim
|
|||
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."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,20 +108,6 @@ namespace RacesOfValheim
|
|||
|
||||
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)
|
||||
|
|
@ -355,8 +341,6 @@ 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,117 +434,6 @@ 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 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.
|
||||
///
|
||||
/// Held per player, like HeadFlame. Call Apply every frame; it builds once.
|
||||
/// </summary>
|
||||
public class RaisingAura
|
||||
{
|
||||
// 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;
|
||||
|
||||
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)
|
||||
{
|
||||
// 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 (torch != null)
|
||||
{
|
||||
foreach (ParticleSystem ps in torch.GetComponentsInChildren<ParticleSystem>(true))
|
||||
{
|
||||
if (ps.gameObject.name.ToLower().Contains("smoke")) { source = ps; break; }
|
||||
}
|
||||
}
|
||||
|
||||
if (source == null)
|
||||
{
|
||||
if (!warned)
|
||||
{
|
||||
warned = true;
|
||||
Jotunn.Logger.LogWarning("[Skeleton] No 'Smoke' particle on the torch; 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;
|
||||
|
||||
// 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)
|
||||
{
|
||||
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 '{torch.name}/{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.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ 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()
|
||||
{
|
||||
|
|
@ -170,7 +169,6 @@ 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;
|
||||
|
|
@ -275,7 +273,6 @@ 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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue