Merge branch 'main' into localisation
This commit is contained in:
commit
bf63b790f1
19 changed files with 434 additions and 60 deletions
|
|
@ -463,7 +463,7 @@ namespace RacesOfValheim
|
|||
if (EnvMan.instance != null && EnvMan.IsDay() && !isTransformingSequence &&
|
||||
Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_MistForm".GetStableHashCode()))
|
||||
{
|
||||
StartCoroutine(RevertMistFormRoutine());
|
||||
RunFormRoutine(RevertMistFormRoutine());
|
||||
}
|
||||
|
||||
// Same rule for a night-only bat: a form the sun forbids cannot be kept through the
|
||||
|
|
@ -474,7 +474,7 @@ namespace RacesOfValheim
|
|||
EnvMan.instance != null && EnvMan.IsDay())
|
||||
{
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_aswid_morning_sun_drives_bat_back"));
|
||||
StartCoroutine(RevertToHumanRoutine());
|
||||
RunFormRoutine(RevertToHumanRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -565,7 +565,7 @@ namespace RacesOfValheim
|
|||
|
||||
if (IsTransformed)
|
||||
{
|
||||
StartCoroutine(RevertToHumanRoutine());
|
||||
RunFormRoutine(RevertToHumanRoutine());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -580,18 +580,73 @@ namespace RacesOfValheim
|
|||
return;
|
||||
}
|
||||
|
||||
StartCoroutine(TransformIntoBatRoutine(rules));
|
||||
RunFormRoutine(TransformIntoBatRoutine(rules));
|
||||
}
|
||||
|
||||
// The one bat or mist routine in flight, if any. Kept so ResetRace can stop it: a
|
||||
// TransformIntoBatRoutine left running through a reset finishes its 1.1s gesture and
|
||||
// turns a freshly reset Human into a bat.
|
||||
private Coroutine formRoutine;
|
||||
|
||||
private void RunFormRoutine(System.Collections.IEnumerator routine)
|
||||
{
|
||||
formRoutine = StartCoroutine(routine);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Drops bat and mist form on the spot for ResetRace: no puff, no tween, nothing left
|
||||
/// running. ForceRevert is no use there - it skips a form that is still mid-gesture, and
|
||||
/// its coroutine would still be shrinking the body back after the reset has finished.
|
||||
/// </summary>
|
||||
/// <returns>True if there was a form to drop.</returns>
|
||||
public bool HardResetForReset()
|
||||
{
|
||||
Player player = Player.m_localPlayer;
|
||||
if (player == null) return false;
|
||||
|
||||
if (formRoutine != null)
|
||||
{
|
||||
StopCoroutine(formRoutine);
|
||||
formRoutine = null;
|
||||
}
|
||||
|
||||
bool hadMist = mistTransformation != null || player.GetSEMan().HaveStatusEffect("SE_MistForm".GetStableHashCode());
|
||||
bool hadBat = IsTransformed || isTransformingSequence;
|
||||
|
||||
// Also clears isTransformingSequence and puts the transform back to scale 1, which
|
||||
// covers a reset caught halfway through the bat's shrink.
|
||||
HardResetBatForm();
|
||||
|
||||
if (hadMist)
|
||||
{
|
||||
if (mistTransformation != null)
|
||||
{
|
||||
Destroy(mistTransformation);
|
||||
mistTransformation = null;
|
||||
}
|
||||
|
||||
Transform playerVisual = player.transform.Find("Visual");
|
||||
PlayerVisualHider.Show(playerVisual, "aswid-reset-mist");
|
||||
if (playerVisual != null) playerVisual.localScale = Vector3.one;
|
||||
|
||||
player.GetSEMan().RemoveStatusEffect("SE_MistForm".GetStableHashCode(), true);
|
||||
ZNetView nview = player.GetComponent<ZNetView>();
|
||||
if (nview != null && nview.IsValid()) nview.GetZDO().Set("Aswid_IsMistForm", false);
|
||||
}
|
||||
|
||||
isTransformingSequence = false;
|
||||
return hadBat || hadMist;
|
||||
}
|
||||
|
||||
public void ForceRevert()
|
||||
{
|
||||
if (IsTransformed && !isTransformingSequence)
|
||||
{
|
||||
StartCoroutine(RevertToHumanRoutine());
|
||||
RunFormRoutine(RevertToHumanRoutine());
|
||||
}
|
||||
if (Player.m_localPlayer != null && Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_MistForm".GetStableHashCode()) && !isTransformingSequence)
|
||||
{
|
||||
StartCoroutine(RevertMistFormRoutine());
|
||||
RunFormRoutine(RevertMistFormRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -745,11 +800,11 @@ namespace RacesOfValheim
|
|||
|
||||
if (Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_MistForm".GetStableHashCode()))
|
||||
{
|
||||
StartCoroutine(RevertMistFormRoutine());
|
||||
RunFormRoutine(RevertMistFormRoutine());
|
||||
}
|
||||
else
|
||||
{
|
||||
StartCoroutine(TransformIntoMistRoutine());
|
||||
RunFormRoutine(TransformIntoMistRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ namespace RacesOfValheim
|
|||
"Skeleton - Visuals",
|
||||
"Sverm - Dorsal Spines",
|
||||
"Sverm - Emberform",
|
||||
"Trol - Appearance",
|
||||
"War Vulture - Model",
|
||||
"War Vulture - Interface",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ namespace RacesOfValheim {
|
|||
|
||||
if (isTransformed)
|
||||
{
|
||||
StartCoroutine(RevertToHumanRoutine());
|
||||
RunFormRoutine(RevertToHumanRoutine());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -213,7 +213,7 @@ namespace RacesOfValheim {
|
|||
}
|
||||
}
|
||||
|
||||
StartCoroutine(TransformIntoWolfRoutine(rules));
|
||||
RunFormRoutine(TransformIntoWolfRoutine(rules));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -256,11 +256,63 @@ namespace RacesOfValheim {
|
|||
return "$rov_msg_fenrir_formname_fenrir";
|
||||
}
|
||||
|
||||
// The one transform or revert routine in flight, if any, so ResetRace can stop it. A
|
||||
// revert left to finish on its own lands its cooldown after the reset has already swept
|
||||
// the status effects, and the next Fenrir starts locked out.
|
||||
private Coroutine formRoutine;
|
||||
|
||||
private void RunFormRoutine(IEnumerator routine)
|
||||
{
|
||||
formRoutine = StartCoroutine(routine);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Drops whatever form is up, immediately, for ResetRace: no poof, no message, and no
|
||||
/// cooldown - ExecuteReversion hands one out, which is right for a form running out and
|
||||
/// wrong for a player leaving the race.
|
||||
/// </summary>
|
||||
/// <returns>True if there was a form to drop.</returns>
|
||||
public bool HardResetForReset()
|
||||
{
|
||||
Player player = Player.m_localPlayer;
|
||||
if (player == null) return false;
|
||||
|
||||
if (formRoutine != null)
|
||||
{
|
||||
StopCoroutine(formRoutine);
|
||||
formRoutine = null;
|
||||
}
|
||||
|
||||
bool hadForm = isTransformed || isTransformingSequence || currentTransformation != null;
|
||||
if (hadForm)
|
||||
{
|
||||
if (currentTransformation != null) Destroy(currentTransformation);
|
||||
currentTransformation = null;
|
||||
DestroyAllForms();
|
||||
|
||||
ZNetView nview = player.GetComponent<ZNetView>();
|
||||
if (nview != null && nview.IsValid()) nview.GetZDO().Set("RacesOfValheim_FenrirForm", "");
|
||||
|
||||
PlayerVisualHider.Show(player.transform.Find("Visual"), "fenrir-reset");
|
||||
|
||||
player.GetSEMan().RemoveStatusEffect("SE_FenrirForm".GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect("SE_CultistForm".GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect("SE_WolfForm".GetStableHashCode());
|
||||
}
|
||||
|
||||
isTransformed = false;
|
||||
isTransformingSequence = false;
|
||||
activeRules = null;
|
||||
revertMessage = null;
|
||||
sunSicknessTimer = 0f;
|
||||
return hadForm;
|
||||
}
|
||||
|
||||
public void ForceRevert()
|
||||
{
|
||||
if (isTransformed && !isTransformingSequence)
|
||||
{
|
||||
StartCoroutine(RevertToHumanRoutine());
|
||||
RunFormRoutine(RevertToHumanRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "RacesOfValheim",
|
||||
"description": "A Valheim mod that adds ten custom playable races (Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Sverm, Trenta, Trol) each with unique abilities, traits, race stations and a deep boss-driven progression system.",
|
||||
"version_number": "1.5.9",
|
||||
"version_number": "1.5.10",
|
||||
"website_url": "",
|
||||
"dependencies": [
|
||||
"denikson-BepInExPack_Valheim-5.4.2333",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using HarmonyLib;
|
|||
using Jotunn.Configs;
|
||||
using Jotunn.Entities;
|
||||
using Jotunn.Managers;
|
||||
using Jotunn.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI; // Added for UI
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ namespace RacesOfValheim
|
|||
{
|
||||
public const string PluginGUID = "com.nandor.racesofvalheim";
|
||||
public const string PluginName = "Races Of Valheim";
|
||||
public const string PluginVersion = "1.5.9";
|
||||
public const string PluginVersion = "1.5.10";
|
||||
|
||||
private readonly Harmony harmony = new Harmony(PluginGUID);
|
||||
|
||||
|
|
@ -99,6 +100,20 @@ namespace RacesOfValheim
|
|||
Player player = Player.m_localPlayer;
|
||||
if (player == null) return;
|
||||
|
||||
// What the reset actually took off, printed at the end so it can be read in the console.
|
||||
var removed = new System.Collections.Generic.List<string>();
|
||||
|
||||
// Forms first, before any status effect goes. Taking a form's effect away without
|
||||
// undoing the form leaves the body hidden (bat, mist, drake, wolf, Muspell, Ravager)
|
||||
// or oversized (True Form), and several races only ever look at their form from an
|
||||
// Update that returns early for anyone who is not of that race any more.
|
||||
if (AswidRace.Instance != null && AswidRace.Instance.HardResetForReset()) removed.Add("form: Aswid bat/mist");
|
||||
if (FenrirRace.Instance != null && FenrirRace.Instance.HardResetForReset()) removed.Add("form: Fenrir");
|
||||
if (SkadiRace.Instance != null && SkadiRace.Instance.HardResetForReset()) removed.Add("form: Skadi drake");
|
||||
if (TrolRace.Instance != null && TrolRace.Instance.HardResetForReset()) removed.Add("form: Trol True Form");
|
||||
if (TrentaMuspell.HardResetForReset(player)) removed.Add("form: Trenta Muspell");
|
||||
if (SvermRavagerForm.HardResetForReset(player)) removed.Add("form: Sverm Ravager");
|
||||
|
||||
RemovePermanentRaceEquipment(player);
|
||||
|
||||
player.m_customData.Remove("Race");
|
||||
|
|
@ -120,21 +135,23 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
|
||||
player.GetSEMan().RemoveStatusEffect("SE_FenrirCurse".GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect("SE_AswidStats".GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect("SE_SkeletonStats".GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect("SE_SkadiStats".GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect("SE_SkadiCooldown".GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect(DvergarConfig.StatsSE.GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect(DvergarConfig.OverchargeSE.GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect(DvergarConfig.OverchargeCdSE.GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect(DvergarConfig.RunicPingCdSE.GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect(TrentaConfig.StatsSE.GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect(TrentaConfig.PurpleRainCdSE.GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect(TrentaConfig.PortalCdSE.GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect(SvermConfig.StatsSE.GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect(SvermConfig.RavagerSE.GetStableHashCode());
|
||||
player.GetSEMan().RemoveStatusEffect(SvermConfig.RavagerCdSE.GetStableHashCode());
|
||||
// Every status effect this mod registers, rather than a list kept by hand: the hand
|
||||
// list was missing the True Form and both of its cooldowns, Bat and Mist Form, the
|
||||
// Skeleton's resurrect cooldown and most of Skadi's, and the next effect anyone adds
|
||||
// would have been missing too. The forms were dropped above, so taking their effects
|
||||
// away here no longer leaves a body hidden or blown up.
|
||||
SEMan seman = player.GetSEMan();
|
||||
foreach (CustomStatusEffect custom in ModRegistry.GetStatusEffects(PluginGUID))
|
||||
{
|
||||
StatusEffect se = custom?.StatusEffect;
|
||||
if (se == null) continue;
|
||||
|
||||
int hash = se.name.GetStableHashCode();
|
||||
if (!seman.HaveStatusEffect(hash)) continue;
|
||||
|
||||
seman.RemoveStatusEffect(hash, true);
|
||||
removed.Add(se.name);
|
||||
}
|
||||
|
||||
// COLD, which is not one of ours at all - and that is exactly why it has to go.
|
||||
//
|
||||
|
|
@ -161,9 +178,21 @@ namespace RacesOfValheim
|
|||
// Only after the ZDO above already says "Human" - see the class doc comment.
|
||||
RaceItemCleanup.PurgeForeignRaceItems(player);
|
||||
|
||||
// Normal size. The Trol, the Skeleton past Fader and the self-sizing races all scale
|
||||
// either the player or its Visual, and each puts its own size back only from code that
|
||||
// may not run again now the race has changed. The next race sets its own size anyway.
|
||||
player.transform.localScale = Vector3.one;
|
||||
GameObject visual = Traverse.Create(player).Field("m_visual").GetValue<GameObject>();
|
||||
if (visual != null) visual.transform.localScale = Vector3.one;
|
||||
|
||||
string summary = removed.Count == 0
|
||||
? "[ResetRace] Nothing race-specific was left on the player."
|
||||
: "[ResetRace] Removed: " + string.Join(", ", removed);
|
||||
Jotunn.Logger.LogInfo(summary);
|
||||
if (Console.instance != null) Console.instance.Print(summary);
|
||||
|
||||
if (Instance != null)
|
||||
{
|
||||
if (FenrirRace.Instance != null) FenrirRace.Instance.ForceRevert();
|
||||
Instance.ShowRaceSelectionMenu();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ namespace RacesOfValheim
|
|||
{
|
||||
formExpireTime = 0f;
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_skadi_dragon_form_fades"));
|
||||
StartCoroutine(RevertToHumanRoutine());
|
||||
RunFormRoutine(RevertToHumanRoutine());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -687,7 +687,7 @@ namespace RacesOfValheim
|
|||
|
||||
if (isTransformed)
|
||||
{
|
||||
StartCoroutine(RevertToHumanRoutine());
|
||||
RunFormRoutine(RevertToHumanRoutine());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -707,7 +707,7 @@ namespace RacesOfValheim
|
|||
}
|
||||
|
||||
activeRules = rules;
|
||||
StartCoroutine(TransformRoutine(rules));
|
||||
RunFormRoutine(TransformRoutine(rules));
|
||||
}
|
||||
|
||||
private Vector3 GetFormScale(SkadiProgression.FormType form)
|
||||
|
|
@ -914,6 +914,57 @@ namespace RacesOfValheim
|
|||
if (se != null) se.m_ttl = seconds;
|
||||
}
|
||||
|
||||
// The one transform or revert routine in flight, if any, so ResetRace can stop it.
|
||||
private Coroutine formRoutine;
|
||||
|
||||
private void RunFormRoutine(System.Collections.IEnumerator routine)
|
||||
{
|
||||
formRoutine = StartCoroutine(routine);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Drops the drake form on the spot for ResetRace. Update bails out on its first line for
|
||||
/// anyone who is not a Skadi, so once the race changes nothing in this class ever looks at
|
||||
/// the form again - a Skadi reset in drake form stayed a drake for good. No message and no
|
||||
/// cooldown here, unlike ExecuteReversion.
|
||||
/// </summary>
|
||||
/// <returns>True if there was a form to drop.</returns>
|
||||
public bool HardResetForReset()
|
||||
{
|
||||
Player player = Player.m_localPlayer;
|
||||
if (player == null) return false;
|
||||
|
||||
if (formRoutine != null)
|
||||
{
|
||||
StopCoroutine(formRoutine);
|
||||
formRoutine = null;
|
||||
}
|
||||
|
||||
bool hadForm = isTransformed || isTransformingSequence || currentTransformation != null;
|
||||
if (hadForm)
|
||||
{
|
||||
if (currentTransformation != null) Destroy(currentTransformation);
|
||||
currentTransformation = null;
|
||||
foreach (var f in player.GetComponentsInChildren<DrakeFormBehavior>(true)) Destroy(f.gameObject);
|
||||
|
||||
ZNetView nview = player.GetComponent<ZNetView>();
|
||||
if (nview != null && nview.IsValid())
|
||||
{
|
||||
nview.GetZDO().Set("Skadi_Form", "");
|
||||
nview.GetZDO().Set("RacesOfValheim_SkadiForm", "");
|
||||
}
|
||||
|
||||
PlayerVisualHider.Show(player.transform.Find("Visual"), "skadi-reset");
|
||||
player.GetSEMan().RemoveStatusEffect("SE_SkadiForm".GetStableHashCode(), true);
|
||||
}
|
||||
|
||||
isTransformed = false;
|
||||
isTransformingSequence = false;
|
||||
formExpireTime = 0f;
|
||||
activeRules = null;
|
||||
return hadForm;
|
||||
}
|
||||
|
||||
private void ExecuteReversion()
|
||||
{
|
||||
Transform playerVisual = Player.m_localPlayer.transform.Find("Visual");
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ namespace RacesOfValheim
|
|||
|
||||
// ─── Visuals ───────────────────────────────────────────────────────────
|
||||
public static ConfigEntry<bool> HeadFireVFXEnabled;
|
||||
public static ConfigEntry<bool> BodyModelEnabled;
|
||||
|
||||
public static void Bind(ConfigFile config)
|
||||
{
|
||||
|
|
@ -71,6 +72,8 @@ namespace RacesOfValheim
|
|||
const string visuals = "Skeleton - Visuals";
|
||||
HeadFireVFXEnabled = config.Bind(visuals, "Head Fire VFX Enabled", true,
|
||||
new ConfigDescription("Whether the burning-skull effect (worn from tier 5+) renders at all. A client-side preference: disabling it stops you from seeing it on yourself and on every other skeleton you look at, but does not change what other players see."));
|
||||
BodyModelEnabled = config.Bind(visuals, "Body Model Enabled", true,
|
||||
new ConfigDescription("Whether Skeleton players wear the skeleton body. Turn it off if you use a player model mod (EnhancedValheimVRM and the like): Skeletons then keep the vanilla viking body, so the replacement model shows without bones clipping through it. Abilities are unchanged. Client-side, like the option above: it applies to every Skeleton you see, yourself included, and changes nothing for other players."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,10 +62,11 @@ namespace RacesOfValheim
|
|||
Transform jaw = ResolveJaw();
|
||||
if (jaw == null || jaw.parent == null) return;
|
||||
|
||||
if (!SkeletonVisuals.IsSkeletonPlayer(m_player))
|
||||
if (!SkeletonVisuals.ShowsSkeletonBody(m_player))
|
||||
{
|
||||
// Nothing rewrites this bone on its own, so a player who stops being a Skeleton
|
||||
// would otherwise keep wearing the correction on their human face.
|
||||
// (or switches the skeleton body off) would otherwise keep wearing the correction
|
||||
// on their human face.
|
||||
if (m_applied)
|
||||
{
|
||||
jaw.localPosition = m_baseLocalPosition;
|
||||
|
|
|
|||
|
|
@ -254,7 +254,9 @@ namespace RacesOfValheim
|
|||
// before it could find out it was looking at a Skeleton.
|
||||
string race = SkeletonVisuals.GetPlayerRace(p);
|
||||
|
||||
if (race == SkeletonVisuals.RaceId)
|
||||
// With "Body Model Enabled" off a Skeleton takes the human branch below, the same
|
||||
// as any other race, so the toggle also works live: the next refresh swaps back.
|
||||
if (race == SkeletonVisuals.RaceId && SkeletonConfig.BodyModelEnabled.Value)
|
||||
{
|
||||
if (__instance.m_bodyModel != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -323,9 +323,13 @@ namespace RacesOfValheim
|
|||
VisEquipment currentVis = Player.m_localPlayer.GetComponent<VisEquipment>();
|
||||
if (currentVis != null)
|
||||
{
|
||||
// Hide Helmets (Valheim uses singular GameObject for helmet)
|
||||
var helmetObj = HarmonyLib.Traverse.Create(currentVis).Field<GameObject>("m_helmetItemInstance").Value;
|
||||
SkeletonVisuals.SetEquipmentPieceHidden(helmetObj, true);
|
||||
// Hide Helmets (Valheim uses singular GameObject for helmet). Only over a skull:
|
||||
// a viking body wears its helmet, and the VisEquipment postfix puts it back.
|
||||
if (SkeletonConfig.BodyModelEnabled.Value)
|
||||
{
|
||||
var helmetObj = HarmonyLib.Traverse.Create(currentVis).Field<GameObject>("m_helmetItemInstance").Value;
|
||||
SkeletonVisuals.SetEquipmentPieceHidden(helmetObj, true);
|
||||
}
|
||||
|
||||
// Scale Body Armor (Chest, Legs, Shoulder) by 5%
|
||||
string[] armorFields = { "m_chestItemInstances", "m_legItemInstances", "m_shoulderItemInstances" };
|
||||
|
|
@ -440,7 +444,7 @@ namespace RacesOfValheim
|
|||
}
|
||||
|
||||
// Flames on the skull, worn with the fire-tier model and nothing else.
|
||||
headFlame.Apply(Player.m_localPlayer, SkeletonConfig.HeadFireVFXEnabled.Value && SkeletonVisuals.GetModel(Player.m_localPlayer, state) == SkeletonProgression.FireModel);
|
||||
headFlame.Apply(Player.m_localPlayer, SkeletonConfig.HeadFireVFXEnabled.Value && SkeletonConfig.BodyModelEnabled.Value && SkeletonVisuals.GetModel(Player.m_localPlayer, state) == SkeletonProgression.FireModel);
|
||||
|
||||
if (rules.FireAura)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,6 +49,16 @@ namespace RacesOfValheim
|
|||
|
||||
public static bool IsSkeletonPlayer(Player player) => GetPlayerRace(player) == RaceId;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this client draws the skeleton's bones on this player. False for every
|
||||
/// non-Skeleton, and for every Skeleton when "Body Model Enabled" is off: model-replacement
|
||||
/// mods (EnhancedValheimVRM and the like) hide the vanilla body and draw their own, so the
|
||||
/// borrowed bones ended up floating around the replacement model. With the option off the
|
||||
/// Skeleton keeps every ability and only looks like a plain viking.
|
||||
/// </summary>
|
||||
public static bool ShowsSkeletonBody(Player player) =>
|
||||
SkeletonConfig.BodyModelEnabled.Value && IsSkeletonPlayer(player);
|
||||
|
||||
/// <summary>
|
||||
/// Fully hides (or restores) one equipped item instance - a helmet, typically.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ namespace RacesOfValheim
|
|||
|
||||
if (SvermRace.Instance != null)
|
||||
{
|
||||
SvermRace.Instance.StartCoroutine(EnterRoutine(player));
|
||||
formRoutine = SvermRace.Instance.StartCoroutine(EnterRoutine(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -342,12 +342,42 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
|
||||
// The enter or exit routine in flight, if any, so ResetRace can stop it. An ExitRoutine
|
||||
// left running finishes with Exit(spendCooldown: true), which puts the cooldown back on
|
||||
// after the reset has swept it.
|
||||
private static Coroutine formRoutine;
|
||||
|
||||
/// <summary>
|
||||
/// Drops Ravager Strain on the spot for ResetRace, and forgets its cooldown: nextAllowedAt
|
||||
/// is a static the status effect sweep never touches, so without this a player who left
|
||||
/// the Sverm and came back stayed locked out of the form with no timer in the HUD.
|
||||
/// </summary>
|
||||
/// <returns>True if there was a form to drop.</returns>
|
||||
public static bool HardResetForReset(Player player)
|
||||
{
|
||||
if (player == null) return false;
|
||||
|
||||
if (formRoutine != null && SvermRace.Instance != null)
|
||||
{
|
||||
SvermRace.Instance.StopCoroutine(formRoutine);
|
||||
}
|
||||
formRoutine = null;
|
||||
|
||||
bool hadForm = IsActive || transforming || exiting || model != null;
|
||||
if (IsActive || model != null) Exit(player, spendCooldown: false);
|
||||
|
||||
transforming = false;
|
||||
exiting = false;
|
||||
nextAllowedAt = 0f;
|
||||
return hadForm;
|
||||
}
|
||||
|
||||
/// <summary>Kicks off the graceful exit (shrink, then Exit) if there is a host to run it on.</summary>
|
||||
private static void RunExit(Player player, bool spendCooldown, string message)
|
||||
{
|
||||
if (SvermRace.Instance != null)
|
||||
{
|
||||
SvermRace.Instance.StartCoroutine(ExitRoutine(player, spendCooldown, message));
|
||||
formRoutine = SvermRace.Instance.StartCoroutine(ExitRoutine(player, spendCooldown, message));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,11 +53,11 @@ namespace RacesOfValheim
|
|||
|
||||
if (IsTransformed)
|
||||
{
|
||||
TrentaRace.Instance.StartCoroutine(RevertRoutine(player));
|
||||
formRoutine = TrentaRace.Instance.StartCoroutine(RevertRoutine(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
TrentaRace.Instance.StartCoroutine(TransformRoutine(player));
|
||||
formRoutine = TrentaRace.Instance.StartCoroutine(TransformRoutine(player));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -68,10 +68,51 @@ namespace RacesOfValheim
|
|||
{
|
||||
if (IsTransformed && !isTransformingSequence)
|
||||
{
|
||||
TrentaRace.Instance.StartCoroutine(RevertRoutine(player));
|
||||
formRoutine = TrentaRace.Instance.StartCoroutine(RevertRoutine(player));
|
||||
}
|
||||
}
|
||||
|
||||
// The one transform or revert routine in flight, if any, so ResetRace can stop it.
|
||||
private static Coroutine formRoutine;
|
||||
|
||||
/// <summary>
|
||||
/// Drops the Muspell on the spot for ResetRace. ForceRevert would get there too, from
|
||||
/// TrentaRace.Update, but a frame and a half-second tween later - after ResetRace has
|
||||
/// already reopened the menu - and not at all if the reset lands mid-gesture.
|
||||
/// </summary>
|
||||
/// <returns>True if there was a form to drop.</returns>
|
||||
public static bool HardResetForReset(Player player)
|
||||
{
|
||||
if (player == null) return false;
|
||||
|
||||
if (formRoutine != null && TrentaRace.Instance != null)
|
||||
{
|
||||
TrentaRace.Instance.StopCoroutine(formRoutine);
|
||||
}
|
||||
formRoutine = null;
|
||||
|
||||
bool hadForm = IsTransformed || isTransformingSequence || currentTransformation != null;
|
||||
if (hadForm)
|
||||
{
|
||||
if (currentTransformation != null) Object.Destroy(currentTransformation);
|
||||
currentTransformation = null;
|
||||
|
||||
ZNetView nview = player.GetComponent<ZNetView>();
|
||||
if (nview != null && nview.IsValid()) nview.GetZDO().Set("RacesOfValheim_MuspellForm", false);
|
||||
|
||||
Transform playerVisual = player.transform.Find("Visual");
|
||||
if (playerVisual != null)
|
||||
{
|
||||
playerVisual.localScale = Vector3.one;
|
||||
playerVisual.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
IsTransformed = false;
|
||||
isTransformingSequence = false;
|
||||
return hadForm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called by Purple Rain instead of its usual staff_summon trigger whenever Muspell is
|
||||
/// active - The Elder's own root-summon gesture, played on the transformation clone's
|
||||
|
|
|
|||
|
|
@ -59,8 +59,23 @@ namespace RacesOfValheim
|
|||
// ─── Farming ───────────────────────────────────────────────────────────
|
||||
public static ConfigEntry<float> UnarmedFarmingDamageBonusPerState;
|
||||
|
||||
// ─── Appearance ────────────────────────────────────────────────────────
|
||||
public static ConfigEntry<Color> SkinColor;
|
||||
public static ConfigEntry<Color> HairColor;
|
||||
|
||||
// The colours every Trol wore before these became settings. Also what a Trol on an older
|
||||
// build of the mod shows as, since that build publishes no colour of its own.
|
||||
public static readonly Color DefaultSkinColor = new Color(0.1f, 0.6f, 0.7f, 1f);
|
||||
public static readonly Color DefaultHairColor = new Color(0.9f, 0.8f, 0.4f, 1f);
|
||||
|
||||
public static void Bind(ConfigFile config)
|
||||
{
|
||||
const string appearance = "Trol - Appearance";
|
||||
SkinColor = config.Bind(appearance, "Skin Color", DefaultSkinColor,
|
||||
new ConfigDescription("Your Trol's skin. Other players see it too. The game multiplies it with the skin texture, so it comes out a little darker than the swatch. For the look of Valheim's own trolls try 7FA8C9."));
|
||||
HairColor = config.Bind(appearance, "Hair Color", DefaultHairColor,
|
||||
new ConfigDescription("Your Trol's hair and beard. Other players see it too."));
|
||||
|
||||
const string keybinds = "Trol - Keybinds";
|
||||
ThrowRockKey = config.Bind(keybinds, "Throw Rock", new KeyboardShortcut(KeyCode.G),
|
||||
new ConfigDescription("Throws a rock (or the log you're holding), tier 3+."));
|
||||
|
|
|
|||
|
|
@ -6,8 +6,23 @@ namespace RacesOfValheim
|
|||
[HarmonyPatch(typeof(VisEquipment), "UpdateColors")]
|
||||
public static class TrolSkinColorPatch
|
||||
{
|
||||
// Golden blonde hair
|
||||
private static readonly Color HairColor = new Color(0.9f, 0.8f, 0.4f, 1f);
|
||||
// Each Trol picks their own colours in Trol - Appearance and publishes them here (see
|
||||
// Trol_PlayerUpdate_Patch), so everyone sees the colours that player chose. Stored without
|
||||
// alpha: _SkinColor ignores it.
|
||||
public const string SkinColorKey = "RacesOfValheim_TrolSkinColor";
|
||||
public const string HairColorKey = "RacesOfValheim_TrolHairColor";
|
||||
|
||||
private static Vector3 ToVec3(Color c) => new Vector3(c.r, c.g, c.b);
|
||||
private static Color ToColor(Vector3 v) => new Color(v.x, v.y, v.z, 1f);
|
||||
|
||||
/// <summary>Puts the local player's chosen colours on their ZDO. Only the owner writes.</summary>
|
||||
public static void Publish(ZDO zdo)
|
||||
{
|
||||
Vector3 skin = ToVec3(TrolConfig.SkinColor.Value);
|
||||
Vector3 hair = ToVec3(TrolConfig.HairColor.Value);
|
||||
if (zdo.GetVec3(SkinColorKey, Vector3.negativeInfinity) != skin) zdo.Set(SkinColorKey, skin);
|
||||
if (zdo.GetVec3(HairColorKey, Vector3.negativeInfinity) != hair) zdo.Set(HairColorKey, hair);
|
||||
}
|
||||
|
||||
public static void Postfix(VisEquipment __instance)
|
||||
{
|
||||
|
|
@ -28,25 +43,38 @@ namespace RacesOfValheim
|
|||
|
||||
if (race != "Trol") return;
|
||||
|
||||
// Apply skin, hair, beard colors here...
|
||||
// The colours this Trol published. A Trol on an older build publishes none and keeps the
|
||||
// defaults; with no ZDO at all (the main-menu preview) it is the local player's own
|
||||
// character, so the local settings are the right answer.
|
||||
Color skinColor, hairColor;
|
||||
if (nview != null && nview.IsValid())
|
||||
{
|
||||
ZDO zdo = nview.GetZDO();
|
||||
skinColor = ToColor(zdo.GetVec3(SkinColorKey, ToVec3(TrolConfig.DefaultSkinColor)));
|
||||
hairColor = ToColor(zdo.GetVec3(HairColorKey, ToVec3(TrolConfig.DefaultHairColor)));
|
||||
}
|
||||
else
|
||||
{
|
||||
skinColor = TrolConfig.SkinColor.Value;
|
||||
hairColor = TrolConfig.HairColor.Value;
|
||||
}
|
||||
|
||||
if (__instance.m_bodyModel != null && __instance.m_bodyModel.material != null)
|
||||
{
|
||||
// Peacock blue (deep greenish-blue)
|
||||
Color trolColor = new Color(0.1f, 0.6f, 0.7f, 1f);
|
||||
__instance.m_bodyModel.material.SetColor("_SkinColor", trolColor);
|
||||
__instance.m_bodyModel.material.SetColor("_SkinColor", skinColor);
|
||||
}
|
||||
|
||||
// Hair
|
||||
var hairInst = Traverse.Create(__instance).Field("m_hairItemInstance").GetValue<GameObject>();
|
||||
if (hairInst != null)
|
||||
foreach (var r in hairInst.GetComponentsInChildren<Renderer>())
|
||||
if (r.material != null) r.material.SetColor("_SkinColor", HairColor);
|
||||
if (r.material != null) r.material.SetColor("_SkinColor", hairColor);
|
||||
|
||||
// Beard
|
||||
var beardInst = Traverse.Create(__instance).Field("m_beardItemInstance").GetValue<GameObject>();
|
||||
if (beardInst != null)
|
||||
foreach (var r in beardInst.GetComponentsInChildren<Renderer>())
|
||||
if (r.material != null) r.material.SetColor("_SkinColor", HairColor);
|
||||
if (r.material != null) r.material.SetColor("_SkinColor", hairColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -128,6 +156,7 @@ namespace RacesOfValheim
|
|||
{
|
||||
nview.GetZDO().Set(StateKey, state);
|
||||
nview.GetZDO().Set(TrueFormKey, isTrueFormActive);
|
||||
if (race == "Trol") TrolSkinColorPatch.Publish(nview.GetZDO());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -206,11 +206,52 @@ namespace RacesOfValheim
|
|||
bool isTrueFormActive = Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_TrolTrueForm".GetStableHashCode());
|
||||
if (wasTrueFormActive && !isTrueFormActive && !isTransforming)
|
||||
{
|
||||
StartCoroutine(RevertTrueFormRoutine());
|
||||
RunFormRoutine(RevertTrueFormRoutine());
|
||||
}
|
||||
wasTrueFormActive = isTrueFormActive;
|
||||
}
|
||||
|
||||
// The one grow or shrink routine in flight, if any, so ResetRace can stop it.
|
||||
private Coroutine formRoutine;
|
||||
|
||||
private void RunFormRoutine(System.Collections.IEnumerator routine)
|
||||
{
|
||||
formRoutine = StartCoroutine(routine);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Drops True Form on the spot for ResetRace. Update returns on its first line for anyone
|
||||
/// who is not a Trol, so its auto-revert never saw the form end. wasTrueFormActive is the
|
||||
/// part that would bite later: left true, the next time this player picks Trol the first
|
||||
/// Update reads it as a form that just ran out and hands out a True Form cooldown.
|
||||
/// </summary>
|
||||
/// <returns>True if there was a form to drop.</returns>
|
||||
public bool HardResetForReset()
|
||||
{
|
||||
Player player = Player.m_localPlayer;
|
||||
if (player == null) return false;
|
||||
|
||||
if (formRoutine != null)
|
||||
{
|
||||
StopCoroutine(formRoutine);
|
||||
formRoutine = null;
|
||||
}
|
||||
|
||||
int trueFormHash = "SE_TrolTrueForm".GetStableHashCode();
|
||||
bool hadForm = isTransforming || wasTrueFormActive || player.GetSEMan().HaveStatusEffect(trueFormHash);
|
||||
if (hadForm)
|
||||
{
|
||||
player.GetSEMan().RemoveStatusEffect(trueFormHash, true);
|
||||
|
||||
ZNetView nview = player.GetComponent<ZNetView>();
|
||||
if (nview != null && nview.IsValid()) nview.GetZDO().Set(Trol_PlayerUpdate_Patch.TrueFormKey, false);
|
||||
}
|
||||
|
||||
isTransforming = false;
|
||||
wasTrueFormActive = false;
|
||||
return hadForm;
|
||||
}
|
||||
|
||||
private void TryTrueForm()
|
||||
{
|
||||
if (BossProgressionManager.GetCurrentProgressionState() < 5) return; // Requires Moder
|
||||
|
|
@ -239,7 +280,7 @@ namespace RacesOfValheim
|
|||
|
||||
if (!isTransforming)
|
||||
{
|
||||
StartCoroutine(TransformToTrueFormRoutine());
|
||||
RunFormRoutine(TransformToTrueFormRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -128,8 +128,11 @@ namespace RacesOfValheim
|
|||
vis.SetBeardItem(0);
|
||||
|
||||
// Hide Helmet
|
||||
var helmetObj = HarmonyLib.Traverse.Create(vis).Field<GameObject>("m_helmetItemInstance").Value;
|
||||
SkeletonVisuals.SetEquipmentPieceHidden(helmetObj, true);
|
||||
if (SkeletonConfig.BodyModelEnabled.Value)
|
||||
{
|
||||
var helmetObj = HarmonyLib.Traverse.Create(vis).Field<GameObject>("m_helmetItemInstance").Value;
|
||||
SkeletonVisuals.SetEquipmentPieceHidden(helmetObj, true);
|
||||
}
|
||||
|
||||
// Scale Body Armor
|
||||
string[] armorFields = { "m_chestItemInstances", "m_legItemInstances", "m_shoulderItemInstances" };
|
||||
|
|
@ -165,7 +168,7 @@ namespace RacesOfValheim
|
|||
|
||||
// The burning skull, grown locally for whoever we are looking at. The tier is on the
|
||||
// ZDO, so this client can work out for itself whether they should be alight.
|
||||
m_skeletonHeadFlame.Apply(m_player, SkeletonConfig.HeadFireVFXEnabled.Value && SkeletonVisuals.GetModel(m_player, state) == SkeletonProgression.FireModel);
|
||||
m_skeletonHeadFlame.Apply(m_player, SkeletonConfig.HeadFireVFXEnabled.Value && SkeletonConfig.BodyModelEnabled.Value && SkeletonVisuals.GetModel(m_player, state) == SkeletonProgression.FireModel);
|
||||
|
||||
// Apply Scale
|
||||
Vector3 targetScale = rules.ScaleMultiplier;
|
||||
|
|
|
|||
11
README.md
11
README.md
|
|
@ -15,9 +15,9 @@ Support the mod: [Patreon — NandorTheModder](https://www.patreon.com/c/NandorT
|
|||
|
||||
---
|
||||
|
||||
## New in v1.5.9
|
||||
## New in v1.5.10
|
||||
|
||||
Skeletons can laugh: type /evillaugh. The Furling's fire bonus now covers crossbow bolts, and a crossbow in hand no longer fires on every attack while you are transformed. Full details in the [changelog](#v159).
|
||||
Using a player model mod such as EnhancedValheimVRM? Turn off `Skeleton - Visuals` → `Body Model Enabled` and Skeletons keep the vanilla body, so no bones clip through your model. Trols can pick their own skin and hair colour under `Trol - Appearance`. Full details in the [changelog](#v1510).
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -30,6 +30,7 @@ Skeletons can laugh: type /evillaugh. The Furling's fire bonus now covers crossb
|
|||
- **Stamina-less Combat:** Skeletons use no stamina and do not have a stamina bar.
|
||||
- **Undead Diet:** Cannot eat normal food. Max health increases automatically as you defeat bosses to make up for lack of food buffs.
|
||||
- **Lit Sockets:** Your skull carries the eye lights of the creature your tier is built from, in that creature's own colour — so they change as the body does.
|
||||
- **Body Model switch:** with a player model mod (EnhancedValheimVRM and the like), set `Skeleton - Visuals` → `Body Model Enabled` to off and Skeletons keep the vanilla body. Abilities stay the same.
|
||||
|
||||
### 2. Skadi
|
||||

|
||||
|
|
@ -71,6 +72,7 @@ Skeletons can laugh: type /evillaugh. The Furling's fire bonus now covers crossb
|
|||
- **Immense Strength:** Increased carry weight; armor scales up as you defeat bosses.
|
||||
- **Rock Throwing:** Hurl huge boulders at enemies.
|
||||
- **Tree Weaponry:** At higher tiers, True Form lets you rip logs and wield them as weapons or throw them.
|
||||
- **Your Own Colours:** pick your skin and hair colour under `Trol - Appearance`. Other players see them too.
|
||||
|
||||
### 7. Draugh
|
||||
- **Born Dead, Buried Alive:** Undead warrior: resistant to physical/poison, weak to fire/spirit.
|
||||
|
|
@ -447,6 +449,11 @@ Both halves have an off switch under `Factions` in Configuration Manager: **Fact
|
|||
|
||||
## Changelog
|
||||
|
||||
### v1.5.10
|
||||
- **New - Skeleton body switch for player model mods:** with EnhancedValheimVRM or another model replacer, the skeleton's bones stayed on screen and floated around the new model. Set `Skeleton - Visuals` → `Body Model Enabled` to off and Skeletons keep the vanilla body: no bones, eye lights or skull flames, and the helmet shows. Abilities don't change. The setting is client-side, so it applies to every Skeleton you see and changes nothing for other players. The race strips hair and beard, so the vanilla body is bald, and the auto-resurrection still shows the skeleton for the few seconds it climbs out of the ground. Thanks to the players who reported it and tested the fix.
|
||||
- **New - Trol skin and hair colour:** `Trol - Appearance` has a colour picker for the skin and one for the hair and beard. Each Trol picks their own and every player sees them. The defaults are the old peacock blue and golden blonde, so nobody's Trol changes after the update. For the blue-grey of Valheim's own trolls, try `7FA8C9`. A Trol on an older version of the mod shows the defaults to everyone else. Thanks to the player who suggested it.
|
||||
- **Fix - Russian translation:** corrections to several Russian texts, by Axibed.
|
||||
|
||||
### v1.5.9
|
||||
- **New - /evillaugh (Skeleton):** the Skeleton throws its head back, clacks its jaw, shakes its shoulders and punches both fists into the air for four seconds. Everyone nearby sees it.
|
||||
- **Change - Furling fire bolts:** the Wickerman's fire damage now also applies to crossbow bolts, not only to arrows.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "RacesOfValheim",
|
||||
"description": "A Valheim mod that adds ten custom playable races (Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Sverm, Trenta, Trol) each with unique abilities, traits, race stations and a deep boss-driven progression system.",
|
||||
"version_number": "1.5.9",
|
||||
"version_number": "1.5.10",
|
||||
"website_url": "",
|
||||
"dependencies": [
|
||||
"denikson-BepInExPack_Valheim-5.4.2333",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue