Add the Race Menu Ward; WIP on remote Trol/Skadi visuals

Race Menu Ward: a buildable ward (2 wood, hammer/Misc, no crafting station)
that manages your race outside the debug console - reset the race, switch
between the server's boss progression and your own, and advance that personal
progression by offering a boss's secondary drop to it. One is placed near the
sacrificial stones on first load of a world, by the host only.

BossProgressionManager grows a personal mode alongside the world one. The tier
is stored on the character rather than the world, so a personal tier travels
with the player between servers instead of being tied to whichever world
unlocked it. resetrace and the ward now share RacesOfValheim.ResetRace so both
paths clean up identical state.

Also in progress, and NOT yet working: remote Trol sizing and remote Skadi
flight. Both are computed from the observer instead of the observed -

- Remote Trols are scaled from the observing player's own progression, and
  never show True Form, because SE_TrolTrueForm only exists on the transformed
  player's client. Each Trol now publishes its state and True Form flag onto
  its own ZDO for others to read.
- Remote Skadi dragons sink to the terrain regardless of the altitude being
  replicated: Character.m_flying is only ever set on the flying player's
  client, so observers run grounded motion under gravity. Flight is mirrored
  through the ZDO and the remote copy's rigidbody gravity is disabled while it
  lasts.

Neither has fixed the symptom yet, so both paths keep a throttled diagnostic
log reporting what each observer actually computes. Committed to get the
instrumentation onto the branch, not because it works.

Packaging no longer hardcodes another machine's desktop path: Thunderstore and
Nexus zips go to dist/ on Release builds only, and the DLL is copied into
Valheim only when VALHEIM_INSTALL actually points at a plugins folder.
This commit is contained in:
kanym 2026-08-02 08:45:47 +02:00
commit 5350ebda5d
7 changed files with 636 additions and 76 deletions

View file

@ -1,4 +1,4 @@
using UnityEngine;
using UnityEngine;
using System.Collections;
using Jotunn.Managers;
@ -17,6 +17,17 @@ namespace RacesOfValheim
public bool IsFlying => isFlying;
// Read by RacesVisualController on other clients so they can keep this character airborne.
public const string FlyingKey = "RacesOfValheim_SkadiFlying";
private void SetFlying(bool value)
{
HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_flying").SetValue(value);
ZNetView nview = Player.m_localPlayer.GetComponent<ZNetView>();
if (nview != null && nview.IsValid()) nview.GetZDO().Set(FlyingKey, value);
}
// Time.time of the last powered/grounded moment. SkadiDirectedFlightPatch holds the form
// level for a short window past this before letting it start sinking.
public float LastPoweredTime;
@ -74,7 +85,7 @@ namespace RacesOfValheim
anim = GetComponentInChildren<Animator>();
if (Player.m_localPlayer != null)
{
HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_flying").SetValue(false);
SetFlying(false);
}
}
@ -89,13 +100,13 @@ namespace RacesOfValheim
{
isFlying = true;
LastPoweredTime = Time.time;
HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_flying").SetValue(true);
SetFlying(true);
}
else if (isFlying && !isLanding)
{
isLanding = true;
isFlying = false;
HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_flying").SetValue(false);
SetFlying(false);
}
else if (isLanding)
{
@ -103,7 +114,7 @@ namespace RacesOfValheim
isLanding = false;
isFlying = true;
LastPoweredTime = Time.time;
HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_flying").SetValue(true);
SetFlying(true);
}
}
@ -494,7 +505,7 @@ namespace RacesOfValheim
if (Active == this) Active = null;
if (Player.m_localPlayer != null)
{
HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_flying").SetValue(false);
SetFlying(false);
}
}
}