From 9efca42715a1f649d589de3ecb04518929ef180d Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sun, 30 Apr 2023 16:33:03 +1000 Subject: [PATCH] Fix gun dump bug (#15936) --- Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index 99739eff55..65bb9e6a53 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -223,13 +223,15 @@ public abstract partial class SharedGunSystem : EntitySystem if (gun.NextFire > curTime) return; + var fireRate = TimeSpan.FromSeconds(1f / gun.FireRate); + // First shot - if (gun.ShotCounter == 0 && gun.NextFire < curTime) + // Previously we checked shotcounter but in some cases all the bullets got dumped at once + if (gun.NextFire < curTime - fireRate) gun.NextFire = curTime; var shots = 0; var lastFire = gun.NextFire; - var fireRate = TimeSpan.FromSeconds(1f / gun.FireRate); while (gun.NextFire <= curTime) { -- 2.51.2