Use can attach check on shot attempt (#24396)

refactor(SharedGunSystem): use can attach check on shot attempt

(cherry picked from commit 7b2e382929204d4fa39ff599c3365c1b237de2e9)
This commit is contained in:
Dakamakat 2024-01-23 07:15:00 +03:00 committed by Debug
parent 25af0681d5
commit 1afa84e323
No known key found for this signature in database
GPG Key ID: 271270A74EF9C350
2 changed files with 6 additions and 8 deletions

View File

@ -162,14 +162,12 @@ namespace Content.Shared.ActionBlocker
if (ev.Cancelled) if (ev.Cancelled)
return false; return false;
if (target != null) if (target == null)
{ return true;
var tev = new GettingAttackedAttemptEvent();
RaiseLocalEvent(target.Value, ref tev);
return !tev.Cancelled;
}
return true; var tev = new GettingAttackedAttemptEvent();
RaiseLocalEvent(target.Value, ref tev);
return !tev.Cancelled;
} }
public bool CanChangeDirection(EntityUid uid) public bool CanChangeDirection(EntityUid uid)

View File

@ -232,7 +232,7 @@ public abstract partial class SharedGunSystem : EntitySystem
private void AttemptShoot(EntityUid user, EntityUid gunUid, GunComponent gun) private void AttemptShoot(EntityUid user, EntityUid gunUid, GunComponent gun)
{ {
if (gun.FireRate <= 0f || if (gun.FireRate <= 0f ||
!_actionBlockerSystem.CanUseHeldEntity(user)) !_actionBlockerSystem.CanAttack(user))
return; return;
var toCoordinates = gun.ShootCoordinates; var toCoordinates = gun.ShootCoordinates;