Use can attach check on shot attempt (#24396)

refactor(SharedGunSystem): use can attach check on shot attempt
This commit is contained in:
Dakamakat
2024-01-23 07:15:00 +03:00
committed by GitHub
parent d5e96dece2
commit 7b2e382929
2 changed files with 6 additions and 8 deletions

View File

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

View 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;