public bool CanPull(EntityUid puller, EntityUid pulled) { if (!EntityManager.TryGetComponent <SharedPullerComponent>(puller, out var comp)) { return(false); } if (comp.NeedsHands && !_handsSystem.TryGetEmptyHand(puller, out _)) { return(false); } if (!_blocker.CanInteract(puller, pulled)) { return(false); } if (!EntityManager.TryGetComponent <IPhysBody>(pulled, out var physics)) { return(false); } if (physics.BodyType == BodyType.Static) { return(false); } if (puller == pulled) { return(false); } if (!_containerSystem.IsInSameOrNoContainer(puller, pulled)) { return(false); } if (EntityManager.TryGetComponent <SharedBuckleComponent?>(puller, out var buckle)) { // Prevent people pulling the chair they're on, etc. if (buckle.Buckled && (buckle.LastEntityBuckledTo == pulled)) { return(false); } } var getPulled = new BeingPulledAttemptEvent(puller, pulled); RaiseLocalEvent(pulled, getPulled, true); var startPull = new StartPullAttemptEvent(puller, pulled); RaiseLocalEvent(puller, startPull, true); return(!startPull.Cancelled && !getPulled.Cancelled); }
private void OnBeingPulledAttempt(EntityUid uid, SharedCuffableComponent component, BeingPulledAttemptEvent args) { if (!TryComp <SharedPullableComponent>(uid, out var pullable)) { return; } if (pullable.Puller != null && !component.CanStillInteract) // If we are being pulled already and cuffed, we can't get pulled again. { args.Cancel(); } }