예제 #1
0
        private MobileParty GetPlayerParty(RailServerPeer peer)
        {
            if (Coop.IsClient && Coop.IsServer)
            {
                return(MobileParty.MainParty);
            }

            return(null);
        }
예제 #2
0
 private void OnClientRemoved(RailServerPeer peer)
 {
     lock (m_Lock)
     {
         foreach (RailEntityServer controlledEntity in m_Room
                  .Entities.Where(
                      e => e.Controller == peer)
                  .Select(e => e as RailEntityServer))
         {
             peer.RevokeControl(controlledEntity);
             OnPlayerControlledEntityOrphaned?.Invoke(peer, controlledEntity);
         }
     }
 }
예제 #3
0
        private void OnClientAdded(RailServerPeer peer)
        {
            if (IsArbiter(peer))
            {
                m_Arbiter = peer;
            }

            MobileParty party = GetPlayerParty(peer);

            if (party == null || !m_Parties.ContainsKey(party))
            {
                Logger.Warn("Player party not found.");
                return;
            }

            peer.GrantControl(m_Parties[party]);
            Logger.Info($"{party} control granted to {peer}.");
        }
예제 #4
0
        private void OnClientAdded(RailServerPeer peer)
        {
            if (IsArbiter(peer))
            {
                m_Arbiter = peer;
            }

            MobileParty party = GetPlayerParty(peer);

            lock (m_Lock)
            {
                if (party == null || !m_Parties.ContainsKey(party))
                {
                    Logger.Warn("Player party not found.");
                }

                if (m_Parties[party].Controller == null)
                {
                    // TODO: Currently only the hosting player gets to control the main party. In a future version, every player gets their own party.
                    peer.GrantControl(m_Parties[party]);
                    Logger.Info("{party} control granted to {peer}.", party, peer);
                }
            }
        }
예제 #5
0
 private bool IsArbiter(RailServerPeer peer)
 {
     // TODO: Implement
     return(true);
 }
예제 #6
0
 private void OnClientRemoved(RailServerPeer peer)
 {
     // TODO: Remove control
 }