From 5dff5e1b8426e83ef8eab859fdc74d2166c48934 Mon Sep 17 00:00:00 2001 From: kanym Date: Sun, 18 Oct 2026 00:09:14 +0200 Subject: [PATCH] fix(forms): hair comes back after a form with Valkyr Valkyr sets its hair's forceRenderingOff on every visual update. The hider read that flag as "not hidden yet", recorded the hair a second time with enabled already false, and the revert left it off. Track hidden renderers in a set instead of trusting the flag. --- JotunnModStub/PlayerVisualHider.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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; }