fix(sverm): the Ravager costume no longer keeps a live Humanoid

The BepInEx log showed "Can't remove Humanoid (Script) because
CharacterDrop (Script) depends on it" right after the Ravager template
was built from SeekerBrute. The strip was one pass in component order,
and Unity refuses to destroy a component another still requires, so
the Brute's Humanoid survived on the costume and on every copy a
player wore: the leftover that once broke the hammer for every piece.

ModelBorrow.StripBehaviours destroys only what nothing remaining
requires through [RequireComponent], round after round, and logs any
survivor by name. Used by the Ravager template, by ModelBorrow.Attach
and by the Skeleton's rise costume, which had the same single pass.
This commit is contained in:
kanym 2026-10-17 19:42:14 +02:00
commit 5cf1ae7fb0
3 changed files with 67 additions and 12 deletions

View file

@ -125,10 +125,8 @@ namespace RacesOfValheim
// Everything that is not a Renderer, a Transform or the Animator. Animator is a Behaviour,
// not a MonoBehaviour, so the first loop never touches it.
foreach (MonoBehaviour behaviour in copy.GetComponentsInChildren<MonoBehaviour>(true))
{
if (behaviour != null) Object.DestroyImmediate(behaviour);
}
// Dependents first, so a Humanoid held down by CharacterDrop cannot survive on the copy.
ModelBorrow.StripBehaviours(copy, "Skeleton");
foreach (Collider collider in copy.GetComponentsInChildren<Collider>(true))
{
if (collider != null) Object.DestroyImmediate(collider);