feat(fenrir): forms sneak at a walk and sleep when the player sits

FormLocomotion zeroed the speed whenever the player crouched, so a
sneaking form slid across the ground in its idle pose. Only airborne
reads as still now: crouched, the player moves at sneaking speed and
the creature's controller picks its walk.

Sitting sets the "sleeping" bool the creature's own MonsterAI uses,
when its controller has one; the log says once per controller which do.
IsSitting reads the replicated animator state, so onlookers' copies
sleep too. Covers every Fenrir form, local and remote, and the True
Form troll, which share FormLocomotion. Mirror now takes the Player.

Requested by a player on Discord.
This commit is contained in:
kanym 2026-10-17 18:51:14 +02:00
commit 580ef6d468
3 changed files with 43 additions and 15 deletions

View file

@ -422,7 +422,7 @@ namespace RacesOfValheim
// The same helper the local behaviours use, so both views of the same wolf agree.
// Player.IsCrouching answers off the animator's current state, which is replicated, so
// it is true here too.
locomotion.Mirror(formAnim, playerAnim, player.IsCrouching());
locomotion.Mirror(formAnim, playerAnim, player);
}
// Written every frame while the flag is set, and only when the controller has the bool: a
@ -539,7 +539,7 @@ namespace RacesOfValheim
// Meglio continuare a sincronizzare i movimenti base.
if (!isAttacking)
{
bool isGrounded = locomotion.Mirror(fenrirAnim, playerAnim, Player.m_localPlayer.IsCrouching());
bool isGrounded = locomotion.Mirror(fenrirAnim, playerAnim, Player.m_localPlayer);
if (isGrounded && RaceInput.Allowed)
{
@ -790,7 +790,7 @@ namespace RacesOfValheim
if (!isAttacking)
{
// Se tiene premuto Ctrl (Crouch), ferma il movimento per preparare l'attacco
bool isGrounded = locomotion.Mirror(cultistAnim, playerAnim, Player.m_localPlayer.IsCrouching());
bool isGrounded = locomotion.Mirror(cultistAnim, playerAnim, Player.m_localPlayer);
if (isGrounded)
{
@ -1172,7 +1172,7 @@ namespace RacesOfValheim
if (!isAttacking)
{
bool isGrounded = locomotion.Mirror(wolfAnim, playerAnim, Player.m_localPlayer.IsCrouching());
bool isGrounded = locomotion.Mirror(wolfAnim, playerAnim, Player.m_localPlayer);
if (isGrounded && RaceInput.Allowed)
{
@ -1384,7 +1384,7 @@ namespace RacesOfValheim
if (!isAttacking)
{
bool isGrounded = locomotion.Mirror(ulvAnim, playerAnim, Player.m_localPlayer.IsCrouching());
bool isGrounded = locomotion.Mirror(ulvAnim, playerAnim, Player.m_localPlayer);
if (isGrounded && RaceInput.Allowed)
{