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

@ -39,6 +39,7 @@ namespace RacesOfValheim
private string m_lastSkadiForm = "";
private GameObject m_currentFormInstance = null;
private GameObject m_fireAuraVFX = null;
private float m_lastFlightLog = 0f;
private void Awake()
{
@ -205,7 +206,31 @@ namespace RacesOfValheim
{
ZNetView nview = m_player.GetComponent<ZNetView>();
string currentForm = nview.GetZDO().GetString("RacesOfValheim_SkadiForm", "");
// Flight lives in Character.m_flying, which DrakeFormBehavior only ever sets on the
// flying player's own client. Observers left it false, so their copy of the character
// kept running grounded motion under gravity and sank to the terrain no matter what
// altitude was replicated. Mirror the flag from the ZDO so remote copies stay airborne.
bool flying = nview.GetZDO().GetBool(DrakeFormBehavior.FlyingKey, false);
HarmonyLib.Traverse.Create(m_player).Field("m_flying").SetValue(flying);
// Setting m_flying alone only helps if the remote copy runs Character motion at all.
// Gravity on its rigidbody is what actually drags the body to the terrain while the
// replicated position says otherwise, so switch that off directly for the duration.
Rigidbody body = m_player.GetComponent<Rigidbody>();
if (body != null && body.useGravity == flying)
{
body.useGravity = !flying;
}
if (Time.time - m_lastFlightLog > 2f)
{
m_lastFlightLog = Time.time;
Jotunn.Logger.LogInfo(
$"[SkadiSync] remote '{m_player.GetPlayerName()}' form='{currentForm}' flying={flying} " +
$"y={m_player.transform.position.y:F1} gravity={(body != null ? body.useGravity.ToString() : "no-body")}");
}
if (currentForm != m_lastSkadiForm)
{
// Form changed