Exemple #1
0
 /// <summary>
 ///     Unsubscribes the session from getting PVS updates from the point of view of the specified entity.
 /// </summary>
 public void RemoveViewSubscriber(EntityUid uid, IPlayerSession session)
 {
     if (!EntityManager.TryGetComponent(uid, out ViewSubscriberComponent? viewSubscriber))
     {
         return; // Entity didn't have any subscriptions, do nothing.
     }
     if (!viewSubscriber.SubscribedSessions.Remove(session))
     {
         return; // Session wasn't subscribed, do nothing.
     }
     session.RemoveViewSubscription(uid);
     RaiseLocalEvent(uid, new ViewSubscriberRemovedEvent(uid, session));
 }