feat(dvergar): rename from Dvergur, and give it a lightning affinity

Rename covers the folder, all seven filenames and every identifier, status
effect name and display string. Valheim's own Dverger/dvergr prefab references
are untouched - the names never collided.

The race id is what sits in m_customData and the ZDO, so renaming it alone would
have handed every existing character the selection menu again. DvergarRace
migrates the old id on spawn, before anything else reads it.

Runic Spark is modelled on Skadi's Ice Affinity and deliberately shares its
shape: live from the base tier and growing a flat step per progression state, so
+2 at Base through +16 after Fader. Lightning rather than frost, and like
Skadi's it rides every blow rather than melee only. AddFlat gained the elemental
channels while it was there - lightning would otherwise have landed in generic
damage.

The Trol remote-sync trace fired on a two-second timer for as long as a remote
player existed, which in the main menu is forever: Player.m_localPlayer is null
there, so the character preview counts as remote and it never stopped. Keyed on
the state it reports instead, so it still catches a remote player being sized
wrongly without narrating an idle menu.
This commit is contained in:
kanym 2026-08-04 00:22:58 +02:00
commit 5febc588ea
12 changed files with 287 additions and 219 deletions

View file

@ -95,7 +95,12 @@ namespace RacesOfValheim
public const string StateKey = "RacesOfValheim_State";
public const string TrueFormKey = "RacesOfValheim_TrolTrueForm";
private static float lastRemoteLog = 0f;
// Remote sync tracing. It used to fire on a 2-second timer for as long as a remote player
// existed, which in the main menu means forever: Player.m_localPlayer is null there, so the
// character-preview player counts as remote and the log never stopped. Keyed on the state
// it reports instead, so it still catches a remote player being sized wrongly - the reason
// it exists - without narrating a menu that is doing nothing.
private static string lastRemoteLogKey = "";
private static float ScaleForState(int state)
{
@ -147,13 +152,17 @@ namespace RacesOfValheim
targetScale = state >= 7 ? 2.5f : 2.0f;
}
if (!isLocal && Time.time - lastRemoteLog > 2f)
if (!isLocal)
{
lastRemoteLog = Time.time;
Jotunn.Logger.LogInfo(
$"[TrolSync] remote '{__instance.GetPlayerName()}' race='{race}' zdoReady={zdoReady} " +
$"state={state} trueForm={isTrueFormActive} target={targetScale:F2} " +
$"currentScale={visual.transform.localScale.x:F2} rootScale={__instance.transform.localScale.x:F2}");
string logKey = $"{__instance.GetPlayerName()}|{race}|{zdoReady}|{state}|{isTrueFormActive}|{targetScale:F2}";
if (logKey != lastRemoteLogKey)
{
lastRemoteLogKey = logKey;
Jotunn.Logger.LogInfo(
$"[TrolSync] remote '{__instance.GetPlayerName()}' race='{race}' zdoReady={zdoReady} " +
$"state={state} trueForm={isTrueFormActive} target={targetScale:F2} " +
$"currentScale={visual.transform.localScale.x:F2} rootScale={__instance.transform.localScale.x:F2}");
}
}
if (race == "Trol")
@ -179,7 +188,7 @@ namespace RacesOfValheim
else if (!RaceScale.ManagesOwnScale(race) && Mathf.Abs(visual.transform.localScale.x - 1f) > 0.001f)
{
// Races that size themselves are left alone. Without this guard the reset fires on
// every frame for a Furling or a Dvergur too, undoing their scale as fast as they
// every frame for a Furling or a Dvergar too, undoing their scale as fast as they
// set it, because both are applied from a postfix on this same method.
visual.transform.localScale = Vector3.one;
}