diff --git a/JotunnModStub/Fenrir/FenrirBehaviors.cs b/JotunnModStub/Fenrir/FenrirBehaviors.cs index 0c3ef62..b702a20 100644 --- a/JotunnModStub/Fenrir/FenrirBehaviors.cs +++ b/JotunnModStub/Fenrir/FenrirBehaviors.cs @@ -343,6 +343,14 @@ namespace RacesOfValheim main.startLifetimeMultiplier *= 1.2f; main.loop = true; } + + // The roar of the fire, the same one-throw story: set before its ZSFX first plays. + foreach (ZSFX sfx in instance.GetComponentsInChildren()) + { + sfx.m_fadeOutOnAwake = false; + AudioSource source = sfx.GetComponent(); + if (source != null) source.loop = true; + } return instance; } @@ -889,7 +897,7 @@ namespace RacesOfValheim StopFire(); } - if (canAct && FenrirConfig.HowlKey.Value.IsDownIgnoringHeldKeys()) + if (canAct && !isShootingFire && FenrirConfig.HowlKey.Value.IsDownIgnoringHeldKeys()) { StartCoroutine(HowlRoutine()); } @@ -977,6 +985,10 @@ namespace RacesOfValheim isShootingFire = true; LocalBreathing = true; + // Planted while it breathes, as the vanilla Cultist is: its controller has no walking + // version of the cast, so a moving Cultist slid along in the casting pose. + // Fenrir_FormHoldStill_Patch holds the player; turning to the camera still works. + FenrirForms.LocalAttacking = true; flaming = false; fireStarted = Time.time; fireTimer = 0f; @@ -1018,6 +1030,7 @@ namespace RacesOfValheim private void OnDestroy() { if (isShootingFire) FenrirAttackSync.PublishFire(false); + if (isShootingFire) FenrirForms.LocalAttacking = false; LocalBreathing = false; } @@ -1025,6 +1038,7 @@ namespace RacesOfValheim { isShootingFire = false; LocalBreathing = false; + FenrirForms.LocalAttacking = false; flaming = false; cultistAnim.ResetTrigger("attack_flames"); FenrirAttackSync.PublishFire(false); @@ -1783,18 +1797,26 @@ namespace RacesOfValheim return t >= FlamesAt || (t < 0f && Time.time - started >= FlamesAt + 0.2f); } - /// Holds the arms in the casting pose: the Animator stops once the clip reaches PinAt. + /// + /// Holds the arms in the casting pose: once the clip reaches PinAt it is put back there every + /// frame. Not with Animator.speed = 0, which is what the troll's pin uses: the creature's own + /// CharacterAnimEvent sits on this model and sets speed back to 1 on every physics step while + /// the player is not in a vanilla attack, so the clip ran on to its end and the Cultist went + /// back to idle with the fire still pouring out. + /// public static void Hold(Animator anim) { - if (!anim.IsInTransition(0) && ClipTime(anim) >= PinAt) anim.speed = 0f; + if (anim.IsInTransition(0)) return; + AnimatorStateInfo info = anim.GetCurrentAnimatorStateInfo(0); + if (info.fullPathHash != State || info.length <= 0f) return; + if (info.normalizedTime * info.length >= PinAt) anim.Play(State, 0, PinAt / info.length); } - /// Lets the Animator run again and blends out of the clip, unless a stagger has - /// taken over (FormStagger has fired the form's own). + /// Blends out of the clip, unless a stagger has taken over (FormStagger has fired + /// the form's own). public static void Release(Animator anim, Player player) { if (anim == null) return; - anim.speed = 1f; if (ClipTime(anim) >= 0f && (player == null || !player.IsStaggering())) anim.CrossFadeInFixedTime(MovementState, Fade, 0); }