]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix gun dump bug (#15936)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Sun, 30 Apr 2023 06:33:03 +0000 (16:33 +1000)
committerGitHub <noreply@github.com>
Sun, 30 Apr 2023 06:33:03 +0000 (16:33 +1000)
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs

index 99739eff55a60dd917a0d5c4595b7fc79eb9d0e2..65bb9e6a53d5fa3a2442664badf884f88255efd1 100644 (file)
@@ -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)
         {