From e75c7072c4241f9f4b24051fa66deeebb8659f60 Mon Sep 17 00:00:00 2001 From: kanym Date: Sat, 26 Sep 2026 00:20:02 +0200 Subject: [PATCH] fix(prefabs): replace every lookup name that does not exist in vanilla An audit of all 59 prefab names the mod resolves, against the game's own asset manifests, found nine that are not in Valheim at all. A name vanilla does not use has no vanilla candidate to beat in Jotunn's name cache, so it is a free slot for whoever ships one - which is how another mod's weapon trail became the Skeleton's fire aura in 00d4fd6. Eight of the nine failed in silence, which is why none of them was ever reported: vfx_corpse_destruction -> _medium, _large for the Muspell. The puff that covers a transformation. Fenrir and Skadi at least had their sparks; the Muspell swapped bodies in plain view with nothing at all. vfx_surtling_death -> vfx_wraith_death for the Aswid's Mist Form, which reads as mist by construction and is the same creature the form already borrows its Visual from; vfx_corpse_destruction_medium for the thrall, where nothing is misty. Vanilla has no surtling death effect under any spelling. TrophyTroll -> TrophyForestTroll. TrophyBat -> TrophyDeathsquito. Vanilla ships no bat trophy, so the Aswid's two status effects and its radial entry had no icon. vfx_smoke -> gone. It was the Trenta's fallback for Purple Rain's particle material behind Greydwarf_Shaman, and the day the Shaman failed to resolve it would have worn whatever a mod supplies. Purple Rain is purple by design, so nobody would ever have reported it. The ninth did not fail in silence. vfx_OozeHit was passed to Instantiate unguarded, so every successful Draugh parry threw ArgumentException and took the North Wind nova below it down as well. It is vfx_blob_hit. Co-Authored-By: Claude Opus 5 --- JotunnModStub/Aswid/AswidRace.cs | 16 ++++++++++++++-- JotunnModStub/Aswid/AswidStatusEffects.cs | 4 ++-- JotunnModStub/Aswid/AswidThrall.cs | 5 ++++- .../Draugh/DraughProgressionPatches.cs | 12 ++++++++++-- JotunnModStub/Fenrir/FenrirRace.cs | 5 ++++- JotunnModStub/RaceRadial.cs | 2 +- JotunnModStub/RacesOfValheim.cs | 5 ++++- JotunnModStub/Skadi/SkadiRace.cs | 5 ++++- JotunnModStub/Trenta/TrentaAbilities.cs | 18 ++++++++++++++++-- JotunnModStub/Trenta/TrentaMuspell.cs | 7 ++++++- 10 files changed, 65 insertions(+), 14 deletions(-) diff --git a/JotunnModStub/Aswid/AswidRace.cs b/JotunnModStub/Aswid/AswidRace.cs index 3078f06..b1f1cd2 100644 --- a/JotunnModStub/Aswid/AswidRace.cs +++ b/JotunnModStub/Aswid/AswidRace.cs @@ -708,7 +708,17 @@ namespace RacesOfValheim { isTransformingSequence = true; - GameObject poofPrefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab("vfx_surtling_death"); + // WAS "vfx_surtling_death", WHICH IS NOT A PREFAB IN THIS GAME. The surtling has no + // death effect under any spelling, so this resolved to nothing and the Mist Form has + // always appeared and disappeared with no puff at all - both here and in + // RevertMistFormRoutine. Kept as a note rather than a fallback: a name vanilla does not + // use is a free slot for any mod that ships one, which is how another mod's weapon trail + // became the Skeleton's fire aura (see SkeletonVisuals.EnsureFireAura). + // + // The Wraith's own death effect reads as mist by construction, which is what this wanted, + // and it is already the right creature: the form borrows the Wraith's Visual a few lines + // below. If the look wants changing, that effect is the thing to alter. + GameObject poofPrefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab("vfx_wraith_death"); if (poofPrefab != null) Instantiate(poofPrefab, Player.m_localPlayer.transform.position, Quaternion.identity); Player.m_localPlayer.GetSEMan().AddStatusEffect("SE_MistForm".GetStableHashCode(), true); @@ -763,7 +773,9 @@ namespace RacesOfValheim { isTransformingSequence = true; - GameObject poofPrefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab("vfx_surtling_death"); + // The same puff as going in - see TransformIntoMistRoutine for why the old name never + // resolved to anything. + GameObject poofPrefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab("vfx_wraith_death"); if (poofPrefab != null) Instantiate(poofPrefab, Player.m_localPlayer.transform.position, Quaternion.identity); Transform playerVisual = Player.m_localPlayer.transform.Find("Visual"); diff --git a/JotunnModStub/Aswid/AswidStatusEffects.cs b/JotunnModStub/Aswid/AswidStatusEffects.cs index f87e9bb..ac3ab3f 100644 --- a/JotunnModStub/Aswid/AswidStatusEffects.cs +++ b/JotunnModStub/Aswid/AswidStatusEffects.cs @@ -114,13 +114,13 @@ namespace RacesOfValheim { var aswidStats = ScriptableObject.CreateInstance(); aswidStats.name = "SE_AswidStats"; - aswidStats.m_icon = PrefabManager.Cache.GetPrefab("TrophyBat")?.m_itemData.m_shared.m_icons[0]; + aswidStats.m_icon = PrefabManager.Cache.GetPrefab("TrophyDeathsquito")?.m_itemData.m_shared.m_icons[0]; ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(aswidStats, fixReference: false)); var batForm = ScriptableObject.CreateInstance(); batForm.name = "SE_BatForm"; - batForm.m_icon = PrefabManager.Cache.GetPrefab("TrophyBat")?.m_itemData.m_shared.m_icons[0]; + batForm.m_icon = PrefabManager.Cache.GetPrefab("TrophyDeathsquito")?.m_itemData.m_shared.m_icons[0]; ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(batForm, fixReference: false)); diff --git a/JotunnModStub/Aswid/AswidThrall.cs b/JotunnModStub/Aswid/AswidThrall.cs index 816517e..35d1562 100644 --- a/JotunnModStub/Aswid/AswidThrall.cs +++ b/JotunnModStub/Aswid/AswidThrall.cs @@ -117,7 +117,10 @@ namespace RacesOfValheim m_ai.SetFollowTarget(user.gameObject); } - GameObject vfx = ZNetScene.instance.GetPrefab("vfx_surtling_death"); + // "vfx_surtling_death" was asked for here and is not a prefab in this game, so dominating + // a creature happened with no effect at all. The generic body-sized puff, rather than the + // Wraith's mist the Mist Form wears: nothing about domination is misty. + GameObject vfx = ZNetScene.instance.GetPrefab("vfx_corpse_destruction_medium"); if (vfx) Instantiate(vfx, m_character.transform.position, Quaternion.identity); user.Message(MessageHud.MessageType.Center, $"{m_character.m_name} dominated!"); diff --git a/JotunnModStub/Draugh/DraughProgressionPatches.cs b/JotunnModStub/Draugh/DraughProgressionPatches.cs index 8162551..f56ce0f 100644 --- a/JotunnModStub/Draugh/DraughProgressionPatches.cs +++ b/JotunnModStub/Draugh/DraughProgressionPatches.cs @@ -98,8 +98,16 @@ namespace RacesOfValheim attacker.ApplyDamage(poisonSplash, true, false); - // Visual effect for splash - UnityEngine.Object.Instantiate(ZNetScene.instance.GetPrefab("vfx_OozeHit"), attacker.GetCenterPoint(), Quaternion.identity); + // Visual effect for splash. "vfx_OozeHit" is not a prefab in this game - + // the blob's hit effect is vfx_blob_hit - and this was the one dead name + // in the mod that was passed to Instantiate unguarded, so every + // successful parry threw ArgumentException here and took the North Wind + // nova below down with it. + GameObject splashVfx = ZNetScene.instance.GetPrefab("vfx_blob_hit"); + if (splashVfx != null) + { + UnityEngine.Object.Instantiate(splashVfx, attacker.GetCenterPoint(), Quaternion.identity); + } // Stage 5: North Wind (AoE Frost) if (state >= 5) diff --git a/JotunnModStub/Fenrir/FenrirRace.cs b/JotunnModStub/Fenrir/FenrirRace.cs index 784cffd..a98f6d3 100644 --- a/JotunnModStub/Fenrir/FenrirRace.cs +++ b/JotunnModStub/Fenrir/FenrirRace.cs @@ -316,7 +316,10 @@ namespace RacesOfValheim { if (Player.m_localPlayer == null) return; Vector3 pos = Player.m_localPlayer.transform.position + Vector3.up; - GameObject smoke = PrefabManager.Cache.GetPrefab("vfx_corpse_destruction"); + // Vanilla's puff carries a size suffix and has no bare "vfx_corpse_destruction" - so + // this used to resolve to nothing and the body swap happened in plain view, with only + // the sparks below to soften it. _medium is the one built for a body this size. + GameObject smoke = PrefabManager.Cache.GetPrefab("vfx_corpse_destruction_medium"); if (smoke != null) Instantiate(smoke, pos, Quaternion.identity); GameObject sparks = PrefabManager.Cache.GetPrefab("vfx_HitSparks"); diff --git a/JotunnModStub/RaceRadial.cs b/JotunnModStub/RaceRadial.cs index f381421..3e4e0da 100644 --- a/JotunnModStub/RaceRadial.cs +++ b/JotunnModStub/RaceRadial.cs @@ -49,7 +49,7 @@ namespace RacesOfValheim new Entry { Race = "Fenrir", Label = "Cultist Form", Key = () => FenrirConfig.CultistFormKey, Icon = "TrophyCultist" }, new Entry { Race = "Fenrir", Label = "Howl", Key = () => FenrirConfig.HowlKey, Icon = "TrophyUlv" }, - new Entry { Race = "Aswid", Label = "Bat Form", Key = () => AswidConfig.BatFormKey, Icon = "TrophyBat" }, + new Entry { Race = "Aswid", Label = "Bat Form", Key = () => AswidConfig.BatFormKey, Icon = "TrophyDeathsquito" }, new Entry { Race = "Aswid", Label = "Mist Form", Key = () => AswidConfig.MistFormKey, Icon = "TrophyWraith" }, new Entry { Race = "Aswid", Label = "Eclipse", Key = () => AswidConfig.EclipseKey, Icon = "TrophyFader" }, new Entry { Race = "Aswid", Label = "Tame", Key = () => AswidConfig.TameKey, Icon = "TrophyWolf" }, diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs index 7061303..0235ed9 100644 --- a/JotunnModStub/RacesOfValheim.cs +++ b/JotunnModStub/RacesOfValheim.cs @@ -695,7 +695,10 @@ namespace RacesOfValheim private Sprite GetTrolIcon() { GameObject trophyPrefab = PrefabManager.Cache.GetPrefab("TrophyFrostTroll")?.gameObject; - if (trophyPrefab == null) trophyPrefab = PrefabManager.Cache.GetPrefab("TrophyTroll")?.gameObject; + // TrophyForestTroll, not "TrophyTroll": the latter is not a prefab in this game, so the + // fallback could never fire and the name sat here as a free slot for any mod that + // happens to ship one. See SkeletonVisuals.EnsureFireAura for what that costs. + if (trophyPrefab == null) trophyPrefab = PrefabManager.Cache.GetPrefab("TrophyForestTroll")?.gameObject; if (trophyPrefab != null) { ItemDrop trophyDrop = trophyPrefab.GetComponent(); diff --git a/JotunnModStub/Skadi/SkadiRace.cs b/JotunnModStub/Skadi/SkadiRace.cs index af64056..cfe78d4 100644 --- a/JotunnModStub/Skadi/SkadiRace.cs +++ b/JotunnModStub/Skadi/SkadiRace.cs @@ -690,7 +690,10 @@ namespace RacesOfValheim if (Player.m_localPlayer == null) return; Vector3 pos = Player.m_localPlayer.transform.position + Vector3.up; - GameObject smoke = PrefabManager.Cache.GetPrefab("vfx_corpse_destruction"); + // _medium, not a bare "vfx_corpse_destruction": that name is not in the game, so this + // resolved to nothing and the swap into a drake happened in plain view. See + // FenrirRace.SpawnPoofEffect for the same fix. + GameObject smoke = PrefabManager.Cache.GetPrefab("vfx_corpse_destruction_medium"); if (smoke != null) Instantiate(smoke, pos, Quaternion.identity); GameObject sparks = PrefabManager.Cache.GetPrefab("vfx_HitSparks"); diff --git a/JotunnModStub/Trenta/TrentaAbilities.cs b/JotunnModStub/Trenta/TrentaAbilities.cs index 8e8e3c9..4380e28 100644 --- a/JotunnModStub/Trenta/TrentaAbilities.cs +++ b/JotunnModStub/Trenta/TrentaAbilities.cs @@ -233,13 +233,27 @@ namespace RacesOfValheim if (!vfxMaterialResolved) { vfxMaterialResolved = true; - GameObject source = PrefabManager.Cache.GetPrefab(TrentaConfig.PurpleRainVfxSourcePrefab) - ?? PrefabManager.Cache.GetPrefab("vfx_smoke"); + // The "vfx_smoke" fallback that used to sit here is gone. That name is not a prefab + // in this game, so it could only ever resolve to another mod's object - and with + // Magic_Supremacy installed it resolved to a weapon trail, which is what put purple + // smoke on the Skeleton (see SkeletonVisuals.EnsureFireAura). Purple Rain is purple + // by design, so the same theft here would never have looked wrong enough to report. + // + // Losing the fallback means a miss is now a miss. Said out loud, because the resolve + // is cached for the session either way and a silent one would be invisible: 1.0 + // loads creature assets lazily, so the Shaman is not guaranteed to be in memory. + GameObject source = PrefabManager.Cache.GetPrefab(TrentaConfig.PurpleRainVfxSourcePrefab); if (source != null) { ParticleSystemRenderer sourceRenderer = source.GetComponentInChildren(true); if (sourceRenderer != null) cachedVfxMaterial = sourceRenderer.material; } + else + { + Jotunn.Logger.LogWarning( + $"[Trenta] Purple Rain: '{TrentaConfig.PurpleRainVfxSourcePrefab}' not in the prefab " + + "cache; falling back to Unity's default particle material for this session."); + } } GameObject vfx = new GameObject("TrentaPurpleRainVFX"); diff --git a/JotunnModStub/Trenta/TrentaMuspell.cs b/JotunnModStub/Trenta/TrentaMuspell.cs index 01157a9..6f7fbf6 100644 --- a/JotunnModStub/Trenta/TrentaMuspell.cs +++ b/JotunnModStub/Trenta/TrentaMuspell.cs @@ -141,7 +141,12 @@ namespace RacesOfValheim if (player == null) return; Vector3 pos = player.transform.position + Vector3.up; - GameObject smoke = PrefabManager.Cache.GetPrefab("vfx_corpse_destruction"); + // _large rather than the _medium the other two forms use: the Muspell is the biggest + // thing this mod turns a player into, and a body-sized puff does not cover it. A bare + // "vfx_corpse_destruction" is not a prefab in this game, so until now the Muspell was + // the one transformation with no covering effect of any kind - Fenrir and Skadi at least + // had their sparks. + GameObject smoke = PrefabManager.Cache.GetPrefab("vfx_corpse_destruction_large"); if (smoke != null) Object.Instantiate(smoke, pos, Quaternion.identity); }