]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Revolver fixes for caseless ammo and wielding (#30117)
authorKaga-404 <103199482+Kaga-404@users.noreply.github.com>
Fri, 2 Aug 2024 05:43:11 +0000 (22:43 -0700)
committerGitHub <noreply@github.com>
Fri, 2 Aug 2024 05:43:11 +0000 (15:43 +1000)
* handled check

* splits Handled and TryResetDelay checks

Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Revolver.cs

index 14aaff5bf70da9df174feb1e437191fad892a715..2c0204d946393c14f1134d3dccf8e490f167ccdc 100644 (file)
@@ -9,6 +9,8 @@ using Robust.Shared.Utility;
 using System;
 using System.Linq;
 using Content.Shared.Interaction.Events;
+using Content.Shared.Wieldable;
+using Content.Shared.Wieldable.Components;
 using JetBrains.Annotations;
 
 namespace Content.Shared.Weapons.Ranged.Systems;
@@ -31,9 +33,14 @@ public partial class SharedGunSystem
 
     private void OnRevolverUse(EntityUid uid, RevolverAmmoProviderComponent component, UseInHandEvent args)
     {
+        if (args.Handled)
+            return;
+
         if (!_useDelay.TryResetDelay(uid))
             return;
 
+        args.Handled = true;
+
         Cycle(component);
         UpdateAmmoCount(uid, prediction: false);
         Dirty(uid, component);
@@ -393,10 +400,14 @@ public partial class SharedGunSystem
                 args.Ammo.Add((spawned, EnsureComp<AmmoComponent>(spawned)));
 
                 if (cartridge.DeleteOnSpawn)
+                {
+                    component.AmmoSlots[index] = null;
                     component.Chambers[index] = null;
+                }
             }
             else
             {
+                component.AmmoSlots[index] = null;
                 component.Chambers[index] = null;
                 args.Ammo.Add((ent.Value, EnsureComp<AmmoComponent>(ent.Value)));
             }