warvulture

This commit is contained in:
Ferdinando 2026-08-13 19:13:24 +02:00
commit d79f78e9f0
10 changed files with 901 additions and 90 deletions

View file

@ -316,7 +316,16 @@ namespace RacesOfValheim
Character character = GetComponent<Character>();
if (character == null || character.IsDead())
{
Destroy(gameObject);
// ZNetScene.Destroy, NEVER Object.Destroy, and this line was the teleport crash.
//
// An escort is a real networked creature, and ZNetView.OnDestroy - read out of the
// assembly, not assumed - only releases asset references: it does not take the
// object out of ZNetScene.m_instances. A plain Object.Destroy therefore left the
// scene holding a dead ZNetView, and the next time the world unloaded around the
// player, which is exactly what a teleport is, ZNetScene.RemoveObjects walked that
// entry and threw. See ZNetSceneOrphanPatch.cs for the whole chain.
if (ZNetScene.instance != null) ZNetScene.instance.Destroy(gameObject);
else Destroy(gameObject);
return;
}