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.
This commit is contained in:
parent
8274baf74b
commit
3485665d4e
1 changed files with 12 additions and 10 deletions
|
|
@ -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.
|
||||
/// </summary>
|
||||
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<Humanoid>();
|
||||
|
|
@ -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<Humanoid>() != 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<GameObject> ItemsOf(Humanoid h)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue