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 <noreply@anthropic.com>
This commit is contained in:
kanym 2026-09-26 00:20:02 +02:00
commit e75c7072c4
10 changed files with 65 additions and 14 deletions

View file

@ -708,7 +708,17 @@ namespace RacesOfValheim
{
isTransformingSequence = true;
GameObject poofPrefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>("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<GameObject>("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<GameObject>("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<GameObject>("vfx_wraith_death");
if (poofPrefab != null) Instantiate(poofPrefab, Player.m_localPlayer.transform.position, Quaternion.identity);
Transform playerVisual = Player.m_localPlayer.transform.Find("Visual");

View file

@ -114,13 +114,13 @@ namespace RacesOfValheim
{
var aswidStats = ScriptableObject.CreateInstance<SE_AswidStats>();
aswidStats.name = "SE_AswidStats";
aswidStats.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyBat")?.m_itemData.m_shared.m_icons[0];
aswidStats.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyDeathsquito")?.m_itemData.m_shared.m_icons[0];
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(aswidStats, fixReference: false));
var batForm = ScriptableObject.CreateInstance<SE_BatForm>();
batForm.name = "SE_BatForm";
batForm.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyBat")?.m_itemData.m_shared.m_icons[0];
batForm.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyDeathsquito")?.m_itemData.m_shared.m_icons[0];
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(batForm, fixReference: false));

View file

@ -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!");

View file

@ -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)

View file

@ -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<GameObject>("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<GameObject>("vfx_corpse_destruction_medium");
if (smoke != null) Instantiate(smoke, pos, Quaternion.identity);
GameObject sparks = PrefabManager.Cache.GetPrefab<GameObject>("vfx_HitSparks");

View file

@ -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" },

View file

@ -695,7 +695,10 @@ namespace RacesOfValheim
private Sprite GetTrolIcon()
{
GameObject trophyPrefab = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyFrostTroll")?.gameObject;
if (trophyPrefab == null) trophyPrefab = PrefabManager.Cache.GetPrefab<ItemDrop>("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<ItemDrop>("TrophyForestTroll")?.gameObject;
if (trophyPrefab != null)
{
ItemDrop trophyDrop = trophyPrefab.GetComponent<ItemDrop>();

View file

@ -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<GameObject>("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<GameObject>("vfx_corpse_destruction_medium");
if (smoke != null) Instantiate(smoke, pos, Quaternion.identity);
GameObject sparks = PrefabManager.Cache.GetPrefab<GameObject>("vfx_HitSparks");

View file

@ -233,13 +233,27 @@ namespace RacesOfValheim
if (!vfxMaterialResolved)
{
vfxMaterialResolved = true;
GameObject source = PrefabManager.Cache.GetPrefab<GameObject>(TrentaConfig.PurpleRainVfxSourcePrefab)
?? PrefabManager.Cache.GetPrefab<GameObject>("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<GameObject>(TrentaConfig.PurpleRainVfxSourcePrefab);
if (source != null)
{
ParticleSystemRenderer sourceRenderer = source.GetComponentInChildren<ParticleSystemRenderer>(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");

View file

@ -141,7 +141,12 @@ namespace RacesOfValheim
if (player == null) return;
Vector3 pos = player.transform.position + Vector3.up;
GameObject smoke = PrefabManager.Cache.GetPrefab<GameObject>("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<GameObject>("vfx_corpse_destruction_large");
if (smoke != null) Object.Instantiate(smoke, pos, Quaternion.identity);
}