From b6223e51429b1414d3f6545d193d63f4e9607cf5 Mon Sep 17 00:00:00 2001 From: Tore Bergebakken Date: Mon, 30 Dec 2024 22:37:52 +0100 Subject: [PATCH 1/2] Fix infinite lazur ammo glitch Turns out we haven't had the isFiring variable working properly for ages --- Assets/Animation/Augments/Lazur/Cannon_CannonAction.anim | 4 ++-- Assets/Scripts/Augment/AugmentImplementations/Revolver.cs | 2 +- Assets/Scripts/Augment/GunController.cs | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Assets/Animation/Augments/Lazur/Cannon_CannonAction.anim b/Assets/Animation/Augments/Lazur/Cannon_CannonAction.anim index 7f8844f8d..f1fc9be2b 100644 --- a/Assets/Animation/Augments/Lazur/Cannon_CannonAction.anim +++ b/Assets/Animation/Augments/Lazur/Cannon_CannonAction.anim @@ -2107,7 +2107,7 @@ AnimationClip: m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 1.3333334 + m_StopTime: 1.3166667 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 @@ -11057,7 +11057,7 @@ AnimationClip: floatParameter: 0 intParameter: 0 messageOptions: 0 - - time: 1.3333334 + - time: 1.3 functionName: EndFiring data: objectReferenceParameter: {fileID: 0} diff --git a/Assets/Scripts/Augment/AugmentImplementations/Revolver.cs b/Assets/Scripts/Augment/AugmentImplementations/Revolver.cs index 28f53c10e..85f91243c 100644 --- a/Assets/Scripts/Augment/AugmentImplementations/Revolver.cs +++ b/Assets/Scripts/Augment/AugmentImplementations/Revolver.cs @@ -53,7 +53,7 @@ protected override void Reload(GunStats stats) isReloadInProgress = true; animator.SetTrigger("Reload"); - gunController.onReload?.Invoke(stats); + // gunController.onReload?.Invoke(stats); } public void TriggerSteam() diff --git a/Assets/Scripts/Augment/GunController.cs b/Assets/Scripts/Augment/GunController.cs index 2c7598e3b..fcd29951b 100644 --- a/Assets/Scripts/Augment/GunController.cs +++ b/Assets/Scripts/Augment/GunController.cs @@ -161,6 +161,7 @@ private void FixedUpdate() } if (ShouldFire()) { + isFiring = true; FireGun(); } } @@ -215,6 +216,7 @@ private void RpcFire(Quaternion rotation) } catch (Exception e) { + isFiring = false; Debug.LogError("Failed to fire gun!"); Debug.LogError(e); } From 6499661e095bb7e0edf62b5e2632697e31161ac0 Mon Sep 17 00:00:00 2001 From: Tore Bergebakken Date: Tue, 4 Feb 2025 18:50:49 +0100 Subject: [PATCH 2/2] wip try logging stuff --- Assets/Scripts/Augment/GunController.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Assets/Scripts/Augment/GunController.cs b/Assets/Scripts/Augment/GunController.cs index fcd29951b..f2caa7c31 100644 --- a/Assets/Scripts/Augment/GunController.cs +++ b/Assets/Scripts/Augment/GunController.cs @@ -164,6 +164,8 @@ private void FixedUpdate() isFiring = true; FireGun(); } + // TODO REMOVE + else if (isFiring && triggerPressed) Debug.Log("GCGC OH NO FIRED WHILE FIRING!!!!"); } /// @@ -173,8 +175,11 @@ private void FixedUpdate() /// Percentage of ammunition to be reloaded. public void Reload(float fractionNormalized) { + Debug.Log("GCGC RELOAD CALLED"); int amount = Mathf.Max(1, Mathf.FloorToInt(stats.MagazineSize * fractionNormalized)); stats.Ammo = Mathf.Min(stats.Ammo + amount, stats.MagazineSize); + if (Player.identity.Body.id == "Stock") + isFiring = false; onReload?.Invoke(stats); } @@ -256,6 +261,7 @@ private void FireGun() try { + Debug.Log("GCGC FIRING!"); onFireStart?.Invoke(stats); AimAtTarget(); // Tell server to fire @@ -326,6 +332,7 @@ private void FireEnd() { stats.Ammo = Mathf.Clamp(stats.Ammo - 1, 0, stats.MagazineSize); isFiring = false; + Debug.Log("GCGC FIRE END"); onFireEnd?.Invoke(stats); } }