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:
parent
8906abfd79
commit
5350ebda5d
7 changed files with 636 additions and 76 deletions
|
|
@ -16,6 +16,85 @@ namespace RacesOfValheim
|
|||
public const string TheQueen = "defeated_queen";
|
||||
public const string Fader = "defeated_fader";
|
||||
|
||||
public const int MinState = 1;
|
||||
public const int MaxState = 8;
|
||||
|
||||
// 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.
|
||||
private const string PersonalStateKey = "RacesOfValheim_PersonalState";
|
||||
private const string PersonalModeKey = "RacesOfValheim_PersonalMode";
|
||||
|
||||
/// <summary>
|
||||
/// Boss secondary drops, and the progression state each one unlocks when offered to the
|
||||
/// Race Menu Ward. Keyed by prefab name, which is what the item stack carries.
|
||||
/// </summary>
|
||||
public static readonly Dictionary<string, int> BossDropStates = new Dictionary<string, int>
|
||||
{
|
||||
{ "HardAntler", 2 }, // Eikthyr
|
||||
{ "CryptKey", 3 }, // The Elder
|
||||
{ "Wishbone", 4 }, // Bonemass
|
||||
{ "DragonTear", 5 }, // Moder
|
||||
{ "YagluthDrop", 6 }, // Yagluth
|
||||
{ "QueenDrop", 7 }, // The Queen - Majestic carapace
|
||||
{ "FaderDrop", 8 } // Fader - Fader relic
|
||||
};
|
||||
|
||||
public static string GetBossNameForState(int state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case 2: return "Eikthyr";
|
||||
case 3: return "The Elder";
|
||||
case 4: return "Bonemass";
|
||||
case 5: return "Moder";
|
||||
case 6: return "Yagluth";
|
||||
case 7: return "The Queen";
|
||||
case 8: return "Fader";
|
||||
default: return "No bosses";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True when the player has chosen to advance on their own unlocks rather than on whatever
|
||||
/// the server has already killed.
|
||||
/// </summary>
|
||||
public static bool UsePersonalProgression
|
||||
{
|
||||
get
|
||||
{
|
||||
Player player = Player.m_localPlayer;
|
||||
if (player == null || player.m_customData == null) return false;
|
||||
return player.m_customData.TryGetValue(PersonalModeKey, out string value) && value == "true";
|
||||
}
|
||||
set
|
||||
{
|
||||
Player player = Player.m_localPlayer;
|
||||
if (player == null || player.m_customData == null) return;
|
||||
player.m_customData[PersonalModeKey] = value ? "true" : "false";
|
||||
}
|
||||
}
|
||||
|
||||
public static int PersonalState
|
||||
{
|
||||
get
|
||||
{
|
||||
Player player = Player.m_localPlayer;
|
||||
if (player == null || player.m_customData == null) return MinState;
|
||||
if (player.m_customData.TryGetValue(PersonalStateKey, out string value) &&
|
||||
int.TryParse(value, out int state))
|
||||
{
|
||||
return UnityEngine.Mathf.Clamp(state, MinState, MaxState);
|
||||
}
|
||||
return MinState;
|
||||
}
|
||||
set
|
||||
{
|
||||
Player player = Player.m_localPlayer;
|
||||
if (player == null || player.m_customData == null) return;
|
||||
player.m_customData[PersonalStateKey] = UnityEngine.Mathf.Clamp(value, MinState, MaxState).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the current progression state of the world based on defeated bosses.
|
||||
/// 1 = No bosses defeated
|
||||
|
|
@ -27,13 +106,11 @@ namespace RacesOfValheim
|
|||
/// 7 = The Queen defeated
|
||||
/// 8 = Fader defeated
|
||||
/// </summary>
|
||||
public static int GetCurrentProgressionState()
|
||||
public static int GetWorldProgressionState()
|
||||
{
|
||||
if (DebugState != -1) return DebugState; // [DEBUG]
|
||||
|
||||
if (ZoneSystem.instance == null)
|
||||
{
|
||||
return 1; // Default to 1 if ZoneSystem isn't ready
|
||||
return MinState; // Default to 1 if ZoneSystem isn't ready
|
||||
}
|
||||
|
||||
// We check in reverse order (highest tier first)
|
||||
|
|
@ -45,7 +122,16 @@ namespace RacesOfValheim
|
|||
if (ZoneSystem.instance.GetGlobalKey(TheElder)) return 3;
|
||||
if (ZoneSystem.instance.GetGlobalKey(Eikthyr)) return 2;
|
||||
|
||||
return 1; // No bosses defeated
|
||||
return MinState; // No bosses defeated
|
||||
}
|
||||
|
||||
public static int GetCurrentProgressionState()
|
||||
{
|
||||
if (DebugState != -1) return DebugState; // [DEBUG]
|
||||
|
||||
if (UsePersonalProgression) return PersonalState;
|
||||
|
||||
return GetWorldProgressionState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue