Make CanAttack check for container (#11650)

This commit is contained in:
metalgearsloth
2022-10-04 12:50:09 +11:00
committed by GitHub
parent b754b87985
commit fb839f865e
2 changed files with 9 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ using Content.Shared.Movement.Events;
using Content.Shared.Speech;
using Content.Shared.Throwing;
using JetBrains.Annotations;
using Robust.Shared.Containers;
namespace Content.Shared.ActionBlocker
{
@@ -19,6 +20,8 @@ namespace Content.Shared.ActionBlocker
[UsedImplicitly]
public sealed class ActionBlockerSystem : EntitySystem
{
[Dependency] private readonly SharedContainerSystem _container = default!;
public override void Initialize()
{
base.Initialize();
@@ -151,6 +154,9 @@ namespace Content.Shared.ActionBlocker
public bool CanAttack(EntityUid uid, EntityUid? target = null)
{
if (_container.IsEntityInContainer(uid))
return false;
var ev = new AttackAttemptEvent(uid, target);
RaiseLocalEvent(uid, ev);