public static void MakeSentient(EntityUid uid, IEntityManager entityManager)
        {
            entityManager.RemoveComponent <NPCComponent>(uid);

            entityManager.EnsureComponent <MindComponent>(uid);
            entityManager.EnsureComponent <InputMoverComponent>(uid);
            entityManager.EnsureComponent <MobMoverComponent>(uid);
            entityManager.EnsureComponent <MovementSpeedModifierComponent>(uid);
            entityManager.EnsureComponent <SharedSpeechComponent>(uid);
            entityManager.EnsureComponent <SharedEmotingComponent>(uid);
            entityManager.EnsureComponent <ExaminerComponent>(uid);
        }
        public override void EnterState(EntityUid uid, IEntityManager entityManager)
        {
            base.EnterState(uid, entityManager);
            entityManager.EnsureComponent <CollisionWakeComponent>(uid);
            var standingState = EntitySystem.Get <StandingStateSystem>();

            standingState.Down(uid);

            if (standingState.IsDown(uid) && entityManager.TryGetComponent(uid, out PhysicsComponent? physics))
            {
                physics.CanCollide = false;
            }

            if (entityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
            {
                appearance.SetData(DamageStateVisuals.State, DamageState.Dead);
            }
        }
        public static void MakeSentient(EntityUid uid, IEntityManager entityManager)
        {
            if (entityManager.HasComponent <AiControllerComponent>(uid))
            {
                entityManager.RemoveComponent <AiControllerComponent>(uid);
            }


            entityManager.EnsureComponent <MindComponent>(uid);
            entityManager.EnsureComponent <SharedPlayerInputMoverComponent>(uid);
            entityManager.EnsureComponent <SharedPlayerMobMoverComponent>(uid);
            entityManager.EnsureComponent <SharedSpeechComponent>(uid);
            entityManager.EnsureComponent <SharedEmotingComponent>(uid);
            entityManager.EnsureComponent <ExaminerComponent>(uid);
        }
        public void PerformAction(EntityUid uid, EntityUid?userUid, IEntityManager entityManager)
        {
            if (string.IsNullOrEmpty(FromContainer) || string.IsNullOrEmpty(ToContainer))
            {
                return;
            }

            var containerSystem  = entityManager.EntitySysManager.GetEntitySystem <ContainerSystem>();
            var containerManager = entityManager.EnsureComponent <ContainerManagerComponent>(uid);

            var from = containerSystem.EnsureContainer <Container>(uid, FromContainer, containerManager);
            var to   = containerSystem.EnsureContainer <Container>(uid, ToContainer, containerManager);

            foreach (var contained in from.ContainedEntities.ToArray())
            {
                if (from.Remove(contained))
                {
                    to.Insert(contained);
                }
            }
        }
Пример #5
0
        public override void InitializeEntity(EntityUid entity)
        {
            IoCManager.InjectDependencies(this);

            _entMan.EnsureComponent <AnimationPlayerComponent>(entity);
        }