From 7b2e382929204d4fa39ff599c3365c1b237de2e9 Mon Sep 17 00:00:00 2001 From: Dakamakat <52600490+dakamakat@users.noreply.github.com> Date: Tue, 23 Jan 2024 07:15:00 +0300 Subject: [PATCH] Use can attach check on shot attempt (#24396) refactor(SharedGunSystem): use can attach check on shot attempt --- Content.Shared/ActionBlocker/ActionBlockerSystem.cs | 12 +++++------- .../Weapons/Ranged/Systems/SharedGunSystem.cs | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Content.Shared/ActionBlocker/ActionBlockerSystem.cs b/Content.Shared/ActionBlocker/ActionBlockerSystem.cs index a3cd83042e..6dff8161ee 100644 --- a/Content.Shared/ActionBlocker/ActionBlockerSystem.cs +++ b/Content.Shared/ActionBlocker/ActionBlockerSystem.cs @@ -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) diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index 5d061a3f8a..9047ef7a8d 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -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; -- 2.51.2