fix(sverm): take the carapace off a player who is no longer a Sverm
ApplyCarapace had no removal path - it returned early for a non-Sverm without restoring anything - and its only caller sat behind an `if (isSverm)`, so the removal branch could not have run even if it had existed. The carapace is a plain visual override written with SetChestItem and friends, and nothing in the game corrects that on its own, so the chitin stayed on after a race change. Equipping anything only appeared to fix it: that was Valheim's own refresh writing the real gear back over ours. ApplyCarapace now restores the three slots from what the player actually has equipped - the same values Humanoid.SetupVisEquipment writes, but only for the slots we overrode, so it cannot disturb another race's visuals or a weapon mid-swap. A CarapaceMark component tracks who is wearing it so the restore fires once rather than every tick, and dies with the GameObject so it cannot leak. The caller is unconditional now, matching ApplyEyes/ApplyClaws/ApplySpines, which all already strip themselves from whoever is not a Sverm.
This commit is contained in:
parent
a085570ad9
commit
da602a9b44
2 changed files with 65 additions and 2 deletions
|
|
@ -280,7 +280,13 @@ namespace RacesOfValheim
|
|||
SvermVisuals.ApplyClaws(__instance); // cleanup of the retired cosmetic path
|
||||
SvermVisuals.ApplySpines(__instance);
|
||||
SvermVisuals.ApplyGlideMotes(__instance);
|
||||
if (isSverm) SvermVisuals.ApplyCarapace(__instance);
|
||||
|
||||
// Unconditional, like the four above it: ApplyCarapace takes the carapace OFF
|
||||
// whoever is no longer a Sverm, and it cannot do that from behind an
|
||||
// `if (isSverm)`. That gate is why the chitin stayed on after a race change
|
||||
// until the player happened to equip something. For anyone who never wore it
|
||||
// this returns on the first line.
|
||||
SvermVisuals.ApplyCarapace(__instance);
|
||||
|
||||
// Issues the claws if they are missing and puts them back in hand whenever
|
||||
// both hands are free. On the same throttle rather than every frame: it is a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue