Exemple #1
0
        public bool Stand(EntityUid uid,
                          StandingStateComponent?standingState = null,
                          SharedAppearanceComponent?appearance = null)
        {
            // TODO: This should actually log missing comps...
            if (!Resolve(uid, ref standingState, false))
            {
                return(false);
            }

            // Optional component.
            Resolve(uid, ref appearance, false);

            if (standingState.Standing)
            {
                return(true);
            }

            var msg = new StandAttemptEvent();

            RaiseLocalEvent(uid, msg, false);

            if (msg.Cancelled)
            {
                return(false);
            }

            standingState.Standing = true;
            standingState.Dirty();
            RaiseLocalEvent(uid, new StoodEvent(), false);

            appearance?.SetData(RotationVisuals.RotationState, RotationState.Vertical);
            return(true);
        }
 private void OnStandAttempt(EntityUid uid, MobStateComponent component, StandAttemptEvent args)
 {
     if (component.IsIncapacitated())
     {
         args.Cancel();
     }
 }
Exemple #3
0
 private void HandleStand(EntityUid uid, SharedBuckleComponent component, StandAttemptEvent args)
 {
     if (component.Buckled)
     {
         args.Cancel();
     }
 }
Exemple #4
0
        public void Stand(StandingStateComponent component)
        {
            if (component.Standing)
            {
                return;
            }

            var entity = component.Owner;
            var uid    = entity.Uid;

            var msg = new StandAttemptEvent();

            EntityManager.EventBus.RaiseLocalEvent(uid, msg);

            if (msg.Cancelled)
            {
                return;
            }

            component.Standing = true;
            component.Dirty();
            EntityManager.EventBus.RaiseLocalEvent(uid, new StoodEvent());

            if (entity.TryGetComponent(out SharedAppearanceComponent? appearance))
            {
                appearance.SetData(RotationVisuals.RotationState, RotationState.Vertical);
            }
        }
Exemple #5
0
        public bool Stand(EntityUid uid,
                          StandingStateComponent?standingState = null,
                          AppearanceComponent?appearance       = null)
        {
            // TODO: This should actually log missing comps...
            if (!Resolve(uid, ref standingState, false))
            {
                return(false);
            }

            // Optional component.
            Resolve(uid, ref appearance, false);

            if (standingState.Standing)
            {
                return(true);
            }

            var msg = new StandAttemptEvent();

            RaiseLocalEvent(uid, msg, false);

            if (msg.Cancelled)
            {
                return(false);
            }

            standingState.Standing = true;
            Dirty(standingState);
            RaiseLocalEvent(uid, new StoodEvent(), false);

            appearance?.SetData(RotationVisuals.RotationState, RotationState.Vertical);

            if (TryComp(uid, out FixturesComponent? fixtureComponent))
            {
                foreach (var key in standingState.ChangedFixtures)
                {
                    if (fixtureComponent.Fixtures.TryGetValue(key, out var fixture))
                    {
                        fixture.CollisionMask |= StandingCollisionLayer;
                    }
                }
            }
            standingState.ChangedFixtures.Clear();

            return(true);
        }
        public bool Stand(EntityUid uid,
                          StandingStateComponent?standingState = null,
                          AppearanceComponent?appearance       = null)
        {
            // TODO: This should actually log missing comps...
            if (!Resolve(uid, ref standingState, false))
            {
                return(false);
            }

            // Optional component.
            Resolve(uid, ref appearance, false);

            if (standingState.Standing)
            {
                return(true);
            }

            var msg = new StandAttemptEvent();

            RaiseLocalEvent(uid, msg, false);

            if (msg.Cancelled)
            {
                return(false);
            }

            standingState.Standing = true;
            standingState.Dirty();
            RaiseLocalEvent(uid, new StoodEvent(), false);

            appearance?.SetData(RotationVisuals.RotationState, RotationState.Vertical);

            if (TryComp(uid, out FixturesComponent? fixtureComponent))
            {
                foreach (var fixture in fixtureComponent.Fixtures.Values)
                {
                    fixture.CollisionMask |= (int)CollisionGroup.VaultImpassable;
                }
            }

            return(true);
        }