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:
parent
ee154ccab4
commit
5cf1ae7fb0
3 changed files with 67 additions and 12 deletions
|
|
@ -103,10 +103,9 @@ namespace RacesOfValheim
|
|||
// Everything that is not a Renderer or a Transform. Animator is a Behaviour, not a
|
||||
// MonoBehaviour, so it is never touched by the first loop and survives on purpose -
|
||||
// it is the one live thing this costume is allowed to keep.
|
||||
foreach (MonoBehaviour behaviour in copy.GetComponentsInChildren<MonoBehaviour>(true))
|
||||
{
|
||||
if (behaviour != null) Object.DestroyImmediate(behaviour);
|
||||
}
|
||||
// Dependents first: a single pass left the Brute's Humanoid on the costume, because
|
||||
// CharacterDrop requires it and came later. See ModelBorrow.StripBehaviours.
|
||||
ModelBorrow.StripBehaviours(copy, "Sverm");
|
||||
foreach (Collider collider in copy.GetComponentsInChildren<Collider>(true))
|
||||
{
|
||||
if (collider != null) Object.DestroyImmediate(collider);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue