fix(skadi): keep the dragon breath and its VFX pointing the same way

The ice breath and the model's own breath VFX could end up aimed in
completely different directions, most visibly on Fader where the VFX
is green poison and the divergence is obvious.

Two causes, both fixed here:

- Every one of the 60 projectiles re-read GetLookDir() inside the
  spawn loop, so over the ~3 s a breath lasts the ice tracked the
  crosshair live while the VFX - baked into the animation, always
  leaving the muzzle - stayed with the body.

- Character.UpdateRotation only steers the body by m_lookYaw when
  AlwaysRotateCamera() is true or the player is standing still;
  otherwise it faces m_moveDir. Running or strafing mid-breath turned
  the model towards the run while the projectiles kept going where the
  player aimed.

The breath now holds the body on the aim for its duration (a deadline
rather than a flag, so an interrupted coroutine cannot leave the body
pinned) and the projectiles come out along the body's forward, so the
two cannot separate: the mouse steers the head and the whole breath
follows it. Applied to Moder's ground breath as well, which had the
same shape.

Also replaces anim.SetTrigger with SetAttackTrigger, which warns when
a trigger name is not on the animator - Unity ignores those silently,
so a wrong name was indistinguishable from an animation not playing.
This commit is contained in:
kanym 2026-08-09 12:33:54 +02:00
commit 5532842ebc
2 changed files with 92 additions and 12 deletions

View file

@ -444,6 +444,19 @@ namespace RacesOfValheim
public static bool Prefix(Player __instance, ref bool __result)
{
if (__instance != Player.m_localPlayer) return true;
// A breath in progress holds the body on the aim, whether the player is moving or not.
// Character.UpdateRotation only steers by m_lookYaw when AlwaysRotateCamera() is true
// or the player is standing still - otherwise it faces m_moveDir. So running or
// strafing mid-breath turned the model (and the muzzle VFX baked into its animation)
// towards the run while our projectiles kept going where the player aimed, which is
// how the ice and the poison ended up pointing different ways.
if (DrakeFormBehavior.IsBreathing && DrakeFormBehavior.Active != null)
{
__result = true;
return false;
}
if (!SkadiDirectedFlightPatch.Reversing) return true;
DrakeFormBehavior form = DrakeFormBehavior.Active;
@ -473,7 +486,7 @@ namespace RacesOfValheim
// the live button state (via the configured shortcut, so a rebind stays in sync)
// rather than a flag set during our Update, so it does not depend on whether
// PlayerController's FixedUpdate happens to run first.
if (secondaryAttack && SkadiConfig.ColdSpellKey.Value.IsPressed() &&
if (secondaryAttack && SkadiConfig.ColdSpellKey.Value.IsPressedIgnoringHeldKeys() &&
SkadiRace.Instance != null && SkadiRace.Instance.IsSkadi())
{
var rules = SkadiProgression.GetRules(BossProgressionManager.GetCurrentProgressionState());