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:
parent
2becb81b6f
commit
c2bc73b3a0
3 changed files with 48 additions and 18 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue