RacesOfValheim/JotunnModStub/RaceScale.cs
Ferdinando d0ed92c553 feat(trenta): add the Trenta race
A vegan, tree-born race unlocking new perks per boss defeated: skin/hair
tint, blocked non-vegan food, awakened seed foods after Eikthyr, a mob
hostility list, Photosynthesis, elemental resistances, Purple Rain after
the Elder, swim/poison/wet immunity after Bonemass, Last Stand and Thorns
after Moder, a Homecoming Portal after Yagluth, Hornet's Nest after the
Queen, and Muspell (a half-size Elder transformation with Stomp/Spike
attacks) after Fader.

Also fixes RaceScale never listing Trenta as self-sizing, which let a
shared Player.Update postfix fight Muspell's own scale changes every
frame.
2026-08-04 20:58:01 +02:00

36 lines
1.3 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
};
public static bool ManagesOwnScale(string race)
{
if (string.IsNullOrEmpty(race)) return false;
foreach (string self in SelfSizingRaces)
{
if (race == self) return true;
}
return false;
}
}
}