fix(fenrir): hide the human body in every form, not just shrink it
Wolf, Ulv, Fenring and Cultist all hid the player by scaling the Visual child to a thousandth of its size. That has quietly stopped working: the scale reset that keeps a non-Trol player at normal height runs from a postfix on the same update and puts the scale straight back to 1, so the man reappeared standing inside his own wolf a frame after transforming. Fenrir is not one of the races listed as sizing itself, so nothing exempted it from that reset. Use PlayerVisualHider, the same fix Skadi and the Aswid already carry: renderers go off with forceRenderingOff and are re-swept periodically, so nothing that touches the transform can undo it, and the Animator is never disabled - which is what made reverting look like respawning back when this was solved for the dragon forms. Both the local form and the copy other players see are switched over; the remote path in ZdoVisualSync used the same scale trick and had the same bug.
This commit is contained in:
parent
0afeaa7f0e
commit
668a017a91
2 changed files with 14 additions and 8 deletions
|
|
@ -329,7 +329,12 @@ namespace RacesOfValheim {
|
|||
|
||||
if (prefab != null && playerVisual != null)
|
||||
{
|
||||
playerVisual.localScale = Vector3.one * 0.001f;
|
||||
// Shrinking the Visual to nothing was how this hid the human body, and it stopped
|
||||
// working: the scale reset that keeps a non-Trol player at normal size runs from a
|
||||
// postfix on this same update and puts it straight back to 1, so the man reappeared
|
||||
// standing inside his own wolf. Hide the renderers instead - that is what Skadi and
|
||||
// the Aswid already do, and nothing resets it.
|
||||
PlayerVisualHider.Hide(playerVisual, "fenrir-local-form");
|
||||
|
||||
Transform visual = prefab.transform.Find("Visual");
|
||||
if (visual != null)
|
||||
|
|
@ -409,11 +414,9 @@ namespace RacesOfValheim {
|
|||
nview.GetZDO().Set("RacesOfValheim_FenrirForm", "");
|
||||
}
|
||||
|
||||
if (playerVisual != null)
|
||||
{
|
||||
playerVisual.localScale = Vector3.one;
|
||||
playerVisual.gameObject.SetActive(true);
|
||||
}
|
||||
// Show undoes the scale and the SetActive of the older hiding paths as well, so a form
|
||||
// entered before this change still reverts cleanly.
|
||||
PlayerVisualHider.Show(playerVisual, "fenrir-local-revert");
|
||||
|
||||
Player.m_localPlayer.GetSEMan().RemoveStatusEffect("SE_FenrirForm".GetStableHashCode());
|
||||
Player.m_localPlayer.GetSEMan().RemoveStatusEffect("SE_CultistForm".GetStableHashCode());
|
||||
|
|
|
|||
|
|
@ -182,11 +182,14 @@ namespace RacesOfValheim
|
|||
{
|
||||
if (string.IsNullOrEmpty(currentForm))
|
||||
{
|
||||
playerVisual.localScale = Vector3.one;
|
||||
PlayerVisualHider.Show(playerVisual, "fenrir-remote-revert");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerVisual.localScale = Vector3.one * 0.001f;
|
||||
// Same story as the local form: the scale trick this used to hide the body
|
||||
// is undone every frame by the reset that keeps non-Trol players at normal
|
||||
// size, so other players saw the man standing in his own wolf too.
|
||||
PlayerVisualHider.Hide(playerVisual, "fenrir-remote-form");
|
||||
GameObject prefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>(currentForm);
|
||||
if (prefab != null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue