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)