private void OnBoundInterfaceInteractAttempt(BoundUserInterfaceMessageAttempt ev) { if (!TryComp(ev.Target, out ActivatableUIComponent? comp)) { return; } if (!comp.RequireHands) { return; } if (!TryComp(ev.Sender.AttachedEntity, out SharedHandsComponent? hands) || hands.Hands.Count == 0) { ev.Cancel(); } }
/// <summary> /// Check that the user that is interacting with the BUI is capable of interacting and can access the entity. /// </summary> private void OnBoundInterfaceInteractAttempt(BoundUserInterfaceMessageAttempt ev) { if (ev.Sender.AttachedEntity is not EntityUid user || !_actionBlockerSystem.CanInteract(user, ev.Target)) { ev.Cancel(); return; } if (!ContainerSystem.IsInSameOrParentContainer(user, ev.Target) && !CanAccessViaStorage(user, ev.Target)) { ev.Cancel(); return; } if (!InRangeUnobstructed(user, ev.Target)) { ev.Cancel(); return; } }