feat(fenrir): eyes turn the Cultist's yellow when it is back from cooldown

The ready flag becomes an int: none, a form, or the Cultist. The Cultist
wins only while its rules give it a cooldown (Yagluth and Queen), since
that is the one return worth announcing. Its body shares the Fenring's
material and its breath is white flame tinted by texture, so the colour
comes from its death effect: FlameRoundYellowParticle's emission,
(2.691, 1.797, 0.455), bundle c4210710.
This commit is contained in:
kanym 2026-10-23 20:06:49 +02:00
commit c2bc73b3a0
3 changed files with 48 additions and 18 deletions

View file

@ -199,7 +199,7 @@ namespace RacesOfValheim
ReadyMessage = config.Bind(appearance, "Ready Message", true,
new ConfigDescription("Shows \"<form> is Ready!\" when a form's cooldown ends. The eyes say the same thing; turn this off if they are enough."));
EyeGlow = config.Bind(appearance, "Eye Glow", true,
new ConfigDescription("Fenrir eyes glow at night in the Fenring's own orange: faint while no form can be taken, bright when one can. Off hides them on every Fenrir you see."));
new ConfigDescription("Fenrir eyes glow at night in the Fenring's own orange: faint while no form can be taken, bright when one can, yellow when the Cultist is back from its cooldown. Off hides them on every Fenrir you see."));
// Above 0.5 so the red channel (2.0 x strength) passes 1 and the bloom pass picks it
// up: at 0.35 the faint state read as no glow at all.
EyeNightStrength = config.Bind(appearance, "Eye Night Strength", 0.6f,

View file

@ -150,7 +150,7 @@ namespace RacesOfValheim {
}
wasNight = isNight;
FenrirVisuals.SetReady(Player.m_localPlayer, CanTakeAnyForm());
FenrirVisuals.SetReady(Player.m_localPlayer, GetReadyState());
if (isTransformed)
{
@ -174,17 +174,26 @@ namespace RacesOfValheim {
}
/// <summary>
/// Whether one of the three keys would transform right now. The same gates as
/// TryTransformWithRules below, without its messages: this feeds the eye glow.
/// What the eyes should say right now, using the same gates as TryTransformWithRules
/// below without its messages. The Cultist wins over the other forms only while its rules
/// give it a cooldown: that is the one form whose return is worth announcing.
/// </summary>
private bool CanTakeAnyForm()
private FenrirVisuals.ReadyState GetReadyState()
{
if (isTransformed) return false;
if (isTransformed) return FenrirVisuals.ReadyState.None;
int state = BossProgressionManager.GetCurrentProgressionState();
return CanTake(FenrirProgression.GetGKeyRules(state))
FenrirProgression.FormRules cultist = FenrirProgression.GetJKeyRules(state);
if (CanTake(cultist) && cultist.CooldownMinutes > 0) return FenrirVisuals.ReadyState.Cultist;
if (CanTake(FenrirProgression.GetGKeyRules(state))
|| CanTake(FenrirProgression.GetHKeyRules(state))
|| CanTake(FenrirProgression.GetJKeyRules(state));
|| CanTake(cultist))
{
return FenrirVisuals.ReadyState.Form;
}
return FenrirVisuals.ReadyState.None;
}
private bool CanTake(FenrirProgression.FormRules rules)

View file

@ -7,7 +7,8 @@ namespace RacesOfValheim
{
/// <summary>
/// The Fenrir's eyes catch the light at night, the way a wolf's do: a faint glow while no form
/// can be taken, a bright one when a key would transform right now. Dark by day and while in a
/// can be taken, a bright one when a key would transform right now, and the Cultist's yellow
/// when that form is back from its cooldown. Dark by day and while in a
/// beast form, whose own eyes take over. A community suggestion (lexsonn), meant to say what
/// the "Ready!" text says without the text.
///
@ -26,6 +27,14 @@ namespace RacesOfValheim
{
public const string RaceId = "Fenrir";
public const string ReadyKey = "RacesOfValheim_FenrirReady";
/// <summary>Written to the ZDO as an int, so the values are part of the network contract.</summary>
public enum ReadyState
{
None = 0,
Form = 1,
Cultist = 2,
}
private const string FormKey = "RacesOfValheim_FenrirForm";
private const string EyesName = "FenrirEyes";
private const string SourceModel = "Skeleton";
@ -33,6 +42,11 @@ namespace RacesOfValheim
private static readonly Color FenringGlow = new Color(2.0f, 0.372f, 0f, 1f);
// The Cultist's body is the Fenring's material and its breath is white flame tinted by
// texture, so neither tells it apart. Its own death effect (vfx_fenring_cultist_death)
// does: FlameRoundYellowParticle's _EmissionColor, same bundle.
private static readonly Color CultistGlow = new Color(2.691f, 1.797f, 0.455f, 1f);
// AswidVisuals' base placement plus its Configuration Manager defaults, which are what
// playtesting settled on for this same pair of eyes on this same rig.
private const float EyeForward = 0.081f + 0.013f;
@ -43,13 +57,13 @@ namespace RacesOfValheim
private const float EyeRoll = -180f;
/// <summary>Owner only, and only on a change: one ZDO write per transition, not per frame.</summary>
public static void SetReady(Player player, bool ready)
public static void SetReady(Player player, ReadyState ready)
{
ZNetView nview = player != null ? player.GetComponent<ZNetView>() : null;
if (nview == null || !nview.IsValid() || !nview.IsOwner()) return;
ZDO zdo = nview.GetZDO();
if (zdo.GetBool(ReadyKey, false) != ready) zdo.Set(ReadyKey, ready);
if (zdo.GetInt(ReadyKey, 0) != (int)ready) zdo.Set(ReadyKey, (int)ready);
}
/// <summary>
@ -81,7 +95,7 @@ namespace RacesOfValheim
if (player.GetComponent<EyeTicker>() == null) player.gameObject.AddComponent<EyeTicker>();
float strength = GetGlowStrength(player);
float strength = GetGlowStrength(player, out Color hue);
if (strength <= 0f)
{
if (eyes != null && eyes.gameObject.activeSelf) eyes.gameObject.SetActive(false);
@ -98,12 +112,17 @@ namespace RacesOfValheim
}
if (!eyes.gameObject.activeSelf) eyes.gameObject.SetActive(true);
PaintEyes(eyes, FenringGlow * strength);
PaintEyes(eyes, hue * strength);
}
/// <summary>0 means dark: day, a beast form, or the viewer turned the glow off.</summary>
private static float GetGlowStrength(Player player)
/// <summary>
/// 0 means dark: day, a beast form, or the viewer turned the glow off. Otherwise faint
/// orange with nothing ready, bright orange with a form ready, bright yellow when the
/// Cultist is back from its cooldown.
/// </summary>
private static float GetGlowStrength(Player player, out Color hue)
{
hue = FenringGlow;
if (!FenrirConfig.EyeGlow.Value) return 0f;
if (EnvMan.instance == null || !EnvMan.IsNight()) return 0f;
@ -113,9 +132,11 @@ namespace RacesOfValheim
ZDO zdo = nview.GetZDO();
if (!string.IsNullOrEmpty(zdo.GetString(FormKey, ""))) return 0f;
return zdo.GetBool(ReadyKey, false)
? FenrirConfig.EyeReadyStrength.Value
: FenrirConfig.EyeNightStrength.Value;
ReadyState ready = (ReadyState)zdo.GetInt(ReadyKey, 0);
if (ready == ReadyState.None) return FenrirConfig.EyeNightStrength.Value;
if (ready == ReadyState.Cultist) hue = CultistGlow;
return FenrirConfig.EyeReadyStrength.Value;
}
public class EyeTicker : MonoBehaviour