]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Use can attach check on shot attempt (#24396)
authorDakamakat <52600490+dakamakat@users.noreply.github.com>
Tue, 23 Jan 2024 04:15:00 +0000 (07:15 +0300)
committerGitHub <noreply@github.com>
Tue, 23 Jan 2024 04:15:00 +0000 (23:15 -0500)
refactor(SharedGunSystem): use can attach check on shot attempt

Content.Shared/ActionBlocker/ActionBlockerSystem.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs

index a3cd83042e69f5784b42993c2d146bc27a3cd7c3..6dff8161eefc286d7656ae90d700a2c2f1ce1c9f 100644 (file)
@@ -162,14 +162,12 @@ namespace Content.Shared.ActionBlocker
             if (ev.Cancelled)
                 return false;
 
-            if (target != null)
-            {
-                var tev = new GettingAttackedAttemptEvent();
-                RaiseLocalEvent(target.Value, ref tev);
-                return !tev.Cancelled;
-            }
+            if (target == null)
+                return true;
 
-            return true;
+            var tev = new GettingAttackedAttemptEvent();
+            RaiseLocalEvent(target.Value, ref tev);
+            return !tev.Cancelled;
         }
 
         public bool CanChangeDirection(EntityUid uid)
index 5d061a3f8a64e4c7d5323b3e7abf1d514f0df14b..9047ef7a8d10717f80e1f3ad93482d4138c3b026 100644 (file)
@@ -230,7 +230,7 @@ public abstract partial class SharedGunSystem : EntitySystem
     private void AttemptShoot(EntityUid user, EntityUid gunUid, GunComponent gun)
     {
         if (gun.FireRate <= 0f ||
-            !_actionBlockerSystem.CanUseHeldEntity(user))
+            !_actionBlockerSystem.CanAttack(user))
             return;
 
         var toCoordinates = gun.ShootCoordinates;