using Content.Shared.Hands; using Content.Shared.Interaction.Components; using Content.Shared.Interaction.Events; using Content.Shared.Item; using Content.Shared.Movement.Components; using Content.Shared.Movement.Events; namespace Content.Shared.Interaction; // TODO deduplicate with AdminFrozenComponent /// /// Handles , which prevents various /// kinds of movement and interactions when attached to an entity. /// public partial class SharedInteractionSystem { [Dependency] private EntityQuery _relayInputMoverQuery; [SubscribeLocalEvent] private void CancelInteractEvent(Entity ent, ref InteractionAttemptEvent args) { if (ent.Comp.BlockInteraction) args.Cancelled = true; } [SubscribeLocalEvent] private void CancelUseEvent(Entity ent, ref UseAttemptEvent args) { if (ent.Comp.BlockUse) args.Cancel(); } [SubscribeLocalEvent] private void OnMoveAttempt(Entity ent, ref UpdateCanMoveEvent args) { // If we're relaying then don't cancel. if (_relayInputMoverQuery.HasComp(ent)) return; args.Cancel(); } [SubscribeLocalEvent] private void OnDropAttempt(Entity ent, ref DropAttemptEvent args) { if (ent.Comp.BlockInteraction) args.Cancel(); } [SubscribeLocalEvent] private void OnPickupAttempt(Entity ent, ref PickupAttemptEvent args) { if (ent.Comp.BlockInteraction) args.Cancel(); } [SubscribeLocalEvent] private void CancelEvent(Entity ent, ref ChangeDirectionAttemptEvent args) { args.Cancel(); } [SubscribeLocalEvent] private void OnBlockingStartup(Entity ent, ref ComponentStartup args) { _actionBlockerSystem.UpdateCanMove(ent); } [SubscribeLocalEvent] private void OnBlockingRemove(Entity ent, ref ComponentRemove args) { _actionBlockerSystem.UpdateCanMove(ent); } }