Ejemplo n.º 1
0
        private void OnFollow(IMovableEntity entity, FollowEventArgs e)
        {
            var entityToFollow = entity.FindEntity <IEntity>(e.TargetId);

            if (entityToFollow == null)
            {
                Logger.Error($"Cannot find entity with object id: {e.TargetId} around {entity.Object.Name}");
                return;
            }

            entity.Follow.Target             = entityToFollow;
            entity.Moves.DestinationPosition = entityToFollow.Object.Position.Clone();
            entity.Object.MovingFlags        = ObjectState.OBJSTA_FMOVE;

            WorldPacketFactory.SendFollowTarget(entity, entityToFollow, e.Distance);
        }
Ejemplo n.º 2
0
        private void OnFollow(IMovableEntity entity, FollowEventArgs e)
        {
            var entityToFollow = entity.FindEntity <IEntity>(e.TargetId);

            if (entityToFollow == null)
            {
                Logger.Error($"Cannot find entity with object id: {e.TargetId} around {entity.Object.Name}");
                return;
            }

            if (entity.Follow.Target != entityToFollow)
            {
                entity.Follow.Target = entityToFollow;
                entity.MovableComponent.DestinationPosition = entityToFollow.Object.Position.Clone();
            }

            if (entity is IMonsterEntity monster)
            {
                monster.Timers.NextMoveTime = Time.TimeInSeconds() + 5;
            }

            WorldPacketFactory.SendFollowTarget(entity, entityToFollow, e.Distance);
        }