From: Dakamakat <52600490+dakamakat@users.noreply.github.com> Date: Tue, 23 Jan 2024 04:15:00 +0000 (+0300) Subject: Use can attach check on shot attempt (#24396) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=7b2e382929204d4fa39ff599c3365c1b237de2e9;p=space-station-14.git Use can attach check on shot attempt (#24396) refactor(SharedGunSystem): use can attach check on shot attempt --- 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;