public void HandleNewSubspace(ClientStructure client, WarpNewSubspaceMsgData message)
        {
            LunaLog.Debug($"{client.PlayerName} created a new subspace. Id {WarpContext.NextSubspaceId}");

            //Create Subspace
            WarpContext.Subspaces.TryAdd(WarpContext.NextSubspaceId, message.ServerTimeDifference);
            VesselRelaySystem.CreateNewSubspace(WarpContext.NextSubspaceId);

            //Tell all Clients about the new Subspace
            var newMessageData = new WarpNewSubspaceMsgData
            {
                ServerTimeDifference = message.ServerTimeDifference,
                PlayerCreator        = message.PlayerCreator,
                SubspaceKey          = WarpContext.NextSubspaceId
            };

            MessageQueuer.SendToAllClients <WarpSrvMsg>(newMessageData);

            WarpSystem.SaveSubspace(WarpContext.NextSubspaceId, message.ServerTimeDifference); //Save to disk
            WarpContext.NextSubspaceId++;
        }
Exemple #2
0
        public void HandleNewSubspace(ClientStructure client, WarpNewSubspaceMsgData message)
        {
            if (message.PlayerCreator != client.PlayerName)
            {
                return;
            }

            LunaLog.Debug($"{client.PlayerName} created a new subspace. Id {WarpContext.NextSubspaceId}");

            //Create Subspace
            WarpContext.Subspaces.TryAdd(WarpContext.NextSubspaceId, message.ServerTimeDifference);
            VesselRelaySystem.CreateNewSubspace(WarpContext.NextSubspaceId);

            //Tell all Clients about the new Subspace
            var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <WarpNewSubspaceMsgData>();

            msgData.ServerTimeDifference = message.ServerTimeDifference;
            msgData.PlayerCreator        = message.PlayerCreator;
            msgData.SubspaceKey          = WarpContext.NextSubspaceId;

            MessageQueuer.SendToAllClients <WarpSrvMsg>(msgData);
            WarpContext.NextSubspaceId++;
        }