diff --git a/Fika.Core/Coop/ObservedClasses/HandsControllers/CoopObservedFirearmController.cs b/Fika.Core/Coop/ObservedClasses/HandsControllers/CoopObservedFirearmController.cs index 374e53a2..210dd508 100644 --- a/Fika.Core/Coop/ObservedClasses/HandsControllers/CoopObservedFirearmController.cs +++ b/Fika.Core/Coop/ObservedClasses/HandsControllers/CoopObservedFirearmController.cs @@ -130,7 +130,9 @@ public override void OnPlayerDead() { triggerPressed = false; SetTriggerPressed(false); - WeaponSoundPlayer.enabled = false; + + needsReset = false; + WeaponSoundPlayer.OnBreakLoop(); coopPlayer.HandsAnimator.Animator.Update(Time.fixedDeltaTime); ManualUpdate(Time.fixedDeltaTime); @@ -139,9 +141,23 @@ public override void OnPlayerDead() CurrentOperation.FastForward(); } + StartCoroutine(BreakFiringLoop()); + base.OnPlayerDead(); } + private IEnumerator BreakFiringLoop() + { + Traverse isFiring = Traverse.Create(WeaponSoundPlayer).Field("_isFiring"); + int attempts = 0; + while (isFiring.Value && attempts < 10) + { + yield return new WaitForEndOfFrame(); + WeaponSoundPlayer.OnBreakLoop(); + attempts++; + } + } + public override void SetScopeMode(GStruct165[] scopeStates) { _player.ProceduralWeaponAnimation.ObservedCalibration();