public static void ConnectClient(NetConnection newClientConnection)
        {
            var newClientObject = new ClientStructure(newClientConnection);

            LmpPluginHandler.FireOnClientConnect(newClientObject);

            ServerContext.Clients.TryAdd(newClientObject.Endpoint, newClientObject);
            LunaLog.Debug($"Online Players: {ServerContext.PlayerCount}, connected: {ServerContext.Clients.Count}");
        }
Example #2
0
        public static void ConnectClient(NetConnection newClientConnection)
        {
            var newClientObject = new ClientStructure(newClientConnection.RemoteEndPoint)
            {
                Subspace         = int.MinValue,
                PlayerStatus     = new PlayerStatus(),
                ConnectionStatus = ConnectionStatus.Connected,
                Connection       = newClientConnection,
                LastSendTime     = 0,
                LastReceiveTime  = ServerContext.ServerClock.ElapsedMilliseconds
            };

            Task.Run(() => MessageSender.StartSendingOutgoingMessages(newClientObject));

            LmpPluginHandler.FireOnClientConnect(newClientObject);

            ServerContext.Clients.TryAdd(newClientObject.Endpoint, newClientObject);
            VesselUpdateRelaySystem.AddPlayer(newClientObject);
            LunaLog.Debug($"Online Players: {ServerContext.PlayerCount}, connected: {ServerContext.Clients.Count}");
        }