diff --git a/JotunnModStub/PlayerVisualHider.cs b/JotunnModStub/PlayerVisualHider.cs index 6e753e5..d1cda5a 100644 --- a/JotunnModStub/PlayerVisualHider.cs +++ b/JotunnModStub/PlayerVisualHider.cs @@ -33,6 +33,11 @@ namespace RacesOfValheim } private readonly List m_hidden = new List(); + + // What we hid, kept apart from forceRenderingOff. Other mods write that flag too: Valkyr + // sets its hair's forceRenderingOff on every visual update, so the flag alone made the + // rescan record the hair a second time, already disabled, and the revert left it off. + private readonly HashSet m_tracked = new HashSet(); private float m_nextRescan; private float m_nextLog; private string m_context = ""; @@ -107,8 +112,20 @@ namespace RacesOfValheim // the cape along with the body mesh itself. foreach (Renderer r in GetComponentsInChildren(true)) { - if (r == null || r.forceRenderingOff) continue; // already ours + if (r == null) continue; + if (m_tracked.Contains(r)) + { + // Already ours: re-assert in case another mod cleared the flag. + r.forceRenderingOff = true; + continue; + } + + // Hidden by someone else (Valkyr hides the vanilla body and hair this way): leave + // it to them, or the revert would show it. + if (r.forceRenderingOff) continue; + + m_tracked.Add(r); m_hidden.Add(new HiddenRenderer { Renderer = r, WasEnabled = r.enabled }); r.enabled = false; r.forceRenderingOff = true; @@ -132,6 +149,7 @@ namespace RacesOfValheim } m_hidden.Clear(); + m_tracked.Clear(); enabled = false; return restored; }