示例#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
 }