RacesOfValheim/JotunnModStub/RaceScale.cs
Ferdinando 3f8cf1ee27 feat(alfar): v1.6.0 - the Alfar, an eleventh race
Grey, tall and thin, with black eyes. Eitr is armour and fuel (shield,
diet, soft fall, levitation), Heimkall sends a lethal blow home at one
health every 20 minutes. Caster powers from Skrid to the archon
Sameining, with on-screen cooldowns. Automated base around the
Ljoskjarne: drones, three constructs, crystals, Ljosgard, Prismavard.
Compendium page in EN/IT/RU.

README: New in block, race section, progression, station line, changelog.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 17:38:28 +01:00

43 lines
1.8 KiB
C#

namespace RacesOfValheim
{
/// <summary>
/// Which races size their own body.
///
/// Several races postfix Player.Update and set the player's "Visual" scale from there. Each of
/// them also wants to undo that scale once the player is no longer of their race, and the
/// straightforward way to write that - "if this isn't my race, force the scale back to 1" -
/// makes every such race stamp on every other one, with the winner decided by whichever
/// postfix Harmony happened to run last.
///
/// That is what left the Dvergar at full height: Trol's reset ran on the same frame and put it
/// straight back to 1. Asking here first means a race only ever resets a player that nobody
/// else is sizing.
/// </summary>
public static class RaceScale
{
private static readonly string[] SelfSizingRaces =
{
"Trol",
"Furling",
DvergarConfig.RaceId,
TrentaConfig.RaceId,
// The Alfar are 5% taller and a little thinner: a non-uniform scale on the Visual.
AlfarConfig.RaceId,
// Sverm sizes itself only from the Queen on (Surrenal Glands, +10%). It is listed here
// for every tier all the same: below that tier its own ApplyScale asks for 1, which is
// the same answer another race's reset would give, and being on the list is what stops
// those resets from fighting it once the +10% does arrive.
SvermConfig.RaceId
};
public static bool ManagesOwnScale(string race)
{
if (string.IsNullOrEmpty(race)) return false;
foreach (string self in SelfSizingRaces)
{
if (race == self) return true;
}
return false;
}
}
}