From 3485665d4efb485cf0e8c28cf5295d88c8df5d51 Mon Sep 17 00:00:00 2001 From: kanym Date: Wed, 30 Sep 2026 13:22:48 +0200 Subject: [PATCH] fix(trol): the True Form log is borrowed from TrollFrost, the real Gammeltroll "Gammeltroll" is only the developers' name: the prefab is TrollFrost, whose clips fire the sfx_gameltroll_* sounds and whose Attack TreeThrow throws a treebundle (dumpanim TrollFrost). No prefab is called Gammeltroll, so since v1.4.16 every True Form throw fell back to the physical log. The loose "gammel" substring fallback is gone too: it matched nothing in vanilla and could match another mod's prefab. --- JotunnModStub/Trol/TrolGammelLog.cs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/JotunnModStub/Trol/TrolGammelLog.cs b/JotunnModStub/Trol/TrolGammelLog.cs index 68cbb16..4056e3d 100644 --- a/JotunnModStub/Trol/TrolGammelLog.cs +++ b/JotunnModStub/Trol/TrolGammelLog.cs @@ -14,10 +14,16 @@ namespace RacesOfValheim /// then the log is the child, and the parent would bring the whole rose along with it. /// If none of that resolves, GetProjectile returns null and TrolRace falls back to the old /// physical log. "dumpgammel" in the console logs what was actually found. + /// + /// "Gammeltroll" is only the developers' name for it. The prefab is TrollFrost, the Deep North + /// troll: its clips fire the sfx_gameltroll_* sounds, and its 'Attack TreeThrow' shows a + /// 'treebundle' at 2.03s and throws it at 3.54s (dumpanim TrollFrost). No prefab is called + /// Gammeltroll, so from v1.4.16 until this was corrected the lookup found nothing and every + /// True Form throw fell back to the physical log. /// public static class TrolGammelLog { - private const string GammeltrollPrefab = "Gammeltroll"; + private const string GammeltrollPrefab = "TrollFrost"; private static GameObject cachedProjectile; private static float cachedVelocity; @@ -45,7 +51,7 @@ namespace RacesOfValheim velocity = 0f; GameObject troll = FindGammeltroll(); - if (troll == null) { log?.Invoke("Gammeltroll prefab not found in ZNetScene."); return; } + if (troll == null) { log?.Invoke($"Gammeltroll prefab '{GammeltrollPrefab}' not found in ZNetScene."); return; } log?.Invoke($"Monster prefab: '{troll.name}'"); Humanoid humanoid = troll.GetComponent(); @@ -87,14 +93,10 @@ namespace RacesOfValheim private static GameObject FindGammeltroll() { - GameObject exact = ZNetScene.instance.GetPrefab(GammeltrollPrefab); - if (exact != null) return exact; - foreach (GameObject prefab in ZNetScene.instance.m_prefabs) - { - if (prefab != null && prefab.name.ToLowerInvariant().Contains("gammel") && prefab.GetComponent() != null) - return prefab; - } - return null; + // Exact name only. The old fallback took the first Humanoid with "gammel" anywhere in + // its name, which in vanilla matches nothing and in a modded game matches whatever + // another mod happens to call that - see the prefab-name audit. + return ZNetScene.instance.GetPrefab(GammeltrollPrefab); } private static IEnumerable ItemsOf(Humanoid h)