Example #1
0
        private bool IsInDetailsRange(EntityUid examiner, EntityUid entity)
        {
            // check if the mob is in ciritcal or dead
            if (EntityManager.TryGetComponent(examiner, out MobStateComponent mobState) && mobState.IsIncapacitated())
            {
                return(false);
            }

            if (entity.TryGetContainerMan(out var man) && man.Owner == examiner)
            {
                return(true);
            }

            return(examiner.InRangeUnobstructed(entity, ExamineDetailsRange, ignoreInsideBlocker: true) &&
                   examiner.IsInSameOrNoContainer(entity));
        }
        public bool CanPull(EntityUid puller, EntityUid pulled)
        {
            if (!EntityManager.HasComponent <SharedPullerComponent>(puller))
            {
                return(false);
            }

            if (!_blocker.CanInteract(puller))
            {
                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 (!puller.IsInSameOrNoContainer(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 startPull = new StartPullAttemptEvent(puller, pulled);

            RaiseLocalEvent(puller, startPull);
            return(!startPull.Cancelled);
        }