chore(release): v1.4.19 - eye height, remote forms, food refresh, faction retaliation
Race body scale moved the model and not the camera: Character.m_eye hangs off the unscaled root, so a Trol or a Dvergar changed height for everyone but themselves. RaceEyeHeight moves the eye by whatever scale the Visual is wearing, for every player, so aim rays follow too. Remote copies of a Fenrir form had no one writing to their Animator and stood in the controller's default state, sliding. RemoteFenrirAnimator mirrors the four local behaviours off the player's own replicated animator, the way RemoteSkadiAnimator already did for Skadi. Player.Food.m_time is time remaining, not time elapsed: the Aswid, Trenta and Draugh repeat-meal branches all set it to 0 and expired the slot they meant to renew, and left the nutrition values stale. RaceFoodRefresh does what vanilla's own branch does, in one place instead of three. The Trenta prefix now reports __result, or a working refresh would have renewed the slot without consuming the seed. Aswid devour was gated by one timestamp shared by every corpse, so a pack killed at once fed the player once; it is now per corpse, floored at a second, and a refused meal says $msg_nomore. MonsterAI.UpdateTarget discards any target IsEnemy refuses, so a truced mob could not retaliate at all - it stood still or fled. RaceGrudge records the hit on the AI owner's client and both truce postfixes stand down for that pair. The Aswid drain and the Skadi frost aura now skip kin, as the Skeleton's fire aura already did, or an always-on aura would hold every truce permanently broken. Faction sets matched exact prefab names with families half-listed: added Skeleton_NoArcher and Draugr_Ranged to the Swamp, Greyling to the Black Forest. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
5f74c57e72
commit
834d6647fd
18 changed files with 525 additions and 56 deletions
|
|
@ -39,6 +39,68 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The animation half of somebody else's form.
|
||||
///
|
||||
/// The four behaviours below drive their model's Animator from the player's own, and every
|
||||
/// one of them runs on the transformed player's client only: FenrirRace.ExecuteTransformation
|
||||
/// is what adds them, and they read Player.m_localPlayer throughout. RacesVisualController
|
||||
/// spawns the same model on every other client from the ZDO, and used to spawn nothing else -
|
||||
/// no parameter was ever written to that copy's Animator, so it sat in its controller's
|
||||
/// default state and slid across the terrain. The wolf's owner saw a wolf running; everyone
|
||||
/// else saw a statue on rails.
|
||||
///
|
||||
/// This is the piece that was missing, and it is the arrangement Skadi already uses for its
|
||||
/// remote dragons (RemoteSkadiAnimator). The parameters come from the remote player's own
|
||||
/// Visual Animator, which ZSyncAnimation keeps fed over the network for every character a
|
||||
/// client can see - hiding the body hides renderers, not the animation - so the form walks,
|
||||
/// runs, jumps and creeps exactly when the real player does.
|
||||
///
|
||||
/// Kept next to the four local behaviours on purpose: this mirrors the movement half of their
|
||||
/// Update, and the two have to be changed together.
|
||||
///
|
||||
/// Attacks are not mirrored. Those are triggers fired from input on the owner's client and
|
||||
/// nothing replicates them, so a remote form still bites in silence - that needs a counter of
|
||||
/// its own on the ZDO and is a separate job.
|
||||
/// </summary>
|
||||
public class RemoteFenrirAnimator : MonoBehaviour
|
||||
{
|
||||
private Player player;
|
||||
private Animator playerAnim;
|
||||
private Animator formAnim;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// Resolved here rather than in Start: the model is instantiated under a player who may
|
||||
// still be assembling their own rig on the frame it arrives.
|
||||
if (player == null) player = GetComponentInParent<Player>();
|
||||
if (player == null) return;
|
||||
|
||||
if (formAnim == null) formAnim = GetComponent<Animator>() ?? GetComponentInChildren<Animator>();
|
||||
if (playerAnim == null)
|
||||
{
|
||||
Transform visual = player.transform.Find("Visual");
|
||||
if (visual != null) playerAnim = visual.GetComponent<Animator>();
|
||||
}
|
||||
if (formAnim == null || playerAnim == null) return;
|
||||
|
||||
bool grounded = playerAnim.GetBool("onGround");
|
||||
|
||||
// All four borrowed creatures answer to these, and they are still written through
|
||||
// try/catch the way the local behaviours do it: a controller missing one of them would
|
||||
// otherwise throw once per frame, for every onlooker.
|
||||
try { formAnim.SetBool("onGround", grounded); } catch {}
|
||||
try { formAnim.SetBool("inWater", playerAnim.GetBool("inWater")); } catch {}
|
||||
|
||||
// The same three cases the local behaviours use, so both views of the same wolf agree:
|
||||
// airborne and crouching each read as standing still. Player.IsCrouching answers off
|
||||
// the animator's current state, which is replicated, so it is true here too.
|
||||
bool still = !grounded || player.IsCrouching();
|
||||
try { formAnim.SetFloat("forward_speed", still ? 0f : playerAnim.GetFloat("forward_speed")); } catch {}
|
||||
try { formAnim.SetFloat("sideway_speed", still ? 0f : playerAnim.GetFloat("sideway_speed")); } catch {}
|
||||
}
|
||||
}
|
||||
|
||||
public class FenrirFormBehavior : MonoBehaviour
|
||||
{
|
||||
private Animator playerAnim;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue